From fc07b509fe2da1e9baeb67869bc2fb3992990de4 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 23 May 2022 17:01:52 +0300 Subject: Rework alternate links, add sitemap support --- layouts/_default/home.humanstxt.txt | 17 +++++++++++++++++ layouts/_default/list.atom.xml | 7 +++++-- layouts/_default/list.feed.xml | 5 +++-- layouts/index.humanstxt.txt | 17 ----------------- layouts/partials/alternate-outputs.html | 6 ++++++ layouts/partials/head.html | 8 +++----- layouts/robots.txt | 3 +-- 7 files changed, 35 insertions(+), 28 deletions(-) create mode 100644 layouts/_default/home.humanstxt.txt delete mode 100644 layouts/index.humanstxt.txt create mode 100644 layouts/partials/alternate-outputs.html (limited to 'layouts') diff --git a/layouts/_default/home.humanstxt.txt b/layouts/_default/home.humanstxt.txt new file mode 100644 index 0000000..4b11034 --- /dev/null +++ b/layouts/_default/home.humanstxt.txt @@ -0,0 +1,17 @@ +{{- with site.Author.name }} + /* TEAM */ + + Author: {{ . }} +{{- with site.Author.email }}{{ printf "\n Contact: %s" . }}{{ end }} +{{- with site.Author.github }}{{ printf "\n GitHub: @%s" . }}{{ end }} +{{- with site.Author.twitter }}{{ printf "\n Twitter: @%s" . }}{{ end }} +{{- with site.Author.location }}{{ printf "\n From: %s" . }}{{ end }} +{{- end }} + + /* SITE */ + + Last update: {{ now.Format "2006/01/02" }} + Language: {{ range $i, $l := site.Languages }}{{ if $i }}, {{ end }}{{ .LanguageName }}{{ end }} + Doctype: HTML5 + Standards: HTML5, CSS3, Open Graph protocol, Schema.org + Components: Hugo, jQuery, Ed Theme diff --git a/layouts/_default/list.atom.xml b/layouts/_default/list.atom.xml index 5629534..452b3bf 100644 --- a/layouts/_default/list.atom.xml +++ b/layouts/_default/list.atom.xml @@ -14,14 +14,17 @@ {{- $pages = $pages | first $limit -}} {{- safeHTML "" }} - + {{ printf `<![CDATA[%s]]>` (partial "title.html" .) | safeHTML }} {{ with site.Params.description }}{{ printf `` . | safeHTML }}{{ end }} {{- $output_formats := .OutputFormats }} {{- range $output_formats -}} {{- $rel := (or (and (eq "atom" (.Name | lower)) "self") "alternate") -}} {{- with $output_formats.Get .Name }} - {{ printf `` .Permalink $rel .MediaType.Type .Name | safeHTML }} + {{ printf `` .RelPermalink $rel .MediaType.Type .Name | safeHTML }} {{- end -}} {{- end }} {{ $logo := resources.Get (site.Params.assets.logo | default "/img/open-graph-logo.png") }}{{ $logo = $logo.Resize "96x96" }}{{ $logo.Permalink | absURL }} diff --git a/layouts/_default/list.feed.xml b/layouts/_default/list.feed.xml index 8a80edf..0a37e09 100644 --- a/layouts/_default/list.feed.xml +++ b/layouts/_default/list.feed.xml @@ -22,7 +22,8 @@ xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" - xml:lang="{{ site.LanguageCode }}"> + xml:lang="{{ site.LanguageCode }}" + xml:base="{{ site.BaseURL }}"> {{ printf `<![CDATA[%s]]>` (partial "title.html" .) | safeHTML }} @@ -39,7 +40,7 @@ {{- range $output_formats -}} {{- $rel := (or (and (eq "feed" (.Name | lower)) "self") "alternate") -}} {{- with $output_formats.Get .Name }} - {{ printf `` .Permalink $rel .MediaType.Type .Name | safeHTML }} + {{ printf `` .RelPermalink $rel .MediaType.Type .Name | safeHTML }} {{- end -}} {{- end }} {{ with site.Params.description }}{{ printf `` . | safeHTML }}{{ end }} diff --git a/layouts/index.humanstxt.txt b/layouts/index.humanstxt.txt deleted file mode 100644 index 4b11034..0000000 --- a/layouts/index.humanstxt.txt +++ /dev/null @@ -1,17 +0,0 @@ -{{- with site.Author.name }} - /* TEAM */ - - Author: {{ . }} -{{- with site.Author.email }}{{ printf "\n Contact: %s" . }}{{ end }} -{{- with site.Author.github }}{{ printf "\n GitHub: @%s" . }}{{ end }} -{{- with site.Author.twitter }}{{ printf "\n Twitter: @%s" . }}{{ end }} -{{- with site.Author.location }}{{ printf "\n From: %s" . }}{{ end }} -{{- end }} - - /* SITE */ - - Last update: {{ now.Format "2006/01/02" }} - Language: {{ range $i, $l := site.Languages }}{{ if $i }}, {{ end }}{{ .LanguageName }}{{ end }} - Doctype: HTML5 - Standards: HTML5, CSS3, Open Graph protocol, Schema.org - Components: Hugo, jQuery, Ed Theme diff --git a/layouts/partials/alternate-outputs.html b/layouts/partials/alternate-outputs.html new file mode 100644 index 0000000..52bdd0d --- /dev/null +++ b/layouts/partials/alternate-outputs.html @@ -0,0 +1,6 @@ +{{- range .AlternativeOutputFormats }} + +{{- end }} + + + diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 3ef34e2..81dd2d0 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -17,12 +17,10 @@ - - {{- /* RSS */}} - {{ range .AlternativeOutputFormats }} - - {{- end -}} + {{- /* Feed, sitemap and manifest */}} + {{ partial "alternate-outputs.html" . }} + {{- range .AllTranslations -}} {{ end -}} diff --git a/layouts/robots.txt b/layouts/robots.txt index c59438e..c07f0df 100644 --- a/layouts/robots.txt +++ b/layouts/robots.txt @@ -4,8 +4,7 @@ User-agent: * {{- if eq (getenv "HUGO_ENV") "production" | or (eq site.Params.env "production") }} Allow: / -# TODO: implement sitemap.xml -# Sitemap: {{ "stemap.xml" | absURL }} +Sitemap: {{ "/stemap.xml" | absURL }} {{- else }} Disallow: / {{- end }} -- cgit v1.2.3