diff --git a/config.toml b/config.toml index 055d477c..ff955c53 100644 --- a/config.toml +++ b/config.toml @@ -96,3 +96,6 @@ paginate = 36 identifier = "mail" name = ":postbox:" url = "/standing-invitation" + +[sitemap] + filename = 'sitemap.xml' diff --git a/content/_index.md b/content/_index.md new file mode 100644 index 00000000..0df1b963 --- /dev/null +++ b/content/_index.md @@ -0,0 +1,5 @@ +--- +sitemap: + changefreq: yearly + priority: 1.0 +--- diff --git a/content/curiosities.md b/content/curiosities.md index 7c9bfcee..40143425 100644 --- a/content/curiosities.md +++ b/content/curiosities.md @@ -4,6 +4,9 @@ emoji: 🧠 draft: false type: timeless summary: A list of the many curious things I've made over the years. +sitemap: + changefreq: weekly + priority: 0.8 --- I'm a thoroughly [miriscient](https://www.miriscient.org) chap, and this often ends up in me creating toys, trinkets, projects and other artistic things. I've listed some out below. diff --git a/content/now/index.md b/content/now/index.md index b222f83c..da8be179 100644 --- a/content/now/index.md +++ b/content/now/index.md @@ -5,6 +5,9 @@ draft: false type: timeless stylescope: nownownow summary: Regularly updated context on my life at the moment. Haven't seen me in a while? This will let you know what I'm up to. +sitemap: + changefreq: daily + priority: 1.0 --- > Being intentional about what I spend my time on has been consistently rewarding through my life, so when I learned about [the Now movement](https://nownownow.com/about) I knew I'd be publishing [my own _/now_ page](https://www.byjp.me/now) too. diff --git a/content/photos/_index.md b/content/photos/_index.md new file mode 100644 index 00000000..ee3d5088 --- /dev/null +++ b/content/photos/_index.md @@ -0,0 +1,5 @@ +--- +sitemap: + changefreq: monthly + priority: 0.8 +--- diff --git a/layouts/_default/sitemap.xml b/layouts/_default/sitemap.xml new file mode 100644 index 00000000..5d87281b --- /dev/null +++ b/layouts/_default/sitemap.xml @@ -0,0 +1,19 @@ +{{ printf "" | safeHTML }} + + {{ range .Data.Pages }} + {{- if .Permalink -}} + + {{ .Permalink }}{{ $date := .Date }}{{ if eq .Type "timeless" }}{{ $date = .Lastmod }}{{ end }}{{ if not $date.IsZero }} + {{ safeHTML ( $date.Format "2006-01-02T15:04:05-07:00" ) }}{{ end }}{{ if .IsPage }} + {{ with .Sitemap.ChangeFreq }}{{ . }}{{ else }}{{ if gt (now.Sub $date) (duration "hour" 168) }}yearly{{ else }}daily{{ end }}{{ end }}{{ end }}{{ if ge .Sitemap.Priority 0.0 }} + {{ .Sitemap.Priority }}{{ end }}{{ if .IsTranslated }} + {{ end }} + + {{- end -}} + {{ end }} + diff --git a/static/robots.txt b/static/robots.txt new file mode 100644 index 00000000..a6be3783 --- /dev/null +++ b/static/robots.txt @@ -0,0 +1,7 @@ +Sitemap: /sitemap.xml + +User-agent: GPTBot +Disallow: / + +User-Agent: DuckDuckBot +Allow: /