errose28 opened a new pull request, #94:
URL: https://github.com/apache/ozone-site/pull/94

   ## What changes were proposed in this pull request?
   
   In #93 we bumped Docusaurus to version 3.3.2. By upgrading to the 3.3.x line 
we can use the new [createSitemapItems 
hook](https://docusaurus.io/blog/releases/3.3#createsitemapitems) to remove the 
sitemap GitHub Actions job and make that part of the docusaurus build instead.
   
   ### Background
   
   We currently have a GitHub actions job that checks the sitemap.xml file 
generated by the Docusaurus build to make sure that all generated URLs use 
lowercase kebab-case. Since URLs are either generated from file names or front 
matter (with `slug`) and we already have checks for both of those, it is 
unlikely that an invalid URL format would be generated. The check is still nice 
to have though, so we can make it lighter weight by plugging it into the 
Docusaurus build instead.
   
   ### Code Changes
   
   We use the docusaurus 
[classic](https://docusaurus.io/docs/3.1.1/api/themes/@docusaurus/theme-classic)
 theme, which automatically includes the 
[sitemap](https://docusaurus.io/docs/3.1.1/api/plugins/@docusaurus/plugin-sitemap)
 plugin. The change adds the sitemap hook to the part of the configuration that 
handles plugin configuration. For example, our 
[docs](https://docusaurus.io/docs/3.1.1/api/plugins/@docusaurus/plugin-content-docs)
 plugin is configured here as well.
   
   ### Dev Experience Changes
   
   Anything that would generate a URL in a disallowed format should still be 
caught by the static checks, and all invalid instances will be listed in a 
single failure for quicker fixing. If somehow something slips through there, 
the docusaurus build will now fail when building the sitemap.
   
   The build will abort after the first failure only, and the failure only 
occurs in a production build (`pnpm build`), not in development mode (`pnpm 
start` or `docker compose up`). These are limitations with how the hook is 
implemented and invoked at build time.
   
   ## What is the link to the Apache Jira?
   
   HDDS-10902
   
   ## How was this patch tested?
   
   - CI passes and there is no sitemap job present: 
[before](https://github.com/apache/ozone-site/actions/runs/9197965803) and 
[after](https://github.com/errose28/ozone-site/actions/runs/9198003528)
   - With our filename and front matter schema checks I'm not sure its actually 
possible for this to get hit in CI, it's kind of a fallback safety check.
   - It works in a manual local test by renaming a file or directory with 
something invalid like `test_name` and running `pnpm build`. The build fails 
and the error message is displayed.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to