diff --git a/.github/workflows/check_links.yml b/.github/workflows/check_links.yml new file mode 100644 index 0000000..d2178a3 --- /dev/null +++ b/.github/workflows/check_links.yml @@ -0,0 +1,30 @@ +# =========== IMPORTANT!! READ THIS!! ============ # +# This file is used to check links and can be copied to be used in other websites. + +# When you copy this file, make sure to check and modify the fields +# that here are marked with `MODIFY`. +# ============================================== # + +name: Check links + +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] + workflow_dispatch: + +jobs: + check-links: + uses: access-nri/access-hive-docs/.github/workflows/check_links_workflow.yml@main + with: + repo: '${{ github.repository }}' + ref_name: "${{ github.event_name == 'pull_request' && format('refs/pull/{0}/head', github.event.pull_request.number) || github.ref_name }}" + rtd_project: 'access-cm3-configs' # MODIFY: change this to the Read the Docs project + python_requirements_txt: 'documentation/requirements.txt' # MODIFY: Uncomment to add requirements.txt path. If not included, 'requirements.txt' is used. + mkdocs_yaml: 'documentation/mkdocs.yml' # MODIFY: Uncomment to add mkdocs.yml path. If not included, 'mkdocs.yml' is used. + # lychee_config: '/path/to/lychee_config.toml' # MODIFY: Uncomment to add lychee config path. If not included, the Hive Docs' one gets used. + # # MODIFY: Uncomment the lines below if the repo is private. You also need to create a secret named REPO_READ_TOKEN with a token that has repo read permissions. + # secrets: + # repo_read_token: ${{ secrets.REPO_READ_TOKEN }} \ No newline at end of file diff --git a/documentation/hooks/hide_pages_url_segment.py b/documentation/hooks/hide_pages_url_segment.py index bb7f074..56b4b0f 100644 --- a/documentation/hooks/hide_pages_url_segment.py +++ b/documentation/hooks/hide_pages_url_segment.py @@ -4,6 +4,8 @@ @event_priority(-100) def on_page_markdown(markdown, *, page, config, files): if page.file.url.startswith("pages/"): + # Remove "pages/" prefix from the URL page.file.url = page.file.url.removeprefix("pages/") page.file.dest_uri = page.file.dest_uri.removeprefix("pages/") - page.file.abs_dest_path = page.file.abs_dest_path.removeprefix("pages/") \ No newline at end of file + page.file.abs_dest_path = page.file.abs_dest_path.removeprefix("pages/") + page.canonical_url = config.site_url + page.file.url \ No newline at end of file diff --git a/documentation/mkdocs.yml b/documentation/mkdocs.yml index a9421c9..869c9e5 100755 --- a/documentation/mkdocs.yml +++ b/documentation/mkdocs.yml @@ -4,7 +4,7 @@ site_name: access-cm3-configs # Site URL -site_url: !ENV [SITE_URL, "http://access-nri.github.io/access-cm3-configs/"] +site_url: !ENV READTHEDOCS_CANONICAL_URL # Git repository (Adds a link to the GitHub repository at the top) repo_url: https://github.com/ACCESS-NRI/access-cm3-configs @@ -63,8 +63,6 @@ plugins: - bibtex: bib_file: references.bib csl_file: https://raw.githubusercontent.com/citation-style-language/styles/26eccff9e537f71494a4da7b91afac1adf571dc9/apa.csl - - events: - events_dir: community_resources/events/events markdown_extensions: - attr_list diff --git a/documentation/requirements.txt b/documentation/requirements.txt index 42f7524..f6e73f9 100644 --- a/documentation/requirements.txt +++ b/documentation/requirements.txt @@ -3,4 +3,4 @@ mkdocs-git-revision-date-localized-plugin==1.2.0 mkdocs-macros-plugin==1.0.4 mkdocs-bibtex==4.4.0 pypandoc_binary==1.15 -git+https://github.com/rbeucher/mkdocs_events_plugin.git \ No newline at end of file +git+https://github.com/ACCESS-NRI/mkdocs_resolve_absolute_urls_plugin.git@1.2.0 \ No newline at end of file