dashorst opened a new pull request, #1772:
URL: https://github.com/apache/maven-site/pull/1772

   Closes #1771.
   
   Adds a check to `mvn site` that every address the site has published still 
leads to its page and anchors, through the redirects in `.htaccess`. The 
background, and the run that finds the 17 anchors #1767 restored, are in #1771.
   
   - `src/main/java/org/apache/maven/site/check/Addresses.java`: the check 
(`check`) and the list update (`record`, which then checks too). A single-file 
Java tool on jsoup, run by exec-maven-plugin in the `site` phase, so 
`verify-site.yml` runs it on every pull request. Redirects into the component 
sites that the `components.links` files link in, and to `download.cgi`, are not 
followed further.
   - `src/published-addresses.txt`: every address of master at c39e862d with 
its anchors, plus the new how-to page: 795 in all. Excluded from RAT.
   - `content/markdown/developers/website/move-a-page.md`: a how-to for each 
kind of change (move or rename a page, rename or merge a section, move a 
section to another page, remove a page or section, add a page) and how to read 
the check's output. The failure message links to it. It is in the Deploy Maven 
Website menu and linked from that section's index page and the README.
   - `pom.xml`: the `addresses` property and the exec execution.
   
   To try it yourself:
   
   ```
   git fetch https://github.com/dashorst/maven-site.git address-check
   git checkout -b address-check FETCH_HEAD
   mvn clean verify site
   ```
   
   The build passes, with:
   
   ```
   Addresses: 795 published, 2 redirected, 2 to sites outside this build, 0 
retired, 0 broken
   ```
   
   Use `clean`: without it, `target/site` keeps the pages of the previous 
build, and a page you moved still seems to be at its old address.
   
   Take back the 17 anchors that #1767 restored:
   
   ```
   git revert --no-commit e399db52
   mvn clean site
   git revert --abort
   ```
   
   The build fails with:
   
   ```
   Addresses: 795 published, 2 redirected, 2 to sites outside this build, 0 
retired, 3 broken
     /guides/mini/guide-creating-archetypes.html lacks 
#a4._Install_the_archetype_and_run_the_archetype_plugin
     /guides/mini/guide-http-settings.html lacks 
#Configuring_GET.2C_HEAD.2C_PUT.2C_or_All_of_the_Above #Connection_Timeouts 
#Example.3A_Lifting_auth_scope_restriction_for_external_authentication_systems 
#Example.3A_Using_Preemptive_Authentication #Fine-Tuning_HttpClient_Parameters 
#HTTP_Headers #Ignoring_Cookies #Introduction #Non-String_Parameter_Values 
#Read_time_out #Support_for_General-Wagon_Configuration_Standards 
#Taking_Control_of_Your_HTTP_Headers #The_Basics
     /guides/mini/guide-wagon-providers.html lacks #Available_Wagon_Providers 
#Command-Line_Configuration #settings.xml_Configuration
   To fix a broken address, do one of these:
     - redirect it to its new place: Redirect Permanent <old> <new> in 
content/filtered-resources/.htaccess
     - put a dropped anchor back above the section that holds its content: <a 
id="a4._Install_the_archetype_and_run_the_archetype_plugin"></a>
     - retire it on purpose: Redirect gone <old>, or delete the anchor from 
src/published-addresses.txt
   See https://maven.apache.org/developers/website/move-a-page.html
   ```
   
   Rename a page without a redirect:
   
   ```
   git mv content/markdown/guides/mini/guide-java-target.md 
content/markdown/guides/mini/guide-java-version.md
   mvn clean site
   git mv content/markdown/guides/mini/guide-java-version.md 
content/markdown/guides/mini/guide-java-target.md
   ```
   
   The build fails with:
   
   ```
   Addresses: 795 published, 2 redirected, 2 to sites outside this build, 0 
retired, 1 broken
     /guides/mini/guide-java-target.html does not exist, and no redirect leads 
away from it
         it moved to /guides/mini/guide-java-version.html, which has 5 of its 5 
anchors:
         Redirect Permanent /guides/mini/guide-java-target.html 
/guides/mini/guide-java-version.html
   To fix a broken address, do one of these:
     - redirect it to its new place: Redirect Permanent <old> <new> in 
content/filtered-resources/.htaccess
     - put a dropped anchor back above the section that holds its content: <a 
id="..."></a>
     - retire it on purpose: Redirect gone <old>, or delete the anchor from 
src/published-addresses.txt
   See https://maven.apache.org/developers/website/move-a-page.html
   ```
   
   I compared the check with httpd 2.4 serving the built site with these 
.htaccess files: about 3,700 addresses per run (the listed ones, variants of 
them and of every redirect source, and strings generated from every 
`RedirectMatch` pattern), ten runs with different seeds. The two agree on every 
address.
   
   What the check cannot see is inside the component sites. 
`/reference/maven-classloading.html` redirects into `/archives/maven-1.x/`, 
which another build publishes, and the page is not there (#1525); the check 
counts that redirect as leaving this build.
   
   ---
   
   To make clear that you license your contribution under
   the [Apache License Version 2.0, January 
2004](https://www.apache.org/licenses/LICENSE-2.0)
   check one of the following:
   
   - [x] I hereby declare this contribution to be licensed under the [Apache 
License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0)
   - [ ] I hereby declare that I have filed an [Apache Individual Contributor 
License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to