Add a generation for sitemap to the doc site#333
Conversation
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-mud-081affe03-333.westeurope.azurestaticapps.net |
1 similar comment
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-mud-081affe03-333.westeurope.azurestaticapps.net |
There was a problem hiding this comment.
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.
| # 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( |
| # 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()}" | ||
|
|
| 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 |
| if __name__ == "__main__": | ||
| exit(main()) |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-mud-081affe03-333.westeurope.azurestaticapps.net |
|
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("/") |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
The changes look logical to me. And the site map build seems okay.
No description provided.