From 910d3178dbf61b68bb3e6dd70f0446a3560106ff Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 30 Mar 2023 12:35:21 +0200 Subject: [PATCH] [doc] Fix urls for documentation - Don't publish the doc anymore to pmd.github.io - the docs are now hosted at docs.pmd-code.org - Update sitemap.xml - no extra sitemap generation anymore --- .ci/build.sh | 6 ++--- .ci/inc/pmd-doc.inc | 50 +--------------------------------- docs/_config.yml | 3 +-- docs/sitemap.xml | 26 +++++++++++++++--- docs/sitemap_generator.sh | 56 --------------------------------------- 5 files changed, 26 insertions(+), 115 deletions(-) delete mode 100755 docs/sitemap_generator.sh diff --git a/.ci/build.sh b/.ci/build.sh index 5f4d321698..2ed082bbe1 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -224,7 +224,7 @@ function pmd_ci_build_and_upload_doc() { pmd_ci_sourceforge_uploadReleaseNotes "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "${rendered_release_notes}" if pmd_ci_maven_isSnapshotBuild && [ "${PMD_CI_BRANCH}" = "master" ]; then - # only for snapshot builds from branch master + # only for snapshot builds from branch master: https://docs.pmd-code.org/snapshot -> pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION} pmd_code_createSymlink "${PMD_CI_MAVEN_PROJECT_VERSION}" "snapshot" # update github pages https://pmd.github.io/pmd/ @@ -249,14 +249,12 @@ function pmd_ci_build_and_upload_doc() { local rendered_release_notes_with_links rendered_release_notes_with_links=" * Downloads: https://github.com/pmd/pmd/releases/tag/pmd_releases%2F${PMD_CI_MAVEN_PROJECT_VERSION} -* Documentation: https://pmd.github.io/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}/ +* Documentation: https://docs.pmd-code.org/pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}/ ${rendered_release_notes}" pmd_ci_sourceforge_createDraftBlogPost "${release_name} released" "${rendered_release_notes_with_links}" "pmd,release" SF_BLOG_URL="${RESULT}" - # updates https://pmd.github.io/latest/ and https://pmd.github.io/pmd-${PMD_CI_MAVEN_PROJECT_VERSION} - publish_release_documentation_github # rsync site to https://pmd.sourceforge.io/pmd-${PMD_CI_MAVEN_PROJECT_VERSION} pmd_ci_sourceforge_rsyncSnapshotDocumentation "${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-${PMD_CI_MAVEN_PROJECT_VERSION}" fi diff --git a/.ci/inc/pmd-doc.inc b/.ci/inc/pmd-doc.inc index 4a6d5acc14..8969f8a4d8 100644 --- a/.ci/inc/pmd-doc.inc +++ b/.ci/inc/pmd-doc.inc @@ -42,55 +42,7 @@ function pmd_doc_create_archive() { } # -# Publishes the site to https://pmd.github.io/pmd-${PMD_CI_MAVEN_PROJECT_VERSION} and -# https://pmd.github.io/latest/ -# -function publish_release_documentation_github() { - echo -e "\n\n" - pmd_ci_log_info "Adding the new doc to pmd.github.io..." - # clone pmd.github.io. Note: This uses the ssh key setup earlier - # In order to speed things up, we use a sparse checkout - no need to checkout all directories here - mkdir pmd.github.io - ( - cd pmd.github.io || { echo "Directory 'pmd.github.io' doesn't exist"; exit 1; } - git init - git config user.name "PMD CI (pmd-bot)" - git config user.email "pmd-bot@users.noreply.github.com" - git config core.sparsecheckout true - git remote add origin git@github.com-pmd.github.io:pmd/pmd.github.io.git - echo "/latest/" > .git/info/sparse-checkout - echo "/sitemap.xml" >> .git/info/sparse-checkout - git pull --depth=1 origin master - pmd_ci_log_info "Copying documentation from ../docs/pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}/ to pmd-${PMD_CI_MAVEN_PROJECT_VERSION}/ ..." - rsync -ah --stats "../docs/pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}/" "pmd-${PMD_CI_MAVEN_PROJECT_VERSION}/" - git status - pmd_ci_log_debug "Executing: git add pmd-${PMD_CI_MAVEN_PROJECT_VERSION}" - git add --sparse "pmd-${PMD_CI_MAVEN_PROJECT_VERSION}" - pmd_ci_log_debug "Executing: git commit..." - git commit -q -m "Added pmd-${PMD_CI_MAVEN_PROJECT_VERSION}" - - pmd_ci_log_info "Copying pmd-${PMD_CI_MAVEN_PROJECT_VERSION} to latest ..." - git rm -qr latest - cp -a "pmd-${PMD_CI_MAVEN_PROJECT_VERSION}" latest - pmd_ci_log_debug "Executing: git add latest" - git add latest - pmd_ci_log_debug "Executing: git commit..." - git commit -q -m "Copying pmd-${PMD_CI_MAVEN_PROJECT_VERSION} to latest" - - pmd_ci_log_info "Generating sitemap.xml" - ../docs/sitemap_generator.sh > sitemap.xml - pmd_ci_log_debug "Executing: git add sitemap.xml" - git add sitemap.xml - pmd_ci_log_debug "Executing: git commit..." - git commit -q -m "Generated sitemap.xml" - - pmd_ci_log_info "Executing: git push origin master" - git push origin master - ) -} - -# -# Updates github pages of the main repository, +# Updates github pages branch "gh-pages" of the main repository, # so that https://pmd.github.io/pmd/ has the latest (snapshot) content # function pmd_doc_publish_to_github_pages() { diff --git a/docs/_config.yml b/docs/_config.yml index 920e5d9a1c..4dc5eee07d 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -44,7 +44,6 @@ exclude: - pdf-*.sh - pdfconfigs/ - pdf/ - - sitemap_generator.sh - render_release_notes.rb feedback_subject_line: PMD Source Code Analyzer @@ -117,7 +116,7 @@ description: "Intended as a documentation theme based on Jekyll for technical wr # the description is used in the feed.xml file # needed for sitemap.xml file only -url: https://pmd.github.io/pmd +url: https://docs.pmd-code.org/latest baseurl: "" # used by javadoc_tag.rb diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 38a04d6c4e..5a1d7dc52e 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -1,24 +1,42 @@ --- layout: none search: exclude +# https://www.sitemaps.org/protocol.html +# Priority is relative to the website, can be chosen in {0.1, 0.2, ..., 1} +# Default priority is 0.5 +latestPriority: 0.8 --- + + {{site.url}}/index.html + 0.9 + monthly + {{ site.time | date: "%Y-%m-%d" }} + + + {% for post in site.posts %} {% unless post.search == "exclude" %} {{site.url}}{{post.url}} + {{page.latestPriority}} + monthly + {{ site.time | date: "%Y-%m-%d" }} {% endunless %} {% endfor %} - {% for page in site.pages %} - {% unless page.search == "exclude" %} + {% for p in site.pages %} + {% unless p.search == "exclude" %} - {{site.url}}{{ page.url}} + {{site.url}}{{ p.url}} + {{page.latestPriority}} + monthly + {{ site.time | date: "%Y-%m-%d" }} {% endunless %} {% endfor %} - \ No newline at end of file + diff --git a/docs/sitemap_generator.sh b/docs/sitemap_generator.sh deleted file mode 100755 index 03e25a0bcf..0000000000 --- a/docs/sitemap_generator.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash - -# Sitemap generator for pmd.github.io main landing page. -# Assumes we have the latest version of the site under "latest" -# https://www.sitemaps.org/protocol.html - -WEBSITE_PREFIX="https://pmd.github.io/" -DOC_PREFIX="latest/" -DATE=`date +%Y-%m-%d` -# Priority is relative to the website, can be chosen in {0.1, 0.2, ..., 1} -# Default priority is 0.5 -LATEST_PRIORITY=0.8 - - -# Writes to standard output - -cat << HEADER_END - - - - - ${WEBSITE_PREFIX}index.html - 1 - monthly - $DATE - - - - ${WEBSITE_PREFIX}${DOC_PREFIX}index.html - 0.9 - monthly - $DATE - - - - -HEADER_END - - -for page in ${DOC_PREFIX}pmd_*.html -do - - cat << ENTRY_END - - ${WEBSITE_PREFIX}$page - $LATEST_PRIORITY - monthly - $DATE - - -ENTRY_END - -done - -echo "" -