diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 35da5ba3c5..522105f543 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -15,6 +15,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Full history for per-page last-updated dates # We build doxygen from source because of # https://github.com/doxygen/doxygen/issues/9016 @@ -35,6 +37,12 @@ jobs: cmake -S . -B build -G Ninja --install-prefix="$(pwd)/build/install" -D MFC_DOCUMENTATION=ON ninja -C build install + - name: Verify essential site files + run: | + for f in index.html 404.html robots.txt; do + test -f "build/install/docs/mfc/$f" || { echo "Missing $f"; exit 1; } + done + - name: Upload Built Documentation Artifact uses: actions/upload-artifact@v4 with: @@ -51,7 +59,7 @@ jobs: base-url-path: https://mflowcode.github.io/ path-to-root: build/install/docs/mfc include-pdf: false - sitemap-format: txt + sitemap-format: xml - name: Output stats run: | @@ -59,12 +67,6 @@ jobs: echo "url-count = ${{ steps.sitemap.outputs.url-count }}" echo "excluded-count = ${{ steps.sitemap.outputs.excluded-count }}" - - name: Linkcheck - Lychee - uses: lycheeverse/lychee-action@v2 - with: - args: -c .lychee.toml build/install/docs/mfc/ - fail: false - - name: Publish Documentation if: github.repository == 'MFlowCode/MFC' && github.ref == 'refs/heads/master' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' ) run: | @@ -81,5 +83,11 @@ jobs: git -C ../www commit -m "Docs @ ${GITHUB_SHA::7}" || true git -C ../www push + - name: Linkcheck - Lychee + uses: lycheeverse/lychee-action@v2 + with: + args: -c .lychee.toml build/install/docs/mfc/ + fail: true + # DOC_PUSH_URL should be of the format: # --> https://:@github.com// diff --git a/.lychee.toml b/.lychee.toml index b38b3c1da3..af73051c1c 100644 --- a/.lychee.toml +++ b/.lychee.toml @@ -16,5 +16,11 @@ accept = ["200", "429"] verbose = "error" -# Exclude sitemap from link checking (it contains pre-publish production URLs) -exclude_path = ["**/sitemap.txt"] +# Exclude sitemap file from scanning (it contains pre-publish production URLs) +exclude_path = ["sitemap\\.xml"] + +# Exclude URLs that fail due to external issues (broken SSL, pre-deploy only, etc.) +exclude = [ + "https://mflowcode\\.github\\.io/sitemap\\.xml", # Only exists after deployment + "https://cpe\\.ext\\.hpe\\.com", # HPE Cray docs have broken SSL cert +] diff --git a/CMakeLists.txt b/CMakeLists.txt index 0561b1c39e..17345f639d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -806,6 +806,25 @@ if (MFC_DOCUMENTATION) GEN_DOCS(post_process "MFC: Post-Process") GEN_DOCS(documentation "MFC") + # Inject per-page last-updated dates into documentation markdown files. + # Runs after auto-generated .md files exist, before Doxygen processes them. + # Uses a stamp file so it only runs once per build. + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/inject-dates.stamp" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/docs/documentation/examples.md" + "${CMAKE_CURRENT_SOURCE_DIR}/docs/documentation/case_constraints.md" + "${CMAKE_CURRENT_SOURCE_DIR}/docs/documentation/physics_constraints.md" + "${CMAKE_CURRENT_SOURCE_DIR}/docs/documentation/cli-reference.md" + "${CMAKE_CURRENT_SOURCE_DIR}/docs/documentation/parameters.md" + COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/docs/inject-dates.py" + "${CMAKE_CURRENT_SOURCE_DIR}" + COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_BINARY_DIR}/inject-dates.stamp" + COMMENT "Injecting page dates into documentation" + VERBATIM + ) + add_custom_target(inject_page_dates DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/inject-dates.stamp") + add_dependencies(documentation_doxygen inject_page_dates) + # > Copy Resources (main landing page & assets) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/docs/res" DESTINATION "docs/mfc") @@ -814,6 +833,7 @@ if (MFC_DOCUMENTATION) DESTINATION "docs/mfc") install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/docs/index.html" + "${CMAKE_CURRENT_SOURCE_DIR}/docs/404.html" DESTINATION "docs/mfc") endif() diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 0000000000..ce755cb45e --- /dev/null +++ b/docs/404.html @@ -0,0 +1,28 @@ + + + + + + 404 | MFC + + + + +
+
404
+

Page not found

+

The page you're looking for doesn't exist or has been moved.

+ +
+ + diff --git a/docs/header.html b/docs/header.html index 65a6e3c3dd..a4ac906459 100644 --- a/docs/header.html +++ b/docs/header.html @@ -18,7 +18,8 @@ $projectname: $title $title - + + diff --git a/docs/index.html b/docs/index.html index 2180ce4020..797fa941f3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -23,20 +23,54 @@ +