diff options
Diffstat (limited to 'src/http/tpl')
-rw-r--r-- | src/http/tpl/admin.html | 6 | ||||
-rw-r--r-- | src/http/tpl/base.html | 22 | ||||
-rw-r--r-- | src/http/tpl/draft-posts-manage.html | 14 | ||||
-rw-r--r-- | src/http/tpl/follow.html | 2 | ||||
-rw-r--r-- | src/http/tpl/gemini-cta.html | 6 | ||||
-rw-r--r-- | src/http/tpl/image.html | 4 | ||||
-rw-r--r-- | src/http/tpl/index.html | 6 | ||||
-rw-r--r-- | src/http/tpl/post-assets-manage.html | 8 | ||||
-rw-r--r-- | src/http/tpl/post-edit.html | 16 | ||||
-rw-r--r-- | src/http/tpl/post.html | 4 | ||||
-rw-r--r-- | src/http/tpl/posts-manage.html | 14 | ||||
-rw-r--r-- | src/http/tpl/posts.html | 8 |
12 files changed, 54 insertions, 56 deletions
diff --git a/src/http/tpl/admin.html b/src/http/tpl/admin.html index 0b4b4e3..2dfab0f 100644 --- a/src/http/tpl/admin.html +++ b/src/http/tpl/admin.html @@ -7,9 +7,9 @@ mostly left open to inspection, but you will not able to change anything without providing credentials. <ul> - <li><a href="{{ BlogURL "posts?method=manage" }}">Posts</a></li> - <li><a href="{{ BlogURL "assets?method=manage" }}">Assets</a></li> - <li><a href="{{ BlogURL "drafts?method=manage" }}">Drafts</a> (private)</li> + <li><a href="{{ .RootURL.Posts.MethodManage }}">Posts</a></li> + <li><a href="{{ .RootURL.Assets.MethodManage }}">Assets</a></li> + <li><a href="{{ .RootURL.Drafts.MethodManage }}">Drafts</a> (private)</li> </ul> {{ end }} diff --git a/src/http/tpl/base.html b/src/http/tpl/base.html index 47644f7..f0419d5 100644 --- a/src/http/tpl/base.html +++ b/src/http/tpl/base.html @@ -3,12 +3,12 @@ <head> <title>{{ .Title }}</title> - <link rel="stylesheet" type="text/css" href="{{ StaticURL "new.css" }}" /> - <link rel="stylesheet" type="text/css" href="{{ StaticURL "mediocre.css" }}" /> - <link rel="apple-touch-icon" sizes="180x180" href="{{ StaticURL "favicon/apple-touch-icon.png" }}"> - <link rel="icon" type="image/png" sizes="32x32" href="{{ StaticURL "favicon/favicon-32x32.png" }}"> - <link rel="icon" type="image/png" sizes="16x16" href="{{ StaticURL "favicon/favicon-16x16.png" }}"> - <link rel="manifest" href="{{ StaticURL "favicon/site.webmanifest" }}"> + <link rel="stylesheet" type="text/css" href="{{ .RootURL.Static "new.css" }}" /> + <link rel="stylesheet" type="text/css" href="{{ .RootURL.Static "mediocre.css" }}" /> + <link rel="apple-touch-icon" sizes="180x180" href="{{ .RootURL.Static "favicon/apple-touch-icon.png" }}"> + <link rel="icon" type="image/png" sizes="32x32" href="{{ .RootURL.Static "favicon/favicon-32x32.png" }}"> + <link rel="icon" type="image/png" sizes="16x16" href="{{ .RootURL.Static "favicon/favicon-16x16.png" }}"> + <link rel="manifest" href="{{ .RootURL.Static "favicon/site.webmanifest" }}"> </head> <body> @@ -105,17 +105,17 @@ <strong>mediocregopher</strong>'s lil web corner <br/> <br/> - <a href="{{ BlogURL "/" }}">Home</a> + <a href="{{ .RootURL }}">Home</a> // - <a href="{{ BlogURL "/posts" }}">Posts</a> + <a href="{{ .RootURL.Posts }}">Posts</a> / - <a href="{{ BlogURL "follow" }}">Follow</a> + <a href="{{ .RootURL.Path "follow" }}">Follow</a> / - <a href="{{ BlogURL "feed.xml" }}">RSS</a> + <a href="{{ .RootURL.Path "feed.xml" }}">RSS</a> // <a href="https://dev.mediocregopher.com/mediocre-blog.git">Source</a> / - <a href="{{ StaticURL "wtfpl.txt" }}">License</a> + <a href="{{ .RootURL.Static "wtfpl.txt" }}">License</a> </header> {{ template "body" . }} diff --git a/src/http/tpl/draft-posts-manage.html b/src/http/tpl/draft-posts-manage.html index b1b4362..417f716 100644 --- a/src/http/tpl/draft-posts-manage.html +++ b/src/http/tpl/draft-posts-manage.html @@ -1,6 +1,6 @@ {{ define "body" }} - {{ $page := .GetQueryIntValue "p" 0 -}} + {{ $page := .GetQueryIntValue "page" 0 -}} {{ $getPostsRes := .GetDraftPosts $page 20 -}} <script> @@ -11,18 +11,18 @@ </script> <p> - <a href="{{ BlogURL "admin" }}">Back to Admin</a> + <a href="{{ .RootURL.Path "admin" }}">Back to Admin</a> </p> <h1>Drafts</h1> <p> - <a href="{{ BlogURL "drafts" }}?method=edit">New Draft</a> + <a href="{{ .RootURL.Drafts.MethodEdit }}">New Draft</a> </p> {{ if gt $page 0 }} <p> - <a href="?method=manage&p={{ .Add $page -1 }}">< < Previous Page</a> + <a href="{{ .RootURL.Drafts.MethodManage.Page (.Add $page -1) }}">< < Previous Page</a> </p> {{ end }} @@ -32,13 +32,13 @@ <tr> <td>{{ .Title }}</td> <td> - <a href="{{ DraftURL .ID }}?method=edit"> + <a href="{{ ($.RootURL.Draft .ID).MethodEdit }}"> Edit </a> </td> <td> <form - action="{{ DraftURL .ID }}?method=delete" + action="{{ ($.RootURL.Draft .ID).MethodDelete }}" method="POST" > <input @@ -55,7 +55,7 @@ {{ if $getPostsRes.HasMore }} <p> - <a href="?method=manage&p={{ .Add $page 1 }}">Next Page > ></a> + <a href="{{ .RootURL.Drafts.MethodManage.Page (.Add $page 1) }}">Next Page > ></a> </p> {{ end }} diff --git a/src/http/tpl/follow.html b/src/http/tpl/follow.html index 1958f95..091af49 100644 --- a/src/http/tpl/follow.html +++ b/src/http/tpl/follow.html @@ -6,7 +6,7 @@ </p> <p> - <a href="{{ BlogHTTPURL "feed.xml" }}">{{ BlogHTTPURL "feed.xml" }}</a> + <a href="{{ .RootURL.Absolute.Path "feed.xml" }}">{{ .RootURL.Absolute.Path "feed.xml" }}</a> </p> <p> diff --git a/src/http/tpl/gemini-cta.html b/src/http/tpl/gemini-cta.html index 89b8e8b..77c1114 100644 --- a/src/http/tpl/gemini-cta.html +++ b/src/http/tpl/gemini-cta.html @@ -2,11 +2,9 @@ <p> This site can also be accessed via the gemini protocol: - <a href="{{ BlogGeminiURL "/" | .URLIsSafe }}"> - {{ BlogGeminiURL "/" }} - </a> + <a href="{{ .RootURL.Gemini.HTMLSafe }}">{{ .RootURL.Gemini.HTMLSafe }}</a> </p> <p> - <a href="{{ PostURL "gemspace-tour" }}">What is gemini?</a> + <a href="{{ .RootURL.Post "gemspace-tour" }}">What is gemini?</a> </p> diff --git a/src/http/tpl/image.html b/src/http/tpl/image.html index c6c19b3..7778625 100644 --- a/src/http/tpl/image.html +++ b/src/http/tpl/image.html @@ -1,7 +1,7 @@ <div style="text-align: center;"> - <a href="{{ AssetURL .ID }}" target="_blank"> + <a href="{{ .RootURL.Asset .ID }}" target="_blank"> <img - src="{{ AssetURL .ID }}{{ if .Resizable }}?w=800{{ end }}" + src="{{ .RootURL.Asset .ID }}{{ if .Resizable }}?w=800{{ end }}" alt="{{ .Descr }}" /> </a> diff --git a/src/http/tpl/index.html b/src/http/tpl/index.html index 7f6399a..2685f4f 100644 --- a/src/http/tpl/index.html +++ b/src/http/tpl/index.html @@ -2,9 +2,9 @@ <p> This here's my little corner of the web, where I publish - <a href="{{ BlogURL "posts" }}">posts</a> + <a href="{{ .RootURL.Posts }}">posts</a> about projects I'm working on and things that interest me (which you can - <a href="{{ BlogURL "follow" }}">follow</a>, + <a href="{{ .RootURL.Path "follow" }}">follow</a>, if you like). </p> @@ -12,7 +12,7 @@ <p>Feel free to hmu over email or Signal if you'd like to get in touch.</p> <ul> <li>Email: <a href="mailto:me@mediocregopher.com">me@mediocregopher.com</a></li> - <li><a href="{{ StaticURL "me@mediocregopher.com.gpg" }}">GPG Key</a></li> + <li><a href="{{ .RootURL.Static "me@mediocregopher.com.gpg" }}">GPG Key</a></li> <li>Signal: <a href="https://signal.me/#eu/x5psueq2E3WfFwwEgFDoWeSZx9k4u8vFBaiMSa4Lo0cvluHkb-dIpJp1wfdJsdie"> mediocregopher.01 diff --git a/src/http/tpl/post-assets-manage.html b/src/http/tpl/post-assets-manage.html index a0b0da0..7e01ff4 100644 --- a/src/http/tpl/post-assets-manage.html +++ b/src/http/tpl/post-assets-manage.html @@ -3,7 +3,7 @@ {{ $assetIDs := .GetPostAssetIDs }} <p> - <a href="{{ BlogURL "admin" }}">Back to Admin</a> + <a href="{{ .RootURL.Path "admin" }}">Back to Admin</a> </p> <h1>Assets</h1> @@ -15,7 +15,7 @@ overwritten. </p> -<form action="{{ BlogURL "assets/" }}" method="POST" enctype="multipart/form-data"> +<form action="{{ .RootURL.Assets }}" method="POST" enctype="multipart/form-data"> <div class="row"> <div class="four columns"> <input type="text" placeholder="Unique ID" name="id" /> @@ -37,10 +37,10 @@ {{ range $assetIDs }} <tr> - <td><a href="{{ AssetURL . }}">{{ . }}</a></td> + <td><a href="{{ $.RootURL.Asset . }}">{{ . }}</a></td> <td> <form - action="{{ AssetURL . }}?method=delete" + action="{{ ($.RootURL.Asset .).MethodDelete }}" method="POST" style="margin-bottom: 0;" > diff --git a/src/http/tpl/post-edit.html b/src/http/tpl/post-edit.html index 28dcd0e..1c40a3a 100644 --- a/src/http/tpl/post-edit.html +++ b/src/http/tpl/post-edit.html @@ -6,17 +6,17 @@ <p> {{ if .Payload.IsDraft }} - <a href="{{ BlogURL "drafts?method=manage" }}"> + <a href="{{ .RootURL.Drafts.MethodManage }}"> Back to Drafts </a> {{ else }} - <a href="{{ BlogURL "posts?method=manage" }}"> + <a href="{{ .RootURL.Posts.MethodManage }}"> Back to Posts </a> {{ end }} </p> -<form method="POST" action="{{ BlogURL "posts/" }}"> +<form method="POST" action="{{ .RootURL.Posts }}"> <table> @@ -36,7 +36,7 @@ {{ $post.ID }} <input name="id" type="hidden" value="{{ $post.ID }}" /> {{ else }} - <a href="{{ PostURL $post.ID }}">{{ $post.ID }}</a> + <a href="{{ .RootURL.Post $post.ID }}">{{ $post.ID }}</a> <input name="id" type="hidden" value="{{ $post.ID }}" /> {{ end }} </td> @@ -135,12 +135,12 @@ <input type="submit" value="Preview" - formaction="{{ BlogURL "posts/" }}{{ $post.ID }}?method=preview" + formaction="{{ (.RootURL.Post $post.ID).MethodPreview }}" formtarget="_blank" /> {{ if .Payload.IsDraft }} - <input type="submit" value="Save" formaction="{{ BlogURL "drafts/" }}" /> + <input type="submit" value="Save" formaction="{{ .RootURL.Drafts }}" /> <script> @@ -154,12 +154,12 @@ <input type="submit" value="Publish" - formaction="{{ BlogURL "posts/" }}" + formaction="{{ .RootURL.Posts }}" onclick="confirmPublish(event)" /> {{ else }} - <input type="submit" value="Update" formaction="{{ BlogURL "posts/" }}" /> + <input type="submit" value="Update" formaction="{{ .RootURL.Posts }}" /> {{ end }} </p> diff --git a/src/http/tpl/post.html b/src/http/tpl/post.html index 46a24fc..1bda8c9 100644 --- a/src/http/tpl/post.html +++ b/src/http/tpl/post.html @@ -27,7 +27,7 @@ This post is part of a series.<br/> {{ if $seriesNextPrev.Next }} - Next: <a href="{{ PostURL $seriesNextPrev.Next.ID }}">{{ $seriesNextPrev.Next.Title }}</a> + Next: <a href="{{ .RootURL.Post $seriesNextPrev.Next.ID }}">{{ $seriesNextPrev.Next.Title }}</a> {{ end }} {{ if and $seriesNextPrev.Next $seriesNextPrev.Previous }} @@ -35,7 +35,7 @@ {{ end }} {{ if $seriesNextPrev.Previous }} - Previously: <a href="{{ PostURL $seriesNextPrev.Previous.ID }}">{{ $seriesNextPrev.Previous.Title }}</a> + Previously: <a href="{{ .RootURL.Post $seriesNextPrev.Previous.ID }}">{{ $seriesNextPrev.Previous.Title }}</a> <br/> {{ end }} diff --git a/src/http/tpl/posts-manage.html b/src/http/tpl/posts-manage.html index f9adbc1..ad9c9d7 100644 --- a/src/http/tpl/posts-manage.html +++ b/src/http/tpl/posts-manage.html @@ -1,6 +1,6 @@ {{ define "body" }} - {{ $page := .GetQueryIntValue "p" 0 -}} + {{ $page := .GetQueryIntValue "page" 0 -}} {{ $getPostsRes := .GetPosts $page 20 -}} <script> @@ -11,14 +11,14 @@ </script> <p> - <a href="{{ BlogURL "admin" }}">Back to Admin</a> + <a href="{{ .RootURL.Path "admin" }}">Back to Admin</a> </p> <h1>Posts</h1> {{ if gt $page 0 }} <p> - <a href="?method=manage&p={{ .Add $page -1 }}">< < Previous Page</a> + <a href="{{ .RootURL.Posts.MethodManage.Page (.Add $page -1) }}">< < Previous Page</a> </p> {{ end }} @@ -33,15 +33,15 @@ {{ range $getPostsRes.Posts }} <tr> <td>{{ .PublishedAt.Local.Format "2006-01-02 15:04:05 MST" }}</td> - <td><a href="{{ PostURL .ID }}">{{ .Title }}</a></td> + <td><a href="{{ $.RootURL.Post .ID }}">{{ .Title }}</a></td> <td> - <a href="{{ PostURL .ID }}?method=edit"> + <a href="{{ ($.RootURL.Post .ID).MethodEdit }}"> Edit </a> </td> <td> <form - action="{{ PostURL .ID }}?method=delete" + action="{{ ($.RootURL.Post .ID).MethodDelete }}" method="POST" > <input @@ -58,7 +58,7 @@ {{ if $getPostsRes.HasMore }} <p> - <a href="?method=manage&p={{ .Add $page 1 }}">Next Page > ></a> + <a href="{{ .RootURL.Posts.MethodManage.Page (.Add $page 1) }}">Next Page > ></a> </p> {{ end }} diff --git a/src/http/tpl/posts.html b/src/http/tpl/posts.html index 2fa336d..0df166a 100644 --- a/src/http/tpl/posts.html +++ b/src/http/tpl/posts.html @@ -1,11 +1,11 @@ {{ define "body" }} - {{ $page := .GetQueryIntValue "p" 0 -}} + {{ $page := .GetQueryIntValue "page" 0 -}} {{ $getPostsRes := .GetPosts $page 20 -}} {{ if gt $page 0 }} <p> - <a href="?p={{ .Add $page -1 }}">< < Previous Page</a> + <a href="{{ .RootURL.Posts.Page (.Add $page -1) }}">< < Previous Page</a> </p> {{ else }} <p> @@ -17,7 +17,7 @@ <ul> {{ range $getPostsRes.Posts }} <li> - <strong><a href="{{ PostURL .ID }}"> + <strong><a href="{{ $.RootURL.Post .ID }}"> {{ .PublishedAt.Format "2006-01-02" }} - {{ .Title }} </a></strong> {{ if .Description }} @@ -29,7 +29,7 @@ {{ if $getPostsRes.HasMore }} <p> - <a href="?p={{ .Add $page 1 }}">Next Page > ></a> + <a href="{{ .RootURL.Posts.Page (.Add $page 1) }}">Next Page > ></a> </p> {{ end }} |