Skip to content

Improve sitemap.xml#230

Merged
untra merged 4 commits intountra:masterfrom
yunseo-kim:main
Jan 13, 2025
Merged

Improve sitemap.xml#230
untra merged 4 commits intountra:masterfrom
yunseo-kim:main

Conversation

@yunseo-kim
Copy link
Copy Markdown
Contributor

@yunseo-kim yunseo-kim commented Jan 13, 2025

🔤 Polyglot PR

  1. Add the <lastmod> tag to sitemap.xml
    If used with the 'jekyll-last-modified-at' plugin, read the node.last_modified_at variable and assign it as the value of the tag.
    Else if node.date variable exists, use its value.

  2. Exclude sitemap.xml from localization

The official Sitemap protocol documentation states:

"The location of a Sitemap file determines the set of URLs that can be included in that Sitemap. A Sitemap file located at http://example.com/catalog/sitemap.xml can include any URLs starting with http://example.com/catalog/ but can not include URLs starting with http://example.com/images/."

"It is strongly recommended that you place your Sitemap at the root directory of your web server."

To comply with this, 'sitemap.xml' should be added to the 'exclude_from_localization' list. This will ensure that only one file exists in the root directory, rather than creating separate ones for each language, as shown in the inappropriate example below.

Inappropriate example (the content of each file is identical, not different for each language):

  • /sitemap.xml
  • /ko/sitemap.xml
  • /es/sitemap.xml
  • /pt-BR/sitemap.xml
  • /ja/sitemap.xml
  • /fr/sitemap.xml
  • /de/sitemap.xml
  1. Add my blog as an example of polyglot in action
    I've also been using polyglot on my Jekyll blog for about half a year now and have been documenting my experience in a series of posts. I would like to list my blog as an example of polyglot in action, as I believe it will be helpful to other beginners who want to use polyglot.

add a sweet (optional) meme

Type of change

  • Docs update (changes to the readme or a site page, no code changes)
  • Ops wrangling (automation or test improvements)
  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Sweet release (needs a lot of work and effort)
  • Something else (explain please)

Checklists

  • If modifying code, at least one test has been added to the suite

If used with the 'jekyll-last-modified-at' plugin, read the node.last_modified_at variable and assign it as the value of the <lastmod> tag.
Else if node.date variable exists, use its value.
The [official Sitemap protocol documentation](https://www.sitemaps.org/protocol.html#location) states:

"The location of a Sitemap file determines the set of URLs that can be included in that Sitemap. A Sitemap file located at http://example.com/catalog/sitemap.xml can include any URLs starting with http://example.com/catalog/ but can not include URLs starting with http://example.com/images/."

"It is strongly recommended that you place your Sitemap at the root directory of your web server."

To comply with this, 'sitemap.xml' should be added to the 'exclude_from_localization' list to ensure that only one `sitemap.xml` file exists in the root directory, rather than creating separate ones for each language.
@untra
Copy link
Copy Markdown
Owner

untra commented Jan 13, 2025

Thank you for this contribution @yunseo-kim ! These are important and nuanced details of building a sitemap.xml I was unfamiliar with, and it would make sense sublanguage sites shouldn't have their own sitemap.xml .

I'm going to merge these changes in now, but I'll get around to rebuilding the polyglot site with the upcoming v1.9 release, where the <lastmod> changes will get applied.

Cheers! 🎉

@untra untra merged commit 1f95de9 into untra:master Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants