From e316928593f2c838563e115c705282cf4f30de33 Mon Sep 17 00:00:00 2001 From: Aleks Rutins Date: Wed, 4 Jun 2025 16:56:27 -0400 Subject: [PATCH] Update for radicle --- build.rb | 2 +- pages/gomod.rb | 8 +++++++- posts/2025-02-13-go-module-imports.md | 4 +++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/build.rb b/build.rb index e29dd42..8bd25e6 100644 --- a/build.rb +++ b/build.rb @@ -12,7 +12,7 @@ require_relative "pages/post" require_relative "pages/gomod" def go_modules = { - 'farthergate.com/terminated': 'git.farthergate.com/ztYyRKXjvYE5Ri7YjsXf8gGY5cXy' + 'farthergate.com/terminated': 'https://git.farthergate.com/ztYyRKXjvYE5Ri7YjsXf8gGY5cXy.git' } Phlexite::Site.new { |s| diff --git a/pages/gomod.rb b/pages/gomod.rb index 3d150db..9ce4430 100644 --- a/pages/gomod.rb +++ b/pages/gomod.rb @@ -2,6 +2,12 @@ class Pages::GoMod < ::Phlex::HTML def initialize(import, repo) @import = import @repo = repo + + @repourl = repo.to_s + + if @repourl.start_with?("https://git.farthergate.com") + @repourl = "https://git.farthergate.com/p/rad:" + @repourl.delete_prefix("https://git.farthergate.com/").delete_suffix(".git") + end end def view_template render ::Pages::Layout.new({title: @import.to_s}, meta: { @@ -11,7 +17,7 @@ class Pages::GoMod < ::Phlex::HTML h1 { @import } p { plain "This is a generated page to host the Go module located at " - a(href: @repo) { @repo } + a(href: @repo) { @repourl } plain ". You'll probably find more information about it over there." } } diff --git a/posts/2025-02-13-go-module-imports.md b/posts/2025-02-13-go-module-imports.md index 36fc8d1..a316370 100644 --- a/posts/2025-02-13-go-module-imports.md +++ b/posts/2025-02-13-go-module-imports.md @@ -3,6 +3,8 @@ title: Custom import paths for Go modules published_on: '2025-02-13' --- +*Updated 6/4/2025: Replaced the demo page.* + Go modules are great. URL-based imports, generally, are great. One of the things that makes them so great is that putting them on your own domain provides a good way of verifying ownership without going through a third party or a complicated review process. Plus, it looks cool. So, how exactly does one accomplish such a thing? Well, it's [buried in the documentation](https://pkg.go.dev/cmd/go#hdr-Remote_import_paths), but it's really pretty simple. For each import path (e.g. `mysite.com/mypackage`), just put a page on your website with a `go-import` meta tag: @@ -22,4 +24,4 @@ def go_modules = { } ``` -See [farthergate.com/stack](/stack) for the generated page. Look in the web inspector for the `meta` tag! \ No newline at end of file +See [farthergate.com/terminated](/terminated) for an example of a generated page. Look in the web inspector for the `meta` tag! \ No newline at end of file