Add custom sitemap.xml with hreflang

master
rubenwardy 2022-07-22 03:51:46 +01:00
parent d3ede65b75
commit 79303ac5ea
5 changed files with 31 additions and 1 deletions

1
404.md
View File

@ -2,6 +2,7 @@
title: Page Not Found
layout: article
permalink: 404.html
sitemap: false
---

View File

@ -6,7 +6,6 @@ sass:
plugins:
- jekyll-redirect-from
- jekyll-sitemap
exclude:
- locale

View File

@ -1,6 +1,7 @@
---
title: Thanks for the feedback
layout: article
sitemap: false
---
# Thanks for the feedback

28
sitemap.xml Normal file
View File

@ -0,0 +1,28 @@
---
---
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
{% for page in site.pages %}
{% assign pathsplit = page.path | split: '/' %}
{% assign lang = pathsplit[0] %}
{% unless page.sitemap == false or page.layout == null %}
<url>
<loc>{{ page.url | absolute_url }}</loc>
{% if site.data.locale[lang] %}
{% assign oldSegment = "/" | append: lang | append: "/" %}
{% for other in site.data.languages %}
{% assign newSegment = "/" | append: other.code | append: "/" %}
<xhtml:link
rel="alternate"
hreflang="{{ other.code }}"
href="{{ page.url | replace: oldSegment, newSegment | absolute_url }}"/>
{% endfor %}
{% endif %}
</url>
{% endunless %}
{% endfor %}
</urlset>

View File

@ -1,5 +1,6 @@
---
title: Uninstall Feedback
sitemap: false
layout: article
reasons:
missing_features: