diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/atom.xml | 48 | ||||
-rw-r--r-- | templates/error.templ | 6 | ||||
-rw-r--r-- | templates/feed.xml | 24 | ||||
-rw-r--r-- | templates/homepage.templ | 6 | ||||
-rw-r--r-- | templates/list.templ | 8 | ||||
-rw-r--r-- | templates/page.templ | 24 | ||||
-rw-r--r-- | templates/post.templ | 6 | ||||
-rw-r--r-- | templates/style.css | 15 | ||||
-rw-r--r-- | templates/tags.templ | 4 |
9 files changed, 31 insertions, 110 deletions
diff --git a/templates/atom.xml b/templates/atom.xml deleted file mode 100644 index 81c9a76..0000000 --- a/templates/atom.xml +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?xml-stylesheet href="/feed-styles.xsl" type="text/xsl"?> -<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ lang }}"> - <title>{{ config.title }} - {%- if term %} - {{ term.name }} - {%- elif section.title %} - {{ section.title }} - {%- endif -%} - </title> - {%- if config.description %} - <subtitle>{{ config.description }}</subtitle> - {%- endif %} - <link href="{{ feed_url | safe }}" rel="self" type="application/atom+xml"/> - <link href=" - {%- if section -%} - {{ section.permalink | escape_xml | safe }} - {%- else -%} - {{ config.base_url | escape_xml | safe }} - {%- endif -%} - "/> - <generator uri="https://www.getzola.org/">Zola</generator> - <updated>{{ last_updated | date(format="%+") }}</updated> - <id>{{ feed_url | safe }}</id> - {%- for page in pages %} - <entry xml:lang="{{ page.lang }}"> - <title>{{ page.title }}</title> - <published>{{ page.date | date(format="%+") }}</published> - <updated>{{ page.updated | default(value=page.date) | date(format="%+") }}</updated> - <author> - <name> - {%- if page.authors -%} - {{ page.authors[0] }} - {%- elif config.author -%} - {{ config.author }} - {%- else -%} - Unknown - {%- endif -%} - </name> - </author> - <link rel="alternate" href="{{ page.permalink | safe }}" type="text/html"/> - <id>{{ page.permalink | safe }}</id> - {% if page.summary %} - <summary type="html">{{ page.summary }}</summary> - {% else %} - <content type="html">{{ page.content }}</content> - {% endif %} - </entry> - {%- endfor %} -</feed> diff --git a/templates/error.templ b/templates/error.templ index 2da7bef..369cb83 100644 --- a/templates/error.templ +++ b/templates/error.templ @@ -1,12 +1,12 @@ package templates import ( - "website/internal/config" - "website/internal/http" + "go.alanpearce.eu/website/internal/config" + "go.alanpearce.eu/website/internal/http" "strconv" ) -templ Error(config config.Config, path string, err *http.Error) { +templ Error(config *config.Config, path string, err *http.Error) { @Page(config, PageSettings{ Title: "Error", Path: path, diff --git a/templates/feed.xml b/templates/feed.xml deleted file mode 100644 index ddc90dd..0000000 --- a/templates/feed.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<?xml-stylesheet href="/feed-styles.xsl" type="text/xsl"?> -<feed xmlns="http://www.w3.org/2005/Atom"> - <title>Example Feed</title> - <link href="http://example.org/"></link> - <id>urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6</id> - <updated>2003-12-13T18:30:02Z</updated> - <entry> - <title>Atom-Powered Robots Run Amok</title> - <link rel="alternate" type="text/html" href="http://example.org/2003/12/13/atom03.html"></link> - <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> - <updated>2003-12-13T18:30:02Z</updated> - <summary>Some text.</summary> - <content type="html"> - <div> - <p>This is the entry content.</p> - </div> - </content> - <author> - <name>John Doe</name> - </author> - </entry> - -</feed> diff --git a/templates/homepage.templ b/templates/homepage.templ index 0afbb2f..aa61c40 100644 --- a/templates/homepage.templ +++ b/templates/homepage.templ @@ -1,11 +1,11 @@ package templates import ( - "website/internal/config" - "website/internal/content" + "go.alanpearce.eu/website/internal/config" + "go.alanpearce.eu/website/internal/content" ) -templ Homepage(config config.Config, posts []content.Post, content string) { +templ Homepage(config *config.Config, posts []content.Post, content string) { @Page(config, PageSettings{ Title: config.Title, TitleAttrs: templ.Attributes{ diff --git a/templates/list.templ b/templates/list.templ index 602c15c..fc59677 100644 --- a/templates/list.templ +++ b/templates/list.templ @@ -1,11 +1,11 @@ package templates import ( - "website/internal/config" - "website/internal/content" + "go.alanpearce.eu/website/internal/config" + "go.alanpearce.eu/website/internal/content" ) -templ TagPage(config config.Config, tag string, posts []content.Post, path string) { +templ TagPage(config *config.Config, tag string, posts []content.Post, path string) { @Page(config, PageSettings{ Title: tag, Path: path, @@ -24,7 +24,7 @@ templ TagPage(config config.Config, tag string, posts []content.Post, path strin } } -templ ListPage(config config.Config, posts []content.Post, path string) { +templ ListPage(config *config.Config, posts []content.Post, path string) { @Page(config, PageSettings{ Title: config.Title, TitleAttrs: templ.Attributes{ diff --git a/templates/page.templ b/templates/page.templ index 7869369..39dd263 100644 --- a/templates/page.templ +++ b/templates/page.templ @@ -2,9 +2,9 @@ package templates import ( "io/fs" - "net/url" - "website/internal/config" + "go.alanpearce.eu/website/internal/config" + "net/url" ) var ( @@ -43,7 +43,7 @@ templ menuItem(item config.MenuItem) { >{ item.Name }</a> } -templ Page(site config.Config, page PageSettings) { +templ Page(site *config.Config, page PageSettings) { <!DOCTYPE html> <html lang={ site.DefaultLanguage }> <head> @@ -74,7 +74,7 @@ templ Page(site config.Config, page PageSettings) { <a href="https://git.alanpearce.eu/website/">Site source code</a> is <a href="https://opensource.org/licenses/MIT">MIT</a> </footer> - @counter(page.Path, page.Title) + @counter(site, page.Path, page.Title) if site.InjectLiveReload { <script defer> new EventSource("/_/reload").onmessage = event => { @@ -87,12 +87,12 @@ templ Page(site config.Config, page PageSettings) { </html> } -func mkURL(path string, title string) string { - u, err := url.Parse("https://alanpearce-eu.goatcounter.com/count") - if err != nil { - panic(err) +func mkURL(original config.URL, path string, title string) string { + ou := *original.URL + u := config.URL{ + URL: &ou, } - q := u.Query() + q := url.Values{} q.Add("p", path) q.Add("t", title) u.RawQuery = q.Encode() @@ -100,10 +100,10 @@ func mkURL(path string, title string) string { return u.String() } -templ counter(path string, title string) { - <script data-goatcounter="https://alanpearce-eu.goatcounter.com/count" async src="https://gc.zgo.at/count.v4.js" crossorigin="anonymous" integrity="sha384-nRw6qfbWyJha9LhsOtSb2YJDyZdKvvCFh0fJYlkquSFjUxp9FVNugbfy8q1jdxI+"></script> +templ counter(config *config.Config, path string, title string) { + <script data-goatcounter={ config.GoatCounter.String() } async src="https://stats.alanpearce.eu/count.v4.js" crossorigin="anonymous" integrity="sha384-nRw6qfbWyJha9LhsOtSb2YJDyZdKvvCFh0fJYlkquSFjUxp9FVNugbfy8q1jdxI+"></script> <noscript> - <img src={ string(templ.URL(mkURL(path, title))) }/> + <img src={ string(templ.URL(mkURL(config.GoatCounter, path, title))) }/> </noscript> } diff --git a/templates/post.templ b/templates/post.templ index 7b82584..9717b4e 100644 --- a/templates/post.templ +++ b/templates/post.templ @@ -2,8 +2,8 @@ package templates import ( "time" - "website/internal/config" - "website/internal/content" + "go.alanpearce.eu/website/internal/config" + "go.alanpearce.eu/website/internal/content" ) func Unsafe(html string) templ.Component { @@ -19,7 +19,7 @@ templ postDate(d time.Time) { </time> } -templ PostPage(config config.Config, post content.Post) { +templ PostPage(config *config.Config, post content.Post) { @Page(config, PageSettings{ Title: post.Title, TitleAttrs: templ.Attributes{ diff --git a/templates/style.css b/templates/style.css index 89fd58f..e9a2955 100644 --- a/templates/style.css +++ b/templates/style.css @@ -11,7 +11,6 @@ --code-background-color: #f2f2f2; --code-color: #222; --blockquote-color: #222; - --icon-external-link: url("/external-link.svg"); } @media (prefers-color-scheme: dark) { @@ -189,13 +188,13 @@ ul.h-feed li a:visited { .tags { font-size: small; -} - -.p-categories, -ul.tags { display: inline-block; padding-inline-start: 0; } +.p-categories { + padding-inline-start: 1ex; +} + .tags li { list-style: none; display: inline-block; @@ -206,9 +205,3 @@ svg.rss-icon { height: 1.5ex; width: 1.5ex; } - -a[target="_blank"]::after { - content: ""; - background: no-repeat var(--icon-external-link); - padding-right: 1em; -} diff --git a/templates/tags.templ b/templates/tags.templ index 7218ca1..c872a0d 100644 --- a/templates/tags.templ +++ b/templates/tags.templ @@ -1,12 +1,12 @@ package templates -import "website/internal/config" +import "go.alanpearce.eu/website/internal/config" templ tagLink(tag string, attrs templ.Attributes) { <a { attrs... } href={ templ.SafeURL("/tags/" + tag) }>#{ tag }</a> } -templ TagsPage(config config.Config, title string, tags []string, path string) { +templ TagsPage(config *config.Config, title string, tags []string, path string) { @Page(config, PageSettings{ Title: title, Path: path, |