aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2024-09-12 00:00:00 +0000
committertdro <tdro@noreply.example.com>2024-09-12 00:00:00 +0000
commitc6a493101c50d4aef277750bdb09db21e2e2f136 (patch)
tree5950bad9ca29b8e3e33fef963bc72e80d446a669
parent2008bf80d18068d4e7cd0585c898df08d54ec3f8 (diff)
downloadcanory-c6a493101c50d4aef277750bdb09db21e2e2f136.tar.gz
canory-c6a493101c50d4aef277750bdb09db21e2e2f136.tar.bz2
canory-c6a493101c50d4aef277750bdb09db21e2e2f136.zip
themes/default: Link parity fixing
-rw-r--r--themes/default/layouts/_default/_markup/render-image.html8
-rw-r--r--themes/default/layouts/_default/_markup/render-link.html13
-rw-r--r--themes/default/layouts/_default/home.archives.html2
-rw-r--r--themes/default/layouts/_default/home.authors.html2
-rw-r--r--themes/default/layouts/_default/home.sources.html2
-rw-r--r--themes/default/layouts/_default/home.xslt.rss.xsl2
-rw-r--r--themes/default/layouts/_default/home.xslt.sitemap.xsl2
-rw-r--r--themes/default/layouts/_default/index.html2
-rw-r--r--themes/default/layouts/_default/rss.xml4
-rw-r--r--themes/default/layouts/_default/section.drafts.html4
-rw-r--r--themes/default/layouts/_default/section.feeds.html4
-rw-r--r--themes/default/layouts/_default/section.following.html4
-rw-r--r--themes/default/layouts/_default/section.html2
-rw-r--r--themes/default/layouts/_default/section.marks.html4
-rw-r--r--themes/default/layouts/_default/section.media.html4
-rw-r--r--themes/default/layouts/_default/single.html8
-rw-r--r--themes/default/layouts/_default/sitemap.xml4
-rw-r--r--themes/default/layouts/_default/taxonomy.html8
-rw-r--r--themes/default/layouts/_default/term.html2
-rw-r--r--themes/default/layouts/partials/author-card.html8
-rw-r--r--themes/default/layouts/partials/author-list.html2
-rw-r--r--themes/default/layouts/partials/author-picture.html4
-rw-r--r--themes/default/layouts/partials/context-profile.html4
-rw-r--r--themes/default/layouts/partials/footer.html3
-rw-r--r--themes/default/layouts/partials/function-generate-feeds.html2
-rw-r--r--themes/default/layouts/partials/head-discovery.html10
-rw-r--r--themes/default/layouts/partials/head-js.html4
-rw-r--r--themes/default/layouts/partials/head-manifest.html2
-rw-r--r--themes/default/layouts/partials/head.html2
-rw-r--r--themes/default/layouts/partials/menu-markdown.html2
-rw-r--r--themes/default/layouts/partials/meta-anchored.html2
-rw-r--r--themes/default/layouts/partials/meta-draft.html2
-rw-r--r--themes/default/layouts/partials/meta-handle.html4
-rw-r--r--themes/default/layouts/partials/meta-name.html2
-rw-r--r--themes/default/layouts/partials/navigator-left.html2
-rw-r--r--themes/default/layouts/partials/navigator-middle.html2
-rw-r--r--themes/default/layouts/partials/navigator.css.html14
-rw-r--r--themes/default/layouts/partials/pagination.html17
-rw-r--r--themes/default/layouts/partials/profile-tabs.html2
-rw-r--r--themes/default/layouts/partials/tags.html20
-rw-r--r--themes/default/layouts/partials/video-container.html6
-rw-r--r--themes/default/layouts/shortcodes/attach.html20
-rw-r--r--themes/default/layouts/shortcodes/attach.rss.xml6
-rw-r--r--themes/default/layouts/shortcodes/markdown.html8
-rw-r--r--themes/default/layouts/shortcodes/markdown.rss.xml13
-rw-r--r--themes/default/layouts/shortcodes/self.html16
-rw-r--r--themes/default/layouts/shortcodes/self.rss.xml6
47 files changed, 156 insertions, 110 deletions
diff --git a/themes/default/layouts/_default/_markup/render-image.html b/themes/default/layouts/_default/_markup/render-image.html
index 57433be..afccc35 100644
--- a/themes/default/layouts/_default/_markup/render-image.html
+++ b/themes/default/layouts/_default/_markup/render-image.html
@@ -1,3 +1,4 @@
+{{- $href := "" -}}
{{- $cache := "" -}}
{{- $width := "" -}}
{{- $height := "" -}}
@@ -15,6 +16,7 @@
{{- $immutable := print ($relURL | humanize | urlize) "-" ($source | sha256 | truncate 8 "") -}}
{{- $storage := print $author "/media/" $immutable -}}
{{- $cached := fileExists (print "public/" $storage ".webp") -}}
+{{- $prurl := eq (findRE `^/\w` $source | len) 0 -}}
{{- $moderns := slice ".webp" ".avif" -}}
{{- $fallbacks := slice ".png" ".jpg" ".gif" ".jpeg" ".svg" ".apng" ".jfif" ".pjpeg" ".pjp" -}}
@@ -78,12 +80,16 @@
{{- $orientation = "portrait" -}}
{{- end -}}
+{{- if (and (strings.HasPrefix $source "/") (not $prurl)) -}}
+ {{- $href = print ("" | relURL) $source -}}
+{{- end -}}
+
{{- with $caption := $.Title -}}
{{- $figcaption = $caption | markdownify -}}
{{ end }}
{{- /* This comment removes trailing newlines and white spaces. */ -}}
<figure>
- <a data-orientation="{{ $orientation }}" href="{{ $source }}">
+ <a data-orientation="{{ $orientation }}" href="{{ or $href $source }}">
<picture>
{{- with $srcset }}
<source
diff --git a/themes/default/layouts/_default/_markup/render-link.html b/themes/default/layouts/_default/_markup/render-link.html
index 874ea15..4caa33c 100644
--- a/themes/default/layouts/_default/_markup/render-link.html
+++ b/themes/default/layouts/_default/_markup/render-link.html
@@ -9,16 +9,23 @@
{{- $remote := not $local -}}
{{- if $remote -}}
- {{- $rel ="noopener no-referrer" -}}
+ {{- $rel = "noopener no-referrer" -}}
{{- else -}}
- {{- $type ="internal" -}}
+ {{- $type = "internal" -}}
{{- end -}}
{{- if and $local $target.Path -}}
{{- with .Page.GetPage (strings.TrimRight "/" $target.Path) -}}
{{- with $target.Fragment -}} {{- $fragment = printf "#%s" . -}} {{- end -}}
{{- $link = printf "%s%s" .Permalink $fragment -}}
- {{- else -}} {{- $type ="broken" -}} {{- end -}}
+ {{- else -}}
+ {{- $type = "broken" -}}
+ {{- if $feed := not (strings.HasPrefix $link "/") -}}
+ {{- $link = .Destination | absURL -}}
+ {{- else -}}
+ {{- $link = strings.TrimLeft "/" .Destination | relURL -}}
+ {{- end -}}
+ {{- end -}}
{{- end -}}
<a
diff --git a/themes/default/layouts/_default/home.archives.html b/themes/default/layouts/_default/home.archives.html
index f443583..a486e10 100644
--- a/themes/default/layouts/_default/home.archives.html
+++ b/themes/default/layouts/_default/home.archives.html
@@ -15,7 +15,7 @@
"Title" "Archives"
"Icon" "arrow-left"
"Subtitle" (print (partial "count.html" .) " " "Total")
- "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | absURL)) "/")
+ "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | relURL)) ("" | relURL))
)
-}}
{{- end -}}
diff --git a/themes/default/layouts/_default/home.authors.html b/themes/default/layouts/_default/home.authors.html
index 5bb609a..fc8dfa6 100644
--- a/themes/default/layouts/_default/home.authors.html
+++ b/themes/default/layouts/_default/home.authors.html
@@ -13,7 +13,7 @@
"Subtitle" (print (partial "count-authors.html" .) " " "Total")
"Icon" "arrow-left"
"IconLabel" "Back"
- "Href" "/"
+ "Href" ("" | relURL)
"Id" "back"
"Context" .
)
diff --git a/themes/default/layouts/_default/home.sources.html b/themes/default/layouts/_default/home.sources.html
index 32f7822..dd3d348 100644
--- a/themes/default/layouts/_default/home.sources.html
+++ b/themes/default/layouts/_default/home.sources.html
@@ -27,7 +27,7 @@
"Subtitle" (print $fileCount " " "Total")
"Icon" "arrow-left"
"IconLabel" "Back"
- "Href" "/"
+ "Href" ("" | relURL)
"Id" "back"
"Context" .
)
diff --git a/themes/default/layouts/_default/home.xslt.rss.xsl b/themes/default/layouts/_default/home.xslt.rss.xsl
index 587d119..2eeabab 100644
--- a/themes/default/layouts/_default/home.xslt.rss.xsl
+++ b/themes/default/layouts/_default/home.xslt.rss.xsl
@@ -55,7 +55,7 @@
{{ range .Site.Menus.main }}
<icon-navigator hidden="">
<icon-button>
- <a id="nav-middle-{{ path.Base .Identifier }}" href="{{ .URL | absURL }}">
+ <a id="nav-middle-{{ path.Base .Identifier }}" href="{{ .URL | relURL }}">
{{ with .Identifier }}
{{ $icon := print (partial "function-paths.html").static "/icons/" . ".svg" }}
{{ safeHTML (readFile $icon) }}
diff --git a/themes/default/layouts/_default/home.xslt.sitemap.xsl b/themes/default/layouts/_default/home.xslt.sitemap.xsl
index e0be723..e2daf01 100644
--- a/themes/default/layouts/_default/home.xslt.sitemap.xsl
+++ b/themes/default/layouts/_default/home.xslt.sitemap.xsl
@@ -34,7 +34,7 @@
<icon-button>
<a
id="nav-middle-{{ path.Base .Identifier }}"
- href="{{ .URL | absURL }}"
+ href="{{ .URL | relURL }}"
>
{{ with .Identifier }}
{{ $icon := print (partial "function-paths.html").static "/icons/" . ".svg" }}
diff --git a/themes/default/layouts/_default/index.html b/themes/default/layouts/_default/index.html
index f25cabf..2462580 100644
--- a/themes/default/layouts/_default/index.html
+++ b/themes/default/layouts/_default/index.html
@@ -13,7 +13,7 @@
"IconLabel" (and (gt .Paginator.PageNumber 1) "Back")
"Id" (and (gt .Paginator.PageNumber 1) "back")
"Icon" (and (gt .Paginator.PageNumber 1) "arrow-left")
- "Href" (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | absURL))
+ "Href" (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | relURL))
)
-}}
{{- end -}}
diff --git a/themes/default/layouts/_default/rss.xml b/themes/default/layouts/_default/rss.xml
index 16aee5f..8910f65 100644
--- a/themes/default/layouts/_default/rss.xml
+++ b/themes/default/layouts/_default/rss.xml
@@ -48,8 +48,10 @@
{{- $filteredPages := partial "function-filters-content.html" .Paginator.Pages -}}
+{{- $xsl := replace (print ("" | relURL) "/rss.xsl") "//" "/" -}}
+
{{- printf `<?xml version="1.0" encoding="utf-8" standalone="yes"?>` | safeHTML }}
-{{ printf `<?xml-stylesheet href="/rss.xsl" type="text/xsl"?>` | safeHTML }}
+{{ printf `<?xml-stylesheet href=%q type="text/xsl"?>` $xsl | safeHTML }}
<rss
version="2.0"
diff --git a/themes/default/layouts/_default/section.drafts.html b/themes/default/layouts/_default/section.drafts.html
index bb7485c..6204bcf 100644
--- a/themes/default/layouts/_default/section.drafts.html
+++ b/themes/default/layouts/_default/section.drafts.html
@@ -4,7 +4,7 @@
<style>
{{ partial "navigator.css.html" (dict "Link" "/") | safeCSS }}
- tab-bar a[href^="{{ "" | absURL }}/{{ $author }}/drafts"] {
+ tab-bar a[href*="{{ $author | relURL }}/drafts"] {
color: #111;
color: var(--foreground);
font-weight: 700;
@@ -31,7 +31,7 @@
"Title" "Drafts"
"Icon" "arrow-left"
"Subtitle" (print (partial "count-drafts.html" .) " " "Total")
- "Href" (or (and (gt $paginator.PageNumber 1) ($paginator.Paginator.Prev.URL | absURL)) "/")
+ "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | relURL)) ("" | relURL))
)
-}}
diff --git a/themes/default/layouts/_default/section.feeds.html b/themes/default/layouts/_default/section.feeds.html
index e239928..2f391d8 100644
--- a/themes/default/layouts/_default/section.feeds.html
+++ b/themes/default/layouts/_default/section.feeds.html
@@ -4,7 +4,7 @@
<style>
{{ partial "navigator.css.html" (dict "Link" "/") | safeCSS }}
- tab-bar a[href^="{{ "" | absURL }}/{{ $author }}/feeds"] {
+ tab-bar a[href*="{{ $author | relURL }}/feeds"] {
color: #111;
color: var(--foreground);
font-weight: 700;
@@ -25,7 +25,7 @@
"Title" "Feeds"
"Icon" "arrow-left"
"Subtitle" (print (partial "count-feeds.html" .) " " "Total")
- "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | absURL)) "/")
+ "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | relURL)) ("" | relURL))
)
-}}
diff --git a/themes/default/layouts/_default/section.following.html b/themes/default/layouts/_default/section.following.html
index 25eadc3..e8bf821 100644
--- a/themes/default/layouts/_default/section.following.html
+++ b/themes/default/layouts/_default/section.following.html
@@ -22,7 +22,7 @@
{{- range $distinct := first 1 (where $feeds "FeedSourceLink" "eq" $source) -}}
{{- $href := or $distinct.FeedHome (print "http://" $distinct.FeedSourceDomain) -}}
- {{- $favicon := print "/" (partial "function-paths.html").media "/favicon." (.FeedSourceLink | anchorize) ".png" -}}
+ {{- $favicon := print (partial "function-paths.html").media "/favicon." (.FeedSourceLink | anchorize) ".png" -}}
<micro-author>
<micro-card>
@@ -37,7 +37,7 @@
width="64"
height="64"
alt="{{ $distinct.FeedName }}"
- src="{{ $.Site.BaseURL }}{{ $favicon }}"
+ src="{{ $favicon | relURL }}"
/>
</picture>
{{- else -}}
diff --git a/themes/default/layouts/_default/section.html b/themes/default/layouts/_default/section.html
index 901ca1f..89c669e 100644
--- a/themes/default/layouts/_default/section.html
+++ b/themes/default/layouts/_default/section.html
@@ -26,8 +26,8 @@
"Id" "back"
"Title" $author.name
"Icon" "arrow-left"
- "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | absURL)) "/")
"Subtitle" (print (lang.FormatNumberCustom 0 .Paginator.TotalNumberOfElements) " " "Total")
+ "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | relURL)) ("" | relURL))
)
-}}
diff --git a/themes/default/layouts/_default/section.marks.html b/themes/default/layouts/_default/section.marks.html
index def6c94..bc35c50 100644
--- a/themes/default/layouts/_default/section.marks.html
+++ b/themes/default/layouts/_default/section.marks.html
@@ -4,7 +4,7 @@
<style>
{{ partial "navigator.css.html" (dict "Link" "/") | safeCSS }}
- tab-bar a[href^="{{ "" | absURL }}/{{ $author }}/marks"] {
+ tab-bar a[href*="{{ $author | relURL }}/marks"] {
color: #111;
color: var(--foreground);
font-weight: 700;
@@ -31,7 +31,7 @@
"Title" "Marks"
"Icon" "arrow-left"
"Subtitle" (print (partial "count-marks.html" .) " " "Total")
- "Href" (or (and (gt $paginator.PageNumber 1) ($paginator.Prev.URL | absURL)) "/")
+ "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | relURL)) ("" | relURL))
)
-}}
diff --git a/themes/default/layouts/_default/section.media.html b/themes/default/layouts/_default/section.media.html
index ce570c7..4fc82fb 100644
--- a/themes/default/layouts/_default/section.media.html
+++ b/themes/default/layouts/_default/section.media.html
@@ -4,7 +4,7 @@
<style>
{{ partial "navigator.css.html" (dict "Link" "/") | safeCSS }}
- tab-bar a[href^="{{ "" | absURL }}/{{ $author }}/media"] {
+ tab-bar a[href*="{{ $author | relURL }}/media"] {
color: #111;
color: var(--foreground);
font-weight: 700;
@@ -23,7 +23,7 @@
"Subtitle" (print (partial "count-media.html" .) " " "Total")
"Icon" "arrow-left"
"IconLabel" "Back"
- "Href" "/"
+ "Href" ("" | relURL)
"Id" "back"
"Context" .
)
diff --git a/themes/default/layouts/_default/single.html b/themes/default/layouts/_default/single.html
index f3123b3..676c288 100644
--- a/themes/default/layouts/_default/single.html
+++ b/themes/default/layouts/_default/single.html
@@ -11,7 +11,7 @@
"Subtitle" "Thread"
"Icon" "arrow-left"
"IconLabel" "Back"
- "Href" "/"
+ "Href" ("" | relURL)
"Id" "back"
"Context" .
)
@@ -22,8 +22,8 @@
<micro-thread>
{{- partial "render-embed.html" . -}}
- {{- $prevHref := "/" -}}
- {{- $nextHref := "/" -}}
+ {{- $prevHref := "" | relURL -}}
+ {{- $nextHref := "" | relURL -}}
{{- $prevTitle := "hidden" -}}
{{- $nextTitle := "hidden" -}}
@@ -61,7 +61,7 @@
Related Tags
{{- with $.Params.tags -}}
{{- range $tag := first 1 $.Params.tags -}}
- {{- $link := print ("tags/" | relURL) ($tag | urlize) "/" }}
+ {{- $link := print ("tags/" | absURL) ($tag | urlize) "/" }}
{{ print "---" " " "[#" $tag "](" $link ")" | markdownify -}}
{{- end -}}
{{- end -}}
diff --git a/themes/default/layouts/_default/sitemap.xml b/themes/default/layouts/_default/sitemap.xml
index f8ab315..3afd95c 100644
--- a/themes/default/layouts/_default/sitemap.xml
+++ b/themes/default/layouts/_default/sitemap.xml
@@ -1,5 +1,7 @@
+{{- $xsl := replace (print ("" | relURL) "/sitemap.xsl") "//" "/" -}}
+
{{- printf `<?xml version="1.0" encoding="utf-8" standalone="yes"?>` | safeHTML }}
-{{ printf `<?xml-stylesheet href="/sitemap.xsl" type="text/xsl"?>` | safeHTML }}
+{{ printf `<?xml-stylesheet href=%q type="text/xsl"?>` $xsl | safeHTML }}
{{- $changefreq := "weekly" -}}
{{- $priority := 0.5 -}}
diff --git a/themes/default/layouts/_default/taxonomy.html b/themes/default/layouts/_default/taxonomy.html
index 5c8e2ba..c13db6b 100644
--- a/themes/default/layouts/_default/taxonomy.html
+++ b/themes/default/layouts/_default/taxonomy.html
@@ -13,7 +13,7 @@
"Title" "Tags"
"Icon" "arrow-left"
"Subtitle" (print (partial "count-tags.html" .) " " "Total")
- "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | absURL)) "/")
+ "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | relURL)) ("" | relURL))
)
-}}
{{- end -}}
@@ -31,13 +31,13 @@
<h2>
<code>
{{ $count }} in
- <a data-hover href="{{ "" | absURL }}/tags/{{ $title }}/">
+ <a data-hover="" href="{{ "tags" | relURL }}/{{ $title }}/">
#{{ $title }}
</a>
</code>
</h2>
<figure>
- <a href="{{ print ("" | absURL) "/tags/" $title "/#" (partial "card-id.html" .) }}">
+ <a href="{{ print "tags/" $title "/#" (partial "card-id.html" .) | relURL }}">
<picture>
{{ partial "author-picture" . }}
</picture>
@@ -50,7 +50,7 @@
{{ .Date | time.Format "02 Jan 2006" }}
</time>
<p>
- <a data-hover href="{{ print ("" | absURL) "/tags/" $title "/#" (partial "card-id.html" .) }}">
+ <a data-hover="" href="{{ print "tags/" $title "/#" (partial "card-id.html" .) | relURL }}">
{{ partial "meta-title.html" . }}
</a>
</p>
diff --git a/themes/default/layouts/_default/term.html b/themes/default/layouts/_default/term.html
index 4f0d92a..90ba0a1 100644
--- a/themes/default/layouts/_default/term.html
+++ b/themes/default/layouts/_default/term.html
@@ -13,7 +13,7 @@
"Icon" "arrow-left"
"Title" (print "#" .Title)
"Subtitle" (print (lang.FormatNumberCustom 0 (len .Data.Pages)) " " "Total")
- "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | absURL)) "/")
+ "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | relURL)) ("" | relURL))
)
-}}
{{- end -}}
diff --git a/themes/default/layouts/partials/author-card.html b/themes/default/layouts/partials/author-card.html
index 80a1629..6f15ff3 100644
--- a/themes/default/layouts/partials/author-card.html
+++ b/themes/default/layouts/partials/author-card.html
@@ -39,15 +39,15 @@
<micro-card>
<header>
<figure>
- <a title="{{ .Data.name }}" href="{{ "" | absURL }}/{{ .Data.user }}/">
+ <a title="{{ .Data.name }}" href="{{ .Data.user | relURL }}/">
<picture>
{{- with $sourceset -}}
- <source srcset="{{ print ("" | absURL) $sourceset }}" type="image/webp" />
+ <source srcset="{{ strings.TrimPrefix "/" $sourceset | relURL }}" type="image/webp" />
{{- end -}}
<img
width="{{ or $width "64" }}"
height="{{ or $height "64" }}"
- src="{{ print ("" | absURL) $source }}"
+ src="{{ strings.TrimPrefix "/" $source | relURL }}"
alt="{{ $alternate }}"
/>
</picture>
@@ -72,7 +72,7 @@
</time>
</article>
<p>{{ .Data.description | markdownify | plainify | htmlUnescape | truncate 60 "..." }}</p>
- <a title="Follow with RSS Reader" href="{{ "" | absURL }}/{{ .Data.user }}/rss.xml">
+ <a title="Follow with RSS Reader" href="{{ .Data.user | relURL }}/rss.xml">
{{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/tabler/rss.svg")) }}
<span>Feed</span>
</a>
diff --git a/themes/default/layouts/partials/author-list.html b/themes/default/layouts/partials/author-list.html
index 619b1b3..31724e2 100644
--- a/themes/default/layouts/partials/author-list.html
+++ b/themes/default/layouts/partials/author-list.html
@@ -2,7 +2,7 @@
<author-list>
<h1>
- <a data-hover href="{{ "" | absURL }}/authors/">
+ <a data-hover="" href="{{ "authors" | relURL }}/">
Authors
</a>
</h1>
diff --git a/themes/default/layouts/partials/author-picture.html b/themes/default/layouts/partials/author-picture.html
index 01786e7..ac9212b 100644
--- a/themes/default/layouts/partials/author-picture.html
+++ b/themes/default/layouts/partials/author-picture.html
@@ -37,13 +37,13 @@
{{- end -}}
{{- with $sourceset -}}
-<source srcset="{{ print ("" | absURL) $sourceset }}" type="image/webp" />
+<source srcset="{{ strings.TrimPrefix "/" $sourceset | relURL }}" type="image/webp" />
{{- end -}}
<img
width="{{ $width }}"
height="{{ $height }}"
- src="{{ print ("" | absURL) $source }}"
+ src="{{ strings.TrimPrefix "/" $source | relURL }}"
alt="{{ $alternate }}"
/>
{{- /* This comment removes trailing newlines and white spaces. */ -}}
diff --git a/themes/default/layouts/partials/context-profile.html b/themes/default/layouts/partials/context-profile.html
index 5150128..d44b902 100644
--- a/themes/default/layouts/partials/context-profile.html
+++ b/themes/default/layouts/partials/context-profile.html
@@ -1,9 +1,9 @@
{{- $author := partial "function-authors-data.html" . -}}
{{- $description := or .Params.feed.description ($author.description | markdownify) -}}
{{- $name := or .Params.feed.name $author.name -}}
-{{- $host := or (urls.Parse .Site.BaseURL).Host "localhost" -}}
+{{- $host := or (urls.Parse $.Site.BaseURL).Host "localhost" -}}
{{- $author := .Section -}}
-{{- $href := print ("" | absURL) "/" $author "/" -}}
+{{- $href := print ($author | relURL) "/" -}}
{{- $title := print $author "@" $host -}}
{{- with .Params.feed -}}
diff --git a/themes/default/layouts/partials/footer.html b/themes/default/layouts/partials/footer.html
index 7ba8d8d..9007d3c 100644
--- a/themes/default/layouts/partials/footer.html
+++ b/themes/default/layouts/partials/footer.html
@@ -10,7 +10,8 @@
{{- else -}}
{{ or $author.footer $author.title | markdownify }} &middot;
{{- end }}
- <a href="/sitemap.xml" >Site Map</a>
+
+ {{ print "[Site Map](/sitemap.xml)" | markdownify }}
<cite>
Content not originating from this domain <br />
diff --git a/themes/default/layouts/partials/function-generate-feeds.html b/themes/default/layouts/partials/function-generate-feeds.html
index edd6e23..53004b4 100644
--- a/themes/default/layouts/partials/function-generate-feeds.html
+++ b/themes/default/layouts/partials/function-generate-feeds.html
@@ -232,7 +232,7 @@
"description" (or .FeedSourceDescription .FeedSourceTitle "No source description found.")
"domain" .FeedSourceDomain
"enclosure" .FeedEnclosure
- "favicon" (strings.TrimPrefix ("" | absURL) $imageSource.Permalink)
+ "favicon" (strings.TrimPrefix $.Site.BaseURL $imageSource.Permalink)
"home" .FeedSourceHome
"link" .FeedLink
"name" .FeedName
diff --git a/themes/default/layouts/partials/head-discovery.html b/themes/default/layouts/partials/head-discovery.html
index 8c7272f..31272e5 100644
--- a/themes/default/layouts/partials/head-discovery.html
+++ b/themes/default/layouts/partials/head-discovery.html
@@ -5,7 +5,7 @@
rel="alternate"
type="application/rss+xml"
title="{{ $.Site.Title }} Feed"
- href="{{ "" | absURL }}/rss.xml"
+ href="{{ "rss.xml" | relURL }}"
/>
{{- range $author := $.Site.Sections }}
@@ -13,7 +13,7 @@
rel="alternate"
type="application/rss+xml"
title="{{ $author.Page.Type }}'s Feed"
- href="{{ print $author.Permalink "rss.xml" | absURL }}"
+ href="{{ print $author.RelPermalink "rss.xml" }}"
/>
{{ end }}
{{- end -}}
@@ -23,7 +23,7 @@
rel="alternate"
type="application/rss+xml"
title="{{ $author.name }}'s Feed"
- href="{{ print ("" | absURL) "/" $.Section }}/rss.xml"
+ href="{{ $.Section | relURL }}/rss.xml"
/>
{{- with $author.feeds.rss }}
@@ -48,7 +48,7 @@
rel="alternate"
type="application/rss+xml"
title="{{ $.Title }} Feed"
- href="{{ $.Permalink }}rss.xml"
+ href="{{ $.RelPermalink }}rss.xml"
/>
{{- end -}}
@@ -57,6 +57,6 @@
rel="alternate"
type="application/rss+xml"
title="#{{ lower $.Title }} Tag Feed"
- href="{{ $.Permalink }}rss.xml"
+ href="{{ $.RelPermalink }}rss.xml"
/>
{{- end }}
diff --git a/themes/default/layouts/partials/head-js.html b/themes/default/layouts/partials/head-js.html
index a491eee..2216993 100644
--- a/themes/default/layouts/partials/head-js.html
+++ b/themes/default/layouts/partials/head-js.html
@@ -2,7 +2,7 @@
{{- $js := $index | resources.Minify | fingerprint -}}
{{ if .Site.Params.site.production }}
-<script src="{{ $js.Permalink }}"></script>
+<script src="{{ $js.RelPermalink }}"></script>
{{ else }}
-<script src="{{ $index.Permalink }}"></script>
+<script src="{{ $index.RelPermalink }}"></script>
{{ end }}
diff --git a/themes/default/layouts/partials/head-manifest.html b/themes/default/layouts/partials/head-manifest.html
index 6d01c32..c8f504a 100644
--- a/themes/default/layouts/partials/head-manifest.html
+++ b/themes/default/layouts/partials/head-manifest.html
@@ -1,5 +1,5 @@
{{- $author := .Section -}}
-{{- $home := or ("" | absURL) "/" -}}
+{{- $home := or print ("" | absURL) "/" -}}
{{- $kind := in (slice "home" "taxonomy" "term") .Page.Kind -}}
{{- $logo := .Site.Params.webmanifest.logo -}}
{{- $profile := print "public/data/media/" $author "/" $author "-profile" -}}
diff --git a/themes/default/layouts/partials/head.html b/themes/default/layouts/partials/head.html
index 1668d57..89ab3c0 100644
--- a/themes/default/layouts/partials/head.html
+++ b/themes/default/layouts/partials/head.html
@@ -40,7 +40,7 @@
<meta name="twitter:image" content="{{ $image }}" />
<!-- Extra Meta Tags -->
-<meta name='base-url' content="{{ "" | absURL }}" />
+<meta name='base-url' content="{{ "" | relURL }}" />
<meta name='last-modified' content="{{ now.UTC.Format "Mon, 02 Jan 2006 15:04:05 GMT" }}" />
<!-- Search Verification -->
diff --git a/themes/default/layouts/partials/menu-markdown.html b/themes/default/layouts/partials/menu-markdown.html
index 6e54238..4d8016d 100644
--- a/themes/default/layouts/partials/menu-markdown.html
+++ b/themes/default/layouts/partials/menu-markdown.html
@@ -1,7 +1,7 @@
{{- if not .ExpiryDate -}}
{{- $relURL := strings.TrimPrefix .Page.Site.BaseURL .Page.Permalink -}}
{{- $source := print (path.Dir $relURL) ".md" -}}
- {{- $href := print .Site.BaseURL "/" (partial "function-paths.html").markdown $source -}}
+ {{- $href := print (partial "function-paths.html").markdown $source | relURL -}}
{{- $title := .File.LogicalName -}}
<meta-source>
diff --git a/themes/default/layouts/partials/meta-anchored.html b/themes/default/layouts/partials/meta-anchored.html
index 872f98e..670a6c2 100644
--- a/themes/default/layouts/partials/meta-anchored.html
+++ b/themes/default/layouts/partials/meta-anchored.html
@@ -12,7 +12,7 @@
{{- if .Params.Marked -}}
<a
- href="{{ "" | absURL }}/{{ $author }}/marks/#marks"
+ href="{{ $author | relURL }}/marks/#marks"
data-anchored="marked"
data-hover=""
>
diff --git a/themes/default/layouts/partials/meta-draft.html b/themes/default/layouts/partials/meta-draft.html
index d441b9a..7700dc8 100644
--- a/themes/default/layouts/partials/meta-draft.html
+++ b/themes/default/layouts/partials/meta-draft.html
@@ -3,7 +3,7 @@
{{- /* This comment removes trailing newlines and white spaces. */ -}}
<em>
{{- /* This comment removes trailing newlines and white spaces. */ -}}
- <a href="{{ .Site.BaseURL }}/{{ .Type }}/drafts/#drafts">
+ <a href="{{ .Type | relURL }}/drafts/#drafts">
{{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/edit.svg")) -}}
<span>Draft</span>
{{- /* This comment removes trailing newlines and white spaces. */ -}}
diff --git a/themes/default/layouts/partials/meta-handle.html b/themes/default/layouts/partials/meta-handle.html
index ee0cc50..a353aa2 100644
--- a/themes/default/layouts/partials/meta-handle.html
+++ b/themes/default/layouts/partials/meta-handle.html
@@ -1,7 +1,7 @@
{{- $author := .Section -}}
-{{- $host := or (urls.Parse ("" | absURL)).Host "localhost" -}}
-{{- $href := print ("" | absURL) "/" $author "/" -}}
+{{- $host := or (urls.Parse $.Site.BaseURL).Host "localhost" -}}
+{{- $href := print ($author | relURL) "/" -}}
{{- $title := print $author "@" $host -}}
diff --git a/themes/default/layouts/partials/meta-name.html b/themes/default/layouts/partials/meta-name.html
index 7c2ca61..52dff9d 100644
--- a/themes/default/layouts/partials/meta-name.html
+++ b/themes/default/layouts/partials/meta-name.html
@@ -1,6 +1,6 @@
{{- $author := partial "function-authors-data.html" . -}}
-{{- $href := print ("" | absURL) "/" $author.user "/" -}}
+{{- $href := print ($author.user | relURL) "/" -}}
{{- $name := $author.name -}}
{{- $title := $name -}}
diff --git a/themes/default/layouts/partials/navigator-left.html b/themes/default/layouts/partials/navigator-left.html
index 1a3bd1d..9dc7188 100644
--- a/themes/default/layouts/partials/navigator-left.html
+++ b/themes/default/layouts/partials/navigator-left.html
@@ -3,7 +3,7 @@
<ul>
{{ range .Site.Menus.main }}
<li>
- <a id="nav-left-{{ path.Base .Identifier }}" href="{{ .URL | absURL }}">
+ <a id="nav-left-{{ path.Base .Identifier }}" href="{{ .URL | relURL }}">
<span>{{ .Name }}</span>
{{ with .Identifier }}
{{ $icon := print (partial "function-paths.html").static "/icons/" . ".svg" }}
diff --git a/themes/default/layouts/partials/navigator-middle.html b/themes/default/layouts/partials/navigator-middle.html
index 7259b43..b788533 100644
--- a/themes/default/layouts/partials/navigator-middle.html
+++ b/themes/default/layouts/partials/navigator-middle.html
@@ -40,7 +40,7 @@
{{ range .Context.Site.Menus.main }}
<icon-navigator hidden="">
<icon-button>
- <a id="nav-middle-{{ path.Base .Identifier }}" href="{{ .URL | absURL }}">
+ <a id="nav-middle-{{ path.Base .Identifier }}" href="{{ .URL | relURL }}">
{{ with .Identifier }}
{{ $icon := print (partial "function-paths.html").static "/icons/" . ".svg" }}
{{ safeHTML (readFile $icon) }}
diff --git a/themes/default/layouts/partials/navigator.css.html b/themes/default/layouts/partials/navigator.css.html
index 7485408..14658e1 100644
--- a/themes/default/layouts/partials/navigator.css.html
+++ b/themes/default/layouts/partials/navigator.css.html
@@ -1,19 +1,23 @@
-icon-navigator a[href="{{ "" | absURL }}{{ .Link }}"],
-column-base[position="left"] nav a[href="{{ "" | absURL }}{{ .Link }}"] {
+{{- $href := print ("" | relURL) .Link -}}
+
+{{- $href = replace $href "//" "/" -}}
+
+icon-navigator a[href="{{ $href }}"],
+column-base[position="left"] nav a[href="{{ $href }}"] {
font-weight: 700;
}
-column-base[position="left"] nav a[href="{{ "" | absURL }}{{ .Link }}"] {
+column-base[position="left"] nav a[href="{{ $href }}"] {
background-color: #f0f6ff;
background-color: var(--hover-background-alternate);
}
-icon-navigator a[href="{{ "" | absURL }}{{ .Link }}"] svg {
+icon-navigator a[href="{{ $href }}"] svg {
fill: #cce0ff;
fill: var(--icon-hover-background);
}
-icon-navigator a[href="{{ "" | absURL }}{{ .Link }}"]:focus svg {
+icon-navigator a[href="{{ $href }}"]:focus svg {
fill: #cce0ff;
fill: var(--icon-focus-background);
}
diff --git a/themes/default/layouts/partials/pagination.html b/themes/default/layouts/partials/pagination.html
index e64bfcf..524a383 100644
--- a/themes/default/layouts/partials/pagination.html
+++ b/themes/default/layouts/partials/pagination.html
@@ -3,28 +3,29 @@
{{- $prevTitle := "hidden" -}}
{{- $nextTitle := "hidden" -}}
{{- $lastTitle := "hidden" -}}
- {{- $firstHref := "/" -}}
- {{- $prevHref := "/" -}}
- {{- $nextHref := "/" -}}
- {{- $lastHref := "/" -}}
+
+ {{- $firstHref := "" | relURL -}}
+ {{- $prevHref := "" | relURL -}}
+ {{- $nextHref := "" | relURL -}}
+ {{- $lastHref := "" | relURL -}}
{{- if and .HasPrev .First -}}
- {{- $firstHref = .First.URL | absURL -}}
+ {{- $firstHref = .First.URL | relURL -}}
{{- $firstTitle = "Newest" -}}
{{- end -}}
{{- with .Prev -}}
- {{- $prevHref = .URL | absURL -}}
+ {{- $prevHref = .URL | relURL -}}
{{- $prevTitle = "Newer" -}}
{{- end -}}
{{- if .Next -}}
- {{- $nextHref = .Next.URL | absURL -}}
+ {{- $nextHref = .Next.URL | relURL -}}
{{- $nextTitle = "Older" -}}
{{- end -}}
{{- if and .HasNext .Last -}}
- {{- $lastHref = .Last.URL | absURL -}}
+ {{- $lastHref = .Last.URL | relURL -}}
{{- $lastTitle = "Oldest" -}}
{{- end -}}
diff --git a/themes/default/layouts/partials/profile-tabs.html b/themes/default/layouts/partials/profile-tabs.html
index 1ca632b..3cdf15a 100644
--- a/themes/default/layouts/partials/profile-tabs.html
+++ b/themes/default/layouts/partials/profile-tabs.html
@@ -1,5 +1,5 @@
{{- $author := partial "function-authors-data.html" . -}}
-{{- $path := print ("" | absURL) "/" $author.user -}}
+{{- $path := $author.user | relURL -}}
<tab-bar>
<nav>
diff --git a/themes/default/layouts/partials/tags.html b/themes/default/layouts/partials/tags.html
index 29202d0..079b5b3 100644
--- a/themes/default/layouts/partials/tags.html
+++ b/themes/default/layouts/partials/tags.html
@@ -1,19 +1,21 @@
-{{- $format := .Format -}}
+{{- $format := .Format -}}
{{- $pageContext := .Context -}}
-{{- $path := "tags/" -}}
-{{- $url := $path | relURL -}}
+{{- $path := "tags/" -}}
+{{- $url := $path | absURL -}}
{{- with $pageContext.Params.tags -}}
{{- range $tags, $tag := sort $pageContext.Params.tags -}}
- {{- if (eq $format "rss") -}}
- {{- $url = $path | absURL -}}
- {{- end -}}
-
{{- $link := print $url ((lower $tag) | urlize) "/" -}}
{{- print "[#" (lower $tag) "](" $link ")" | markdownify -}}
-
{{- if (eq $format "rss") -}}&nbsp;{{- end }}
{{ end -}}
{{- else -}}
- <a href="{{ "tags/" | absURL }}">#untagged</a>
+
+ {{- if (eq $format "rss") -}}
+ {{- $path = "/tags" -}}
+ {{- else }}
+ {{- $path = "tags" -}}
+ {{- end }}
+
+ <a href="{{ $path | relURL }}/">#untagged</a>
{{- end -}}
diff --git a/themes/default/layouts/partials/video-container.html b/themes/default/layouts/partials/video-container.html
index 9e28e3d..856c8eb 100644
--- a/themes/default/layouts/partials/video-container.html
+++ b/themes/default/layouts/partials/video-container.html
@@ -37,11 +37,11 @@
{{- end -}}
{{- else -}}
{{- with $cache = resources.Get (path.Join "public/" $storage) -}}
- {{- $cache = print ("" | absURL) (strings.TrimLeft "public" $cache) -}}
+ {{- $cache = (strings.TrimPrefix "public/" $cache) -}}
{{- end -}}
{{- end -}}
-{{- $source = $cache -}}
+{{- $source = $cache | relURL -}}
{{- if .Remote -}}
{{- $source = .Source -}}
@@ -69,7 +69,7 @@
<footer>
{{ $caption | markdownify }}
<br />
- Index: {{ with $cache }} {{ print "[Cache](" . ")" | markdownify }} &middot; {{ end }}
+ Index: {{ with $cache = print "/" $cache }} {{ print "[Cache](" $cache ")" | markdownify }} &middot; {{ end }}
{{ print "[Source](" .Source ")" | markdownify }}
</footer>
</video-container>
diff --git a/themes/default/layouts/shortcodes/attach.html b/themes/default/layouts/shortcodes/attach.html
index 7f4c672..6044402 100644
--- a/themes/default/layouts/shortcodes/attach.html
+++ b/themes/default/layouts/shortcodes/attach.html
@@ -1,7 +1,7 @@
-{{- $url := default "/canory/media/2city12p.pdf" (.Get "url" | default (.Get 0)) -}}
-{{- $title := default "Attachment" (.Get "title" | default (.Get 1)) -}}
-{{- $caption := default $title (.Get "caption" | default (.Get 2)) -}}
-{{- $remote := default "" (.Get "remote" | default (.Get 3)) -}}
+{{- $url := default "/canory/media/2city12p.pdf" (.Get "url" | default (.Get 0)) -}}
+{{- $title := default "Attachment" (.Get "title" | default (.Get 1)) -}}
+{{- $caption := default $title (.Get "caption" | default (.Get 2)) -}}
+{{- $remote := default "" (.Get "remote" | default (.Get 3)) -}}
{{- $data := "" -}}
{{- $cache := "" -}}
@@ -32,11 +32,15 @@
{{- else -}}
{{- with $cache = resources.Get (path.Join "public/" $storage) -}}
{{- $type = $cache.MediaType -}}
- {{- $cache = print ("" | absURL) (strings.TrimLeft "public" $cache) -}}
+ {{- $cache = (strings.TrimPrefix "public/" $cache) -}}
{{- end -}}
{{- end -}}
-{{- $data := or $cache $url -}}
+{{- $data = strings.TrimPrefix "/" $url | relURL -}}
+
+{{- if $cache -}}
+ {{- $data = $cache | relURL -}}
+{{- end -}}
{{- if $remote -}}
{{- $data = $url -}}
@@ -56,7 +60,7 @@
<footer>
{{ $caption | markdownify }}
<br />
- Index: {{ with $cache }} {{ print "[Cache](" $cache ")" | markdownify }} &middot; {{ end }}
- {{ print "[Source](" $url ")" | markdownify }}
+ Index: {{ with $cache }} {{ print "[Cache](" "/" $cache ")" | markdownify }} &middot; {{ end }}
+ {{ printf `[Source](%s)` $url | markdownify }}
</footer>
</document-attachment>
diff --git a/themes/default/layouts/shortcodes/attach.rss.xml b/themes/default/layouts/shortcodes/attach.rss.xml
new file mode 100644
index 0000000..15ea4a3
--- /dev/null
+++ b/themes/default/layouts/shortcodes/attach.rss.xml
@@ -0,0 +1,6 @@
+{{- $url := default "/canory/media/2city12p.pdf" (.Get "url" | default (.Get 0)) -}}
+{{- $title := default "Attachment" (.Get "title" | default (.Get 1)) -}}
+{{- $caption := default $title (.Get "caption" | default (.Get 2)) -}}
+{{- $remote := default "" (.Get "remote" | default (.Get 3)) -}}
+
+<p>{{ printf `%s [Source](%s)` $caption $url | markdownify }}</p>
diff --git a/themes/default/layouts/shortcodes/markdown.html b/themes/default/layouts/shortcodes/markdown.html
index f73aa90..4d7fd08 100644
--- a/themes/default/layouts/shortcodes/markdown.html
+++ b/themes/default/layouts/shortcodes/markdown.html
@@ -7,11 +7,7 @@
{{- if not $title -}}
{{- $title = "Markdown Embed" -}}
{{- end -}}
- {{- print
- "{{< self "
- "url=" "\"" $link "\"" " "
- "title=" "\"" $title "\"" " "
- ">}}" | markdownify }}
+ {{- printf `{{< self url=%q title=%q >}}` $link $title | markdownify }}
{{- else -}}
- {{- print "[" $text "]" "(" $link " " "\"" (or $title $link) "\"" ")" | markdownify -}}
+ {{- printf `[%s](%s "%s")` $text $link (or $title $link) | markdownify -}}
{{- end -}}
diff --git a/themes/default/layouts/shortcodes/markdown.rss.xml b/themes/default/layouts/shortcodes/markdown.rss.xml
new file mode 100644
index 0000000..1c9418b
--- /dev/null
+++ b/themes/default/layouts/shortcodes/markdown.rss.xml
@@ -0,0 +1,13 @@
+{{- $link := default (print "/" (partial "function-paths.html").markdown "/" .Page.File ) (.Get "link" | default (.Get 0)) -}}
+{{- $text := default (path.Base .Page.File) (.Get "text" | default (.Get 1)) -}}
+{{- $title := default "" (.Get "title" | default (.Get 2)) -}}
+{{- $embed := default false (.Get "embed" | default (.Get 3)) -}}
+
+{{- if $embed -}}
+ {{- if not $title -}}
+ {{- $title = "Markdown Embed" -}}
+ {{- end -}}
+ {{ printf `%s ([Link](%s))` $title $link | markdownify }}
+{{- else -}}
+ {{- printf `[%s](%s "%s")` $text $link (or $title $link) | markdownify -}}
+{{- end -}}
diff --git a/themes/default/layouts/shortcodes/self.html b/themes/default/layouts/shortcodes/self.html
index 6036e07..a7f8b55 100644
--- a/themes/default/layouts/shortcodes/self.html
+++ b/themes/default/layouts/shortcodes/self.html
@@ -1,19 +1,15 @@
-{{- $url := default "" (.Get "url" | default (.Get 0)) -}}
-{{- $title := default "Self Embed" (.Get "title" | default (.Get 1)) -}}
-{{- $caption := default (print $title " ([Link](" $url "))") (.Get "caption" | default (.Get 2)) -}}
-{{- $sandbox := default "allow-popups" (.Get "sandbox" | default (.Get 3)) -}}
-
-{{- if (eq $url "") -}}
-{{- $url = "/" -}}
-{{- end -}}
+{{- $url := default (print .Page.Permalink "embed.html") (.Get "url" | default (.Get 0)) -}}
+{{- $title := default "Self Embed" (.Get "title" | default (.Get 1)) -}}
+{{- $caption := default $title (.Get "caption" | default (.Get 2)) -}}
+{{- $sandbox := default "allow-popups" (.Get "sandbox" | default (.Get 3)) -}}
<self-embed>
<iframe
height="165"
scrolling="no"
sandbox="{{ $sandbox }}"
- src="{{ .Site.BaseURL }}{{ $url }}"
+ src="{{ (strings.TrimPrefix "/" $url) | relURL }}"
title="{{ $title }}"
></iframe>
- <footer>{{ $caption | markdownify }}</footer>
+ <footer>{{ print $caption " ([Link](" $url "))" | markdownify }}</footer>
</self-embed>
diff --git a/themes/default/layouts/shortcodes/self.rss.xml b/themes/default/layouts/shortcodes/self.rss.xml
new file mode 100644
index 0000000..9f27b93
--- /dev/null
+++ b/themes/default/layouts/shortcodes/self.rss.xml
@@ -0,0 +1,6 @@
+{{- $url := default (print .Page.Permalink "embed.html") (.Get "url" | default (.Get 0)) -}}
+{{- $title := default "Self Embed" (.Get "title" | default (.Get 1)) -}}
+{{- $caption := default $title (.Get "caption" | default (.Get 2)) -}}
+{{- $sandbox := default "allow-popups" (.Get "sandbox" | default (.Get 3)) -}}
+
+<p>{{ printf `%s ([Link](%s))` $caption $url | markdownify }}</p>