Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sitemap parameter frontmatter #5

Open
h-enk opened this issue Sep 24, 2024 · 0 comments
Open

Add sitemap parameter frontmatter #5

h-enk opened this issue Sep 24, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@h-enk
Copy link
Member

h-enk commented Sep 24, 2024

Summary

Brief explanation of the feature.

Add parameter

seo:
  title: "" # custom title (optional)
  description: "" # custom description (recommended)
  canonical: "" # custom canonical URL (optional)
  robots: "noindex, nofollow" # custom robot tags (optional)
  sitemap: false # true (default) or false

Update line 5 logic of layouts/sitemap.xml:

{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  xmlns:xhtml="http://www.w3.org/1999/xhtml">
  {{ range .Data.Pages }}
    {{- if and .Permalink (ne .Params.seo.sitemap false) -}}
..
    {{- end -}}
  {{ end }}
</urlset>
{{/* Based on: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/sitemap.xml */}}

Update docs: Sitemap

Basic example

Include a basic example or links here.

Motivation

Why are we doing this? What use cases does it support? What is the expected outcome?

@h-enk h-enk added the enhancement New feature or request label Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant