Skip to content

Add a generation for sitemap to the doc site#333

Open
mlonsk wants to merge 2 commits into
mainfrom
user/mol/createsitemap
Open

Add a generation for sitemap to the doc site#333
mlonsk wants to merge 2 commits into
mainfrom
user/mol/createsitemap

Conversation

@mlonsk

@mlonsk mlonsk commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@mlonsk mlonsk requested a review from Metallist1 June 11, 2026 08:27
@github-actions

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-mud-081affe03-333.westeurope.azurestaticapps.net

1 similar comment
@github-actions

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-mud-081affe03-333.westeurope.azurestaticapps.net

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds sitemap generation support to the DocFX-based documentation site build, including configuration, sitemap post-processing, and generation of a site-wide sitemap index + robots.txt.

Changes:

  • Introduces sitemap-related configuration (base URL, exclude/downrank rules) in metadata/build-config.json.
  • Enables DocFX sitemap output for the default language and ensures non-default language builds don’t emit sitemaps.
  • Adds a post-build script to post-process the default-language sitemap and generate _site/sitemap.xml (index) plus _site/robots.txt.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
metadata/build-config.json Adds baseUrl and sitemap rule configuration; extends content directory list.
docfx-template.json Enables DocFX sitemap generation defaults (baseUrl/changefreq/priority).
build-docs.py Runs sitemap/robots generation as a final post-build step.
build_scripts/gen_sitemap_index.py New script to exclude/downrank URLs in the default-language sitemap and emit sitemap index + robots.txt.
build_scripts/gen_redirects.py Adjusts per-language DocFX config generation: disables sitemap for non-default languages and rewrites baseUrl for the default language.
build_scripts/config_loader.py Adds helpers for baseUrl and sitemap rule retrieval.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread build-docs.py
Comment on lines +333 to +335
# Generate site-wide sitemap index (references each language's sitemap.xml)
# and robots.txt. Runs last so all per-language sitemaps already exist.
run_command(
Comment on lines 119 to +125
# Set English output destination (relative to localizedContent/en/)
config["build"]["dest"] = "../../_site/en"

# Point the sitemap at the default language's URL prefix
if "sitemap" in config["build"]:
config["build"]["sitemap"]["baseUrl"] = f"{get_base_url()}/{get_default_language()}"

Comment on lines +89 to +96
for rule in rules:
if rule["match"] in loc:
priority_el = url.find(f"{{{SITEMAP_NS}}}priority")
if priority_el is None:
priority_el = ET.SubElement(url, f"{{{SITEMAP_NS}}}priority")
priority_el.text = f"{float(rule['priority']):.1f}"
changed += 1
break
Comment on lines +196 to +197
if __name__ == "__main__":
exit(main())
@github-actions

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-mud-081affe03-333.westeurope.azurestaticapps.net

@github-actions

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-mud-081affe03-333.westeurope.azurestaticapps.net

"""
if config is None:
config = load_build_config()
return config.get("baseUrl", "https://docs.tabulareditor.com").rstrip("/")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally defaulting to "https://docs.tabulareditor.com" here is a bit wrong. (This is also relevant for injecting SEO) as we should not hardcode these strings. Now we got the same url stored in 3 different places. The build-config, inject seo and this config loader.

@Metallist1 Metallist1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look logical to me. And the site map build seems okay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants