diff --git a/.cache/plugin/social/fonts b/.cache/plugin/social/fonts new file mode 120000 index 0000000000..99d2288cfd --- /dev/null +++ b/.cache/plugin/social/fonts @@ -0,0 +1 @@ +../../../theme/assets/brand/fonts \ No newline at end of file diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index 47064fc69b..4321f0c40f 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -1,4 +1,3 @@ -# name: ☁️ Build Container # Configures this workflow to run every time a change is pushed to the branch called `release`. diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml new file mode 100644 index 0000000000..c1d125b345 --- /dev/null +++ b/.github/workflows/build-pr.yml @@ -0,0 +1,100 @@ +name: 🛠️ Build PR Preview + +on: + pull_request: + +concurrency: + group: ${{github.event.pull_request.head.ref}} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + metadata: + runs-on: ubuntu-latest + outputs: + submodules: ${{ steps.submodules.outputs.submodules }} + privileged: ${{ steps.submodules.outputs.privileged }} + env: + ACTIONS_SSH_KEY: ${{ secrets.ACTIONS_SSH_KEY }} + steps: + - name: Set submodules for fork + if: env.ACTIONS_SSH_KEY == '' + id: submodules + run: | + echo "submodules="[brand, i18n]"" >> "$GITHUB_OUTPUT" + echo "privileged=false" >> "$GITHUB_OUTPUT" + + - name: Set submodules for main repo + if: env.ACTIONS_SSH_KEY != '' + run: | + echo "submodules="[brand, i18n, webserver]"" >> "$GITHUB_OUTPUT" + echo "privileged=true" >> "$GITHUB_OUTPUT" + + - name: Save PR metadata + run: | + mkdir -p ./metadata + echo ${{ github.event.number }} > ./metadata/NR + echo ${{ github.event.pull_request.head.sha }} > ./metadata/SHA + + - name: Upload metadata as artifact + uses: actions/upload-artifact@v2 + with: + name: metadata + path: metadata + + submodule: + needs: metadata + strategy: + matrix: + repo: ${{ fromJson(needs.metadata.outputs.submodules) }} + uses: privacyguides/.github/.github/workflows/download-repo.yml@main + with: + repo: ${{ matrix.repo.name }} + privileged: ${{ fromJSON(needs.metadata.outputs.privileged) }} + secrets: + ACTIONS_SSH_KEY: ${{ secrets.ACTIONS_SSH_KEY }} + + build: + needs: [submodule, metadata] + strategy: + matrix: + lang: [es, fr, he, it, nl, ru, zh-Hant] + allow-error: [true] + include: + - lang: en + allow-error: false + fail-fast: false + uses: ./.github/workflows/build.yml + with: + ref: ${{github.event.pull_request.head.ref}} + repo: ${{github.event.pull_request.head.repo.full_name}} + lang: ${{ matrix.lang }} + continue-on-error: ${{ matrix.allow-error }} + privileged: ${{ fromJSON(needs.metadata.outputs.privileged) }} + + combine_build: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + with: + pattern: site-build-* + merge-multiple: true + + - run: | + for file in *.tar.gz; do tar -zxf "$file"; done + ls -la site/ + + - name: Upload Site + uses: actions/upload-artifact@v4 + with: + name: site-build-combined + path: site + retention-days: 5 + + cleanup: + if: ${{ always() }} + needs: build + uses: privacyguides/.github/.github/workflows/cleanup.yml@main diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ac4b22589a..7b4abe31d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,6 +21,9 @@ on: continue-on-error: type: boolean default: true + privileged: + type: boolean + default: true permissions: contents: read @@ -33,51 +36,111 @@ jobs: contents: read steps: - - run: | + - name: Add GitHub Token to Environment + run: | echo "GH_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> "$GITHUB_ENV" - - if: inputs.config == 'build' + - name: Set Metadata + if: inputs.config == 'build' run: | { - echo "MKDOCS_INHERIT=mkdocs-production.yml" + echo "BUILD_CONTEXT=${{ inputs.context }}" + echo "BUILD_EDIT_URI_TEMPLATE=blob/main/docs/{path}?plain=1" + echo "BUILD_REPO_URL=https://github.com/privacyguides/privacyguides.org" echo "PRODUCTION=true" - echo "CONTEXT=${{ inputs.context }}" } >> "$GITHUB_ENV" - - if: inputs.config == 'offline' + - name: Set Metadata for Privileged Builds + if: inputs.privileged + run: echo "BUILD_INSIDERS=true" >> "$GITHUB_ENV" + + - name: Set Metadata for Offline Mode + if: inputs.config == 'offline' + run: | + { + echo "BUILD_OFFLINE=true" + echo "BUILD_REPO_URL="" + echo "CARDS=false" + echo "HOMEPAGE_BUTTON_GET_STARTED_LINK=basics/why-privacy-matters.html" + echo "HOMEPAGE_BUTTON_TOOLS_LINK=tools.html" + } >> "$GITHUB_ENV" + + - name: Set Metadata for Translations + if: inputs.lang != 'en' + run: | + { + echo "BUILD_ABBREVIATIONS=includes/abbreviations.${{ inputs.lang }}.txt" + echo "BUILD_DOCS_DIR=i18n/${{ inputs.lang }}" + echo "BUILD_EDIT_URI_TEMPLATE=https://github.com/privacyguides/i18n/blob/main/i18n/${{ inputs.lang }}/{path}?plain=1" + echo "BUILD_SITE_DIR=i18n/${{ inputs.lang }}" + echo "BUILD_SITE_URL=https://privacyguides.org/${{ inputs.lang }}" + echo "BUILD_THEME_LANGUAGE=${{ inputs.lang }}" + } >> "$GITHUB_ENV" + + - name: Set Metadata for Hebrew Translation + if: inputs.lang == 'he' + run: | + { + echo "BUILD_THEME_FONT_CODE=Cousine" + echo "BUILD_THEME_FONT_TEXT=Open Sans" + echo "TRANSLATION_STYLESHEET=assets/stylesheets/lang-${{ inputs.lang }}.css?v=20240410" + } >> "$GITHUB_ENV" + + - name: Set Metadata for Russian Translation + if: inputs.lang == 'ru' + run: | + { + echo "TRANSLATION_STYLESHEET=assets/stylesheets/lang-${{ inputs.lang }}.css?v=20240410" + } >> "$GITHUB_ENV" + + - name: Set Metadata for Chinese (Traditional) Translation + if: inputs.lang == 'zh-Hant' run: | - echo "MKDOCS_INHERIT=mkdocs-offline.yml" >> "$GITHUB_ENV" - echo "CARDS=false" >> "$GITHUB_ENV" + { + echo "BUILD_THEME_FONT_CODE=Noto Sans TC" + echo "BUILD_THEME_FONT_TEXT=Noto Sans TC" + echo "TRANSLATION_STYLESHEET=assets/stylesheets/lang-${{ inputs.lang }}.css?v=20240410" + } >> "$GITHUB_ENV" - - uses: actions/checkout@v4 + - name: Download Repository + uses: actions/checkout@v4 with: repository: ${{ inputs.repo }} ref: ${{ inputs.ref }} persist-credentials: "false" fetch-depth: 0 - - uses: actions/download-artifact@v4 + - name: Download Submodules + uses: actions/download-artifact@v4 with: pattern: repo-* path: modules - - run: | + - name: Move mkdocs-material-insiders to mkdocs-material + if: inputs.privileged + run: | rmdir modules/mkdocs-material mv modules/repo-mkdocs-material-insiders modules/mkdocs-material + + - name: Move brand submodule to theme/assets/brand + run: | rmdir theme/assets/brand mv modules/repo-brand theme/assets/brand - - if: inputs.lang != 'en' + - name: Copy Translation Files + if: inputs.lang != 'en' run: | cp -rl modules/repo-i18n/i18n . cp -rl modules/repo-i18n/includes . cp -rl modules/repo-i18n/theme . - - uses: actions/setup-python@v5 + - name: Install Python + uses: actions/setup-python@v5 with: cache: "pipenv" - - uses: actions/cache/restore@v4.0.2 + - name: Restore Site Cache + uses: actions/cache/restore@v4.0.2 id: site_cache_restore with: key: site-cache-${{ inputs.repo }}-${{ inputs.ref }}-${{ hashfiles('.cache/**') }} @@ -86,7 +149,8 @@ jobs: site-cache-${{ inputs.repo }}-${{ inputs.ref }}- site-cache-${{ inputs.repo }}- - - uses: actions/cache/restore@v4.0.2 + - name: Restore Card Cache + uses: actions/cache/restore@v4.0.2 id: card_cache_restore with: key: card-cache-${{ inputs.repo }}-${{ inputs.lang }}-${{ inputs.ref }}-${{ hashfiles('config/.cache/plugin/social/manifest.json') }} @@ -97,29 +161,51 @@ jobs: card-cache-${{ inputs.repo }}-${{ inputs.lang }}-${{ inputs.ref }}- card-cache-${{ inputs.repo }}-${{ inputs.lang }}- - - run: | + - name: Install Python Dependencies + if: inputs.privileged + run: | pip install pipenv pipenv install sudo apt install pngquant - - uses: falti/dotenv-action@v1.1 + - name: Install Python Dependencies (Unprivileged) + if: !inputs.privileged + run: | + pip install mkdocs-material + sudo apt install pngquant + + - name: Set Translated String Environment Variables + uses: falti/dotenv-action@v1.1 with: path: includes/strings.${{ inputs.lang }}.env export-variables: true keys-case: bypass - - run: | - pipenv run mkdocs build --config-file config/mkdocs.${{ inputs.lang }}.yml + - name: Build Website + if: inputs.privileged + run: | + pipenv run mkdocs build --config-file mkdocs-production.yml pipenv run mkdocs --version + + - name: Build Website (Unprivileged) + if: !inputs.privileged + run: | + mkdocs build --config-file ${{ inputs.config_file }} + mkdocs --version + + - name: Package Website + run: | tar -czvf site-${{ inputs.config }}-${{ inputs.lang }}.tar.gz site - - uses: actions/cache/save@v4.0.2 + - name: Save Site Cache + uses: actions/cache/save@v4.0.2 if: steps.site_cache_restore.outputs.cache-hit != 'true' with: key: site-cache-${{ inputs.repo }}-${{ inputs.ref }}-${{ hashfiles('.cache/**') }} path: .cache - - uses: actions/cache/save@v4.0.2 + - name: Save Card Cache + uses: actions/cache/save@v4.0.2 if: steps.card_cache_restore.outputs.cache-hit != 'true' with: key: card-cache-${{ inputs.repo }}-${{ inputs.lang }}-${{ inputs.ref }}-${{ hashfiles('config/.cache/plugin/social/manifest.json') }} @@ -127,10 +213,12 @@ jobs: config/.cache/plugin/social/manifest.json config/.cache/plugin/social/assets - - uses: actions/upload-artifact@v4 + - name: Upload Site + uses: actions/upload-artifact@v4 with: name: site-${{ inputs.config }}-${{ inputs.lang }}.tar.gz path: site-${{ inputs.config }}-${{ inputs.lang }}.tar.gz + retention-days: 1 offline_package: if: inputs.config == 'offline' && inputs.lang == 'en' diff --git a/.github/workflows/publish-pr.yml b/.github/workflows/publish-pr.yml index f5d93e705e..24c4f4ceea 100644 --- a/.github/workflows/publish-pr.yml +++ b/.github/workflows/publish-pr.yml @@ -1,79 +1,97 @@ -# Copyright (c) 2024 Jonah Aragon - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. - name: 📦 PR Preview on: - pull_request_target: - -concurrency: - group: ${{github.event.pull_request.head.ref}} - cancel-in-progress: true + workflow_run: + workflows: [🛠️ Build PR Preview] + types: + - completed permissions: pull-requests: write contents: read jobs: - submodule: - strategy: - matrix: - repo: - - name: mkdocs-material-insiders - ref: main - - name: brand - ref: main - - name: i18n - ref: main - uses: privacyguides/.github/.github/workflows/download-repo.yml@main - with: - repo: ${{ matrix.repo.name }} - secrets: - ACTIONS_SSH_KEY: ${{ secrets.ACTIONS_SSH_KEY }} + metadata: + if: > + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.conclusion == 'success' - build: - needs: submodule - strategy: - matrix: - lang: [es, fr, he, it, nl, ru, zh-Hant] - allow-error: [true] - include: - - lang: en - allow-error: false - fail-fast: false - permissions: - contents: read - uses: ./.github/workflows/build.yml - with: - ref: ${{github.event.pull_request.head.ref}} - repo: ${{github.event.pull_request.head.repo.full_name}} - lang: ${{ matrix.lang }} - continue-on-error: ${{ matrix.allow-error }} + runs-on: ubuntu-latest + + outputs: + pr_number: ${{ steps.metadata.outputs.pr_number }} + sha: ${{ steps.metadata.outputs.sha }} + + steps: + - name: Download Website Build Artifact + uses: actions/github-script@v3.1.0 + with: + script: | + var artifacts = await github.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{github.event.workflow_run.id }}, + }); + var matchArtifact = artifacts.data.artifacts.filter((artifact) => { + return artifact.name == "site-build-combined" + })[0]; + var download = await github.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + var fs = require('fs'); + fs.writeFileSync('${{github.workspace}}/site-build-combined.zip', Buffer.from(download.data)); + + - name: Unpack Website + run: | + unzip site-build-combined.zip + tar -czvf site-build-combined.tar.gz site + + - name: Upload Combined Build Artifact + uses: actions/upload-artifact@v4 + with: + name: site-build-combined.tar.gz + path: site-build-combined.tar.gz + retention-days: 5 + + - name: Download Metadata Artifact + uses: actions/github-script@v3.1.0 + with: + script: | + var artifacts = await github.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{github.event.workflow_run.id }}, + }); + var matchArtifact = artifacts.data.artifacts.filter((artifact) => { + return artifact.name == "metadata" + })[0]; + var download = await github.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + var fs = require('fs'); + fs.writeFileSync('${{github.workspace}}/metadata.zip', Buffer.from(download.data)); + + - name: Set Metadata + id: metadata + run: | + unzip metadata.zip + echo "pr_number=$(cat metadata/pr_number)" >> "$GITHUB_OUTPUT" + echo "sha=$(cat metadata/sha)" >> "$GITHUB_OUTPUT" deploy: - needs: build + needs: metadata permissions: contents: read + uses: privacyguides/webserver/.github/workflows/deploy-netlify-preview.yml@main with: - netlify_alias: ${{ github.event.pull_request.head.sha }} + netlify_alias: ${{ needs.metadata.outputs.pr_number }} netlify_site_id: ${{ vars.NETLIFY_SITE }} secrets: NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }} @@ -81,23 +99,19 @@ jobs: comment: permissions: pull-requests: write - needs: deploy + needs: [deploy, metadata] runs-on: ubuntu-latest env: address: ${{ needs.deploy.outputs.address }} steps: - uses: thollander/actions-comment-pull-request@v2.5.0 with: + pr_number: ${{ needs.metadata.outputs.pr_number }} message: | ### Your preview is ready! | Name | Link | | :---: | ---- | - | Latest commit | ${{ github.event.pull_request.head.sha }} | + | Latest commit | ${{ needs.metadata.outputs.sha }} | | Preview | ${{ env.address }} | comment_tag: deployment - - cleanup: - if: ${{ always() }} - needs: build - uses: privacyguides/.github/.github/workflows/cleanup.yml@main diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 512163c07c..7d4e82328b 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -41,7 +41,7 @@ jobs: needs: submodule strategy: matrix: - lang: [en, es, fr, he, it, nl, ru, zh-Hant] + lang: [en, fr, he] build: [build, offline] fail-fast: false permissions: diff --git a/.gitignore b/.gitignore index ede72fe7a4..e8ae219915 100644 --- a/.gitignore +++ b/.gitignore @@ -9,13 +9,11 @@ site # see: https://github.com/squidfunk/mkdocs-material/issues/6983 # ridiculous hide-and-seek https://stackoverflow.com/a/72380673 .cache/* -!/config/.cache -/config/.cache/* -!/config/.cache/plugin -/config/.cache/plugin/* -!/config/.cache/plugin/social -/config/.cache/plugin/social/* -!/config/.cache/plugin/social/fonts +!.cache/plugin +/.cache/plugin/* +!.cache/plugin/social +/.cache/plugin/social/* +!.cache/plugin/social/fonts # Local Netlify folder .netlify @@ -23,3 +21,4 @@ node_modules # Python .venv +.env diff --git a/Dockerfile b/Dockerfile index 4d9b9cc891..6e038ede9f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -57,9 +57,8 @@ WORKDIR /site COPY docs docs COPY theme theme COPY includes includes -COPY config/*.yml config/ -COPY config/layouts config/layouts -COPY config/.cache/plugin/social/fonts config/.cache/plugin/social/fonts +COPY *.yml . +COPY .cache/plugin/social/fonts .cache/plugin/social/fonts EXPOSE 8000 @@ -68,4 +67,4 @@ ENV MKDOCS_INHERIT mkdocs-production.yml HEALTHCHECK NONE ENTRYPOINT ["mkdocs"] -CMD ["serve", "--dev-addr=0.0.0.0:8000", "--config-file=config/mkdocs.en.yml"] +CMD ["serve", "--dev-addr=0.0.0.0:8000", "--config-file=mkdocs-production.yml"] diff --git a/config/.cache/plugin/social/fonts b/config/.cache/plugin/social/fonts deleted file mode 120000 index cabf5b9b97..0000000000 --- a/config/.cache/plugin/social/fonts +++ /dev/null @@ -1 +0,0 @@ -../../../../theme/assets/brand/fonts \ No newline at end of file diff --git a/config/mkdocs-offline.yml b/config/mkdocs-offline.yml deleted file mode 100644 index 4c1fe5c66d..0000000000 --- a/config/mkdocs-offline.yml +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright (c) 2023-2024 Jonah Aragon - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. - -INHERIT: mkdocs-common.yml - -# Disable any GitHub integrations -repo_url: "" -edit_uri_template: "" - -extra: - # Disable language switcher - alternate: false - offline: true - privacy_guides: - homepage: - hero: - buttons: - - name: - !ENV [ - HOMEPAGE_BUTTON_GET_STARTED_NAME, - "Start Your Privacy Journey", - ] - title: - !ENV [ - HOMEPAGE_BUTTON_GET_STARTED_TITLE, - "The first step of your privacy journey", - ] - link: basics/why-privacy-matters.html - class: md-button md-button--primary - - name: !ENV [HOMEPAGE_BUTTON_TOOLS_NAME, "Recommended Tools"] - title: - !ENV [ - HOMEPAGE_BUTTON_TOOLS_TITLE, - "Recommended privacy tools, services, and knowledge", - ] - link: tools.html - class: md-button - -theme: - features: - - navigation.tabs - - navigation.sections - - navigation.indexes - - content.tabs.link - - content.tooltips - - search.highlight - -plugins: - offline: - enabled: true - social: - enabled: false -# Edit the offline-mode navbar in mkdocs-common.yml diff --git a/config/mkdocs-production.yml b/config/mkdocs-production.yml deleted file mode 100644 index 0fd7a28565..0000000000 --- a/config/mkdocs-production.yml +++ /dev/null @@ -1,29 +0,0 @@ -INHERIT: mkdocs-common.yml - -plugins: - macros: {} - meta: {} - git-committers: - enabled: !ENV [GITCOMMITTERS, PRODUCTION, NETLIFY, false] - repository: privacyguides/privacyguides.org - branch: main - git-revision-date-localized: - enabled: !ENV [GITREVISIONDATE, PRODUCTION, NETLIFY, false] - exclude: - - index.md - fallback_to_build_date: true - optimize: - enabled: !ENV [OPTIMIZE, PRODUCTION, NETLIFY, false] - typeset: {} - social: - cards: !ENV [CARDS, PRODUCTION, NETLIFY, true] - cards_dir: assets/img/social - cards_layout_dir: config/layouts - cards_layout: page - # cards_layout: pride - -markdown_extensions: - material.extensions.preview: - sources: - exclude: - - tools.md diff --git a/config/mkdocs.es.yml b/config/mkdocs.es.yml deleted file mode 100644 index 70b14f3428..0000000000 --- a/config/mkdocs.es.yml +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 2022-2024 Jonah Aragon - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. - -INHERIT: !ENV [MKDOCS_INHERIT, mkdocs-common.yml] -docs_dir: "../i18n/es" -site_url: "https://www.privacyguides.org/es/" -site_dir: "../site/es" - -edit_uri_template: https://github.com/privacyguides/i18n/blob/main/i18n/es/{path}?plain=1 - -theme: - language: es - -markdown_extensions: - pymdownx.snippets: - auto_append: - - includes/abbreviations.es.txt diff --git a/config/mkdocs.fr.yml b/config/mkdocs.fr.yml deleted file mode 100644 index 43ce56b956..0000000000 --- a/config/mkdocs.fr.yml +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 2022-2024 Jonah Aragon - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. - -INHERIT: !ENV [MKDOCS_INHERIT, mkdocs-common.yml] -docs_dir: "../i18n/fr" -site_url: "https://www.privacyguides.org/fr/" -site_dir: "../site/fr" - -edit_uri_template: https://github.com/privacyguides/i18n/blob/main/i18n/fr/{path}?plain=1 - -theme: - language: fr - -markdown_extensions: - pymdownx.snippets: - auto_append: - - includes/abbreviations.fr.txt diff --git a/config/mkdocs.he.yml b/config/mkdocs.he.yml deleted file mode 100644 index dc0ba0ebd0..0000000000 --- a/config/mkdocs.he.yml +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) 2022-2024 Jonah Aragon - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. - -INHERIT: !ENV [MKDOCS_INHERIT, mkdocs-common.yml] -docs_dir: "../i18n/he" -site_url: "https://www.privacyguides.org/he/" -site_dir: "../site/he" - -edit_uri_template: https://github.com/privacyguides/i18n/blob/main/i18n/he/{path}?plain=1 - -extra_css: - - assets/stylesheets/extra.css?v=3.2.0 - - assets/stylesheets/lang-he.css?v=3.4.0 - -theme: - language: he - font: - text: Open Sans - code: Cousine - -markdown_extensions: - pymdownx.snippets: - auto_append: - - includes/abbreviations.he.txt diff --git a/config/mkdocs.it.yml b/config/mkdocs.it.yml deleted file mode 100644 index 326e89a3f0..0000000000 --- a/config/mkdocs.it.yml +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 2022-2024 Jonah Aragon - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. - -INHERIT: !ENV [MKDOCS_INHERIT, mkdocs-common.yml] -docs_dir: "../i18n/it" -site_url: "https://www.privacyguides.org/it/" -site_dir: "../site/it" - -edit_uri_template: https://github.com/privacyguides/i18n/blob/main/i18n/it/{path}?plain=1 - -theme: - language: it - -markdown_extensions: - pymdownx.snippets: - auto_append: - - includes/abbreviations.it.txt diff --git a/config/mkdocs.nl.yml b/config/mkdocs.nl.yml deleted file mode 100644 index 8c651e51d9..0000000000 --- a/config/mkdocs.nl.yml +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 2022-2024 Jonah Aragon - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. - -INHERIT: !ENV [MKDOCS_INHERIT, mkdocs-common.yml] -docs_dir: "../i18n/nl" -site_url: "https://www.privacyguides.org/nl/" -site_dir: "../site/nl" - -edit_uri_template: https://github.com/privacyguides/i18n/blob/main/i18n/nl/{path}?plain=1 - -theme: - language: nl - -markdown_extensions: - pymdownx.snippets: - auto_append: - - includes/abbreviations.nl.txt diff --git a/config/mkdocs.ru.yml b/config/mkdocs.ru.yml deleted file mode 100644 index f2bc604cac..0000000000 --- a/config/mkdocs.ru.yml +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (c) 2022-2024 Jonah Aragon - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. - -INHERIT: !ENV [MKDOCS_INHERIT, mkdocs-common.yml] -docs_dir: "../i18n/ru" -site_url: "https://www.privacyguides.org/ru/" -site_dir: "../site/ru" - -edit_uri_template: https://github.com/privacyguides/i18n/blob/main/i18n/ru/{path}?plain=1 - -extra_css: - - assets/stylesheets/extra.css?v=3.2.0 - - assets/stylesheets/lang-ru.css?v=3.13.0 - -theme: - language: ru - -markdown_extensions: - pymdownx.snippets: - auto_append: - - includes/abbreviations.ru.txt diff --git a/config/mkdocs.zh-Hant.yml b/config/mkdocs.zh-Hant.yml deleted file mode 100644 index cb6c180633..0000000000 --- a/config/mkdocs.zh-Hant.yml +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) 2022-2024 Jonah Aragon - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. - -INHERIT: !ENV [MKDOCS_INHERIT, mkdocs-common.yml] -docs_dir: "../i18n/zh-Hant" -site_url: "https://www.privacyguides.org/zh-Hant/" -site_dir: "../site/zh-Hant" - -edit_uri_template: https://github.com/privacyguides/i18n/blob/main/i18n/zh-Hant/{path}?plain=1 - -extra_css: - - assets/stylesheets/extra.css?v=3.2.0 - - assets/stylesheets/lang-zh-Hant.css?v=3.13.0 - -theme: - language: zh-Hant - font: - text: Noto Sans TC - code: Noto Sans TC - -markdown_extensions: - pymdownx.snippets: - auto_append: - - includes/abbreviations.zh-Hant.txt diff --git a/config/mkdocs.en.yml b/mkdocs-production.yml similarity index 78% rename from config/mkdocs.en.yml rename to mkdocs-production.yml index eb55c3f0fb..39b89a3352 100644 --- a/config/mkdocs.en.yml +++ b/mkdocs-production.yml @@ -18,10 +18,10 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -INHERIT: !ENV [MKDOCS_INHERIT, mkdocs-common.yml] -site_url: "https://www.privacyguides.org/en/" -site_dir: "../site/en" +INHERIT: mkdocs.yml -theme: - # ENGLISH ONLY: this logo needs to be set separately because the relative path is different - logo: ../theme/assets/brand/logos/svg/logo/privacy-guides-logo-notext-colorbg.svg +markdown_extensions: + material.extensions.preview: + sources: + exclude: + - tools.md diff --git a/config/mkdocs-common.yml b/mkdocs.yml similarity index 89% rename from config/mkdocs-common.yml rename to mkdocs.yml index 9e2f2a6aae..65cbdba9e6 100644 --- a/config/mkdocs-common.yml +++ b/mkdocs.yml @@ -18,9 +18,9 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -docs_dir: "../docs" -site_url: "https://www.privacyguides.org/" -site_dir: "../site" +docs_dir: !ENV [BUILD_DOCS_DIR, "docs"] +site_url: !ENV [BUILD_SITE_URL, "https://www.privacyguides.org/en/"] +site_dir: !ENV [BUILD_SITE_DIR, "site/en"] site_name: Privacy Guides site_description: @@ -28,11 +28,13 @@ site_description: SITE_DESCRIPTION, "Privacy Guides is your central privacy and security resource to protect yourself online.", ] -edit_uri_template: blob/main/docs/{path}?plain=1 +edit_uri_template: + !ENV [BUILD_EDIT_URI_TEMPLATE, "blob/main/docs/{path}?plain=1"] extra: generator: false - context: !ENV [CONTEXT, "production"] + context: !ENV [BUILD_CONTEXT, "production"] + offline: !ENV [BUILD_OFFLINE, false] deploy: !ENV DEPLOY_ID privacy_guides: footer: @@ -80,7 +82,11 @@ extra: HOMEPAGE_BUTTON_GET_STARTED_TITLE, "The first step of your privacy journey", ] - link: basics/why-privacy-matters/ + link: + !ENV [ + HOMEPAGE_BUTTON_GET_STARTED_LINK, + "basics/why-privacy-matters/", + ] class: md-button md-button--primary - name: !ENV [HOMEPAGE_BUTTON_TOOLS_NAME, "Recommended Tools"] title: @@ -88,7 +94,7 @@ extra: HOMEPAGE_BUTTON_TOOLS_TITLE, "Recommended privacy tools, services, and knowledge", ] - link: tools/ + link: !ENV [HOMEPAGE_BUTTON_TOOLS_LINK, "tools/"] class: md-button cta: - title: @@ -161,6 +167,7 @@ extra: notice: !ENV TRANSLATION_NOTICE cta: !ENV [TRANSLATION_NOTICE_CTA, "Visit Crowdin"] language: !ENV SITE_LANGUAGE_ENGLISH + translation_stylesheet: !ENV [TRANSLATION_STYLESHEET] social: - icon: simple/mastodon link: https://mastodon.neat.computer/@privacyguides @@ -247,17 +254,17 @@ extra: - accept - manage -repo_url: https://github.com/privacyguides/privacyguides.org +repo_url: + !ENV [BUILD_REPO_URL, "https://github.com/privacyguides/privacyguides.org"] repo_name: "" theme: name: material - language: en - custom_dir: ../theme - logo: ../../theme/assets/brand/logos/svg/logo/privacy-guides-logo-notext-colorbg.svg + language: !ENV [BUILD_THEME_LANGUAGE, "en"] + custom_dir: theme font: - text: Public Sans - code: DM Mono + text: !ENV [BUILD_THEME_FONT_TEXT, "Public Sans"] + code: !ENV [BUILD_THEME_FONT_CODE, "DM Mono"] palette: - media: "(prefers-color-scheme)" scheme: default @@ -300,14 +307,36 @@ extra_javascript: - assets/javascripts/feedback.js?v=1 watch: - - ../theme - - ../includes - - mkdocs-common.yml + - theme + - includes plugins: tags: {} search: {} privacy: {} + group: + enabled: !ENV [BUILD_INSIDERS, false] + plugins: + macros: {} + meta: {} + git-committers: + enabled: !ENV [GITCOMMITTERS, PRODUCTION, NETLIFY, false] + repository: privacyguides/privacyguides.org + branch: main + git-revision-date-localized: + enabled: !ENV [GITREVISIONDATE, PRODUCTION, NETLIFY, false] + exclude: + - index.md + fallback_to_build_date: true + optimize: + enabled: !ENV [OPTIMIZE, PRODUCTION, NETLIFY, false] + typeset: {} + social: + cards: !ENV [CARDS, true] + cards_dir: assets/img/social + cards_layout_dir: theme/layouts + cards_layout: page + # cards_layout: pride markdown_extensions: admonition: {} @@ -328,7 +357,7 @@ markdown_extensions: pymdownx.tilde: {} pymdownx.snippets: auto_append: - - includes/abbreviations.en.txt + - !ENV [BUILD_ABBREVIATIONS, "includes/abbreviations.en.txt"] pymdownx.tasklist: custom_checkbox: true attr_list: {} diff --git a/config/layouts/home.yml b/theme/layouts/home.yml similarity index 96% rename from config/layouts/home.yml rename to theme/layouts/home.yml index 4c476c0215..d0e29bf956 100644 --- a/config/layouts/home.yml +++ b/theme/layouts/home.yml @@ -30,7 +30,7 @@ definitions: {{ page.meta.get("description", config.site_description) or "" }} - &logo >- - {{ config.docs_dir }}/{{ config.theme.logo }} + theme/assets/brand/logos/svg/logo/privacy-guides-logo-notext-colorbg.svg # Meta tags tags: diff --git a/config/layouts/page.yml b/theme/layouts/page.yml similarity index 97% rename from config/layouts/page.yml rename to theme/layouts/page.yml index 6396a0d8ee..627bb3c51d 100644 --- a/config/layouts/page.yml +++ b/theme/layouts/page.yml @@ -63,8 +63,8 @@ definitions: - &logo >- {%- if page.meta.cover -%} theme/assets/brand/logos/svg/logo/privacy-guides-logo-notext.svg - {%- elif config.theme.logo -%} - {{ config.docs_dir }}/{{ config.theme.logo }} + {%- else -%} + theme/assets/brand/logos/svg/logo/privacy-guides-logo-notext-colorbg.svg {%- endif -%} # Meta tags diff --git a/config/layouts/pride.yml b/theme/layouts/pride.yml similarity index 100% rename from config/layouts/pride.yml rename to theme/layouts/pride.yml diff --git a/theme/main.html b/theme/main.html index c29ae82750..dec74e111c 100644 --- a/theme/main.html +++ b/theme/main.html @@ -71,6 +71,12 @@ {% endblock %} {% block extrahead %} + + + {% if config.extra.privacy_guides.translation_stylesheet %} + + {% endif %} + {% if config.extra.context == "production" %}