diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/atom.xml | 48 | ||||
-rw-r--r-- | templates/error.templ | 4 | ||||
-rw-r--r-- | templates/feed.xml | 24 | ||||
-rw-r--r-- | templates/homepage.templ | 4 | ||||
-rw-r--r-- | templates/list.templ | 4 | ||||
-rw-r--r-- | templates/page.templ | 19 | ||||
-rw-r--r-- | templates/post.templ | 4 | ||||
-rw-r--r-- | templates/tags.templ | 2 |
8 files changed, 16 insertions, 93 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 c336ea9..369cb83 100644 --- a/templates/error.templ +++ b/templates/error.templ @@ -1,8 +1,8 @@ package templates import ( - "website/internal/config" - "website/internal/http" + "go.alanpearce.eu/website/internal/config" + "go.alanpearce.eu/website/internal/http" "strconv" ) 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 611a8ff..aa61c40 100644 --- a/templates/homepage.templ +++ b/templates/homepage.templ @@ -1,8 +1,8 @@ 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) { diff --git a/templates/list.templ b/templates/list.templ index 94ccf5a..fc59677 100644 --- a/templates/list.templ +++ b/templates/list.templ @@ -1,8 +1,8 @@ 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) { diff --git a/templates/page.templ b/templates/page.templ index 1dbd345..e5cb073 100644 --- a/templates/page.templ +++ b/templates/page.templ @@ -2,9 +2,8 @@ package templates import ( "io/fs" - "net/url" - "website/internal/config" + "go.alanpearce.eu/website/internal/config" ) var ( @@ -71,10 +70,10 @@ templ Page(site *config.Config, page PageSettings) { <footer> Content is <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>. - <a href="https://git.alanpearce.eu/website/">Site source code</a> is + <a href="https://git.alanpearce.eu/go.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,11 +86,7 @@ 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(u config.URL, path string, title string) string { q := u.Query() q.Add("p", path) q.Add("t", title) @@ -100,10 +95,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 c432e57..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 { diff --git a/templates/tags.templ b/templates/tags.templ index 5e9878a..c872a0d 100644 --- a/templates/tags.templ +++ b/templates/tags.templ @@ -1,6 +1,6 @@ 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> |