layouts: use absURL to construct absolute URLs instead of concatenating with .Site.BaseURL

This commit is contained in:
James Henstridge 2022-08-22 16:14:11 +08:00
parent b3b4386d01
commit 3eedfa1f8d
2 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,6 @@
<footer class="{{ .Site.Params.background_color_class | default "bg-black" }} bottom-0 w-100 pa3" role="contentinfo"> <footer class="{{ .Site.Params.background_color_class | default "bg-black" }} bottom-0 w-100 pa3" role="contentinfo">
<div class="flex justify-between"> <div class="flex justify-between">
<a class="f4 fw4 hover-white no-underline white-70 dn dib-ns pv2 ph3" href="{{ .Site.BaseURL }}" > <a class="f4 fw4 hover-white no-underline white-70 dn dib-ns pv2 ph3" href="{{ "/" | absURL }}" >
&copy; {{ with .Site.Copyright | default .Site.Title }} {{ . | safeHTML }} {{ now.Format "2006"}} {{ end }} &copy; {{ with .Site.Copyright | default .Site.Title }} {{ . | safeHTML }} {{ now.Format "2006"}} {{ end }}
</a> </a>
<div>{{ partial "social-follow.html" . }}</div> <div>{{ partial "social-follow.html" . }}</div>

View File

@ -1,8 +1,8 @@
User-agent: * User-agent: *
# robotstxt.org - if ENV production variable is false robots will be disallowed. {{/* robotstxt.org - if ENV production variable is false robots will be disallowed. */ -}}
{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }} {{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") -}}
Allow: / Allow: /
Sitemap: {{.Site.BaseURL}}/sitemap.xml Sitemap: {{ "/sitemap.xml" | absURL }}
{{ else }} {{ else -}}
Disallow: / Disallow: /
{{ end }} {{ end -}}