From 5344a15889ee292cd0082bae63f847d7d9a27b84 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sat, 14 May 2022 11:28:47 +0200 Subject: Add humans.txt support --- layouts/index.humanstxt.txt | 36 ++++++++++++++++++++++++++++++++++++ layouts/partials/author.html | 1 + layouts/partials/head.html | 1 + layouts/partials/team-member.html | 5 +++++ layouts/robots.txt | 2 +- 5 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 layouts/index.humanstxt.txt create mode 100644 layouts/partials/team-member.html (limited to 'layouts') diff --git a/layouts/index.humanstxt.txt b/layouts/index.humanstxt.txt new file mode 100644 index 0000000..d8aec86 --- /dev/null +++ b/layouts/index.humanstxt.txt @@ -0,0 +1,36 @@ +{{/* TODO: Translate me */}} +CONGRATULATIONS, you found my humans.txt file! + +─────────────────────────────────────────────────────────────────────────────── + + /* TEAM */ +{{ if site.Author }} + {{- $author_type := (printf "%T" site.Author) }} + {{- if (or (eq $author_type "map[string]string") (eq $author_type "map[string]interface {}")) }} + {{- range $i, $author := site.Author }} + {{- $name_type := (printf "%T" $author) }} + {{- if (eq $name_type "maps.Params") }} + {{- $.Scratch.Set "name" ($author.Get "name") }} + {{- $.Scratch.Set "email" ($author.Get "email") }} + {{- $.Scratch.Set "github" ($author.Get "github") }} + {{- $.Scratch.Set "location" ($author.Get "location") }} + {{- partial "team-member.html" . -}} + {{ else }} + {{- $.Scratch.Set "name" site.Author.name }} + {{- $.Scratch.Set "email" site.Author.email }} + {{- $.Scratch.Set "github" site.Author.github }} + {{- $.Scratch.Set "location" site.Author.location }} + {{- partial "team-member.html" . }} + {{- break -}} + {{- end }} + {{- end }} + {{- end }} +{{- end }} + + /* SITE */ + + Last update: ??? + Language: Russian, English + Doctype: HTML5 + Standards: HTML5, CSS3, Open Graph protocol, Schema.org + Components: Hugo, jQuery, Ed Theme diff --git a/layouts/partials/author.html b/layouts/partials/author.html index 6de4feb..efb1dbd 100644 --- a/layouts/partials/author.html +++ b/layouts/partials/author.html @@ -22,6 +22,7 @@ {{- end }} {{- end }} {{- delimit ($.Scratch.GetSortedMapValues "names") ", " }} + {{- $.Scratch.Delete "names" -}} {{- end }} {{- end -}} {{- end -}} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index da95aa5..abb4cbe 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -10,6 +10,7 @@ + {{ block "title" . }}{{ if .IsHome }}{{ site.Title }}{{ else }}{{ with .Params.Title }}{{ . }} - {{ end }}{{ site.Title }}{{ end }}{{ end }} diff --git a/layouts/partials/team-member.html b/layouts/partials/team-member.html new file mode 100644 index 0000000..917e97f --- /dev/null +++ b/layouts/partials/team-member.html @@ -0,0 +1,5 @@ + + Author: {{ .Name }} + Contact: {{ .Email }} + GitHub: {{ .Github }} + From: {{ .Location }} diff --git a/layouts/robots.txt b/layouts/robots.txt index dbc405e..c59438e 100644 --- a/layouts/robots.txt +++ b/layouts/robots.txt @@ -1,9 +1,9 @@ -# TODO: Does not work {{- $url := urls.Parse ("/" | absURL) -}} # robots.txt file for "{{ site.Title }}" website, {{ $url.Host }} User-agent: * {{- if eq (getenv "HUGO_ENV") "production" | or (eq site.Params.env "production") }} Allow: / + # TODO: implement sitemap.xml # Sitemap: {{ "stemap.xml" | absURL }} {{- else }} -- cgit v1.2.3