diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 419ed7717c..4af8cba3bd 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -74,6 +74,10 @@ jobs: MKDOCS_ENABLE_PLUGIN_GIT_DATES: true MKDOCS_ENABLE_PLUGIN_PRIVACY: true MKDOCS_ENABLE_PLUGIN_RSS: true + MKDOCS_ENABLE_PLUGIN_SOCIAL: true + MKDOCS_ENABLE_PLUGIN_SOCIAL_CARDS: true + MKDOCS_ENABLE_PLUGIN_TAGS: true + MKDOCS_ENABLE_THEME_INSIDERS: true MKDOCS_GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }} - name: Setup Pages diff --git a/.github/workflows/links_checker.yml b/.github/workflows/links_checker.yml index 8589672c2a..e25ec2c29e 100644 --- a/.github/workflows/links_checker.yml +++ b/.github/workflows/links_checker.yml @@ -40,6 +40,7 @@ jobs: mkdocs build --clean --config-file mkdocs.yml --quiet --strict env: MKDOCS_ENABLE_PLUGIN_RSS: true + MKDOCS_ENABLE_THEME_INSIDERS: true - name: Run linkcheckr run: | diff --git a/.github/workflows/pr_checker_build.yml b/.github/workflows/pr_checker_build.yml index 46b39e0f42..151e443608 100644 --- a/.github/workflows/pr_checker_build.yml +++ b/.github/workflows/pr_checker_build.yml @@ -50,11 +50,13 @@ jobs: if [[ -z "${GH_TOKEN_MATERIAL_INSIDERS}" ]]; then echo "::warning:: L'accès aux token est réservé aux comptes avec droits d'écriture sur le dépôt. La version gratuite du thème est donc utilisée sans mots-clés, etc.)" python -m pip install -U -r requirements-free.txt - echo "MKDOCS_CONFIG_FILENAME=mkdocs-free.yml" >> $GITHUB_ENV + echo "MKDOCS_CONFIG_FILENAME=mkdocs.yml" >> $GITHUB_ENV + echo "MKDOCS_ENABLE_THEME_INSIDERS=false" >> $GITHUB_ENV else # install insiders version using token python -m pip install -U -r requirements-insiders.txt echo "MKDOCS_CONFIG_FILENAME=mkdocs.yml" >> $GITHUB_ENV + echo "MKDOCS_ENABLE_THEME_INSIDERS=true" >> $GITHUB_ENV fi - name: Cache build dependencies (external assets downloaded) diff --git a/config/plugins_glightbox.yml b/config/plugins_glightbox.yml deleted file mode 100644 index 42711a9ac0..0000000000 --- a/config/plugins_glightbox.yml +++ /dev/null @@ -1,13 +0,0 @@ -glightbox: - auto_caption: true - caption_position: bottom - draggable: true - effect: zoom - height: auto - skip_classes: - - img-rdp-news-thumb - - emojione - - twemoji - touchNavigation: true - width: 90% - zoomable: true diff --git a/config/plugins_rss.yml b/config/plugins_rss.yml deleted file mode 100644 index d5000140a7..0000000000 --- a/config/plugins_rss.yml +++ /dev/null @@ -1,21 +0,0 @@ -rss: - abstract_chars_count: 500 - categories: - - categories - - tags - comments_path: "#__comments" - date_from_meta: - as_creation: "date" - as_update: false - datetime_format: "%Y-%m-%d %H:%M" - default_timezone: Europe/Paris - default_time: "14:00" - enabled: !ENV [MKDOCS_ENABLE_PLUGIN_RSS, false] - image: "https://cdn.geotribu.fr/img/internal/charte/geotribu_logo_64x64.png" - length: 50 - match_path: "(articles|rdp)/.*" - pretty_print: false - url_parameters: - utm_source: "rss-feed" - utm_medium: "RSS" - utm_campaign: "feed-syndication" diff --git a/hooks/mkdocs/G003_social_cards_adapter.py b/hooks/mkdocs/G003_social_cards_adapter.py index 8e09f105d5..d8588d4aa3 100644 --- a/hooks/mkdocs/G003_social_cards_adapter.py +++ b/hooks/mkdocs/G003_social_cards_adapter.py @@ -26,9 +26,12 @@ # standard library import logging +from os import getenv from pathlib import Path from typing import Optional +from geotribu_cli.utils.str2bool import str2bool + # Mkdocs from material.plugins.social.plugin import SocialPlugin from mkdocs.config.defaults import MkDocsConfig @@ -71,7 +74,9 @@ def on_page_markdown( return # check si c'est la version Insiders (payante) ou la version Communauté (gratuite) du thème - is_insiders = config.theme.get("insiders_flavor") + is_insiders = config.theme.get( + "insiders_flavor", str2bool(getenv("MKDOCS_ENABLE_THEME_INSIDERS", False)) + ) # vérifie que le plugin social est bien installé et configuré if not config.plugins.get("material/social"): diff --git a/mkdocs.yml b/mkdocs.yml index 4990c4368f..5d46a38307 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -26,101 +26,169 @@ hooks: # Plugins plugins: - - awesome-pages - - exclude: - glob: - - "*/templates/*" - - "*.yml" - - git-authors: - enabled: !ENV [MKDOCS_ENABLE_PLUGIN_GIT_AUTHORS, false] - exclude: - - index.md - show_contribution: true - - git-committers: - enabled: !ENV [MKDOCS_ENABLE_PLUGIN_GIT_COMMITTERS, false] - repository: geotribu/website - branch: master - docs_path: content/ - cache_dir: - !ENV [ - MKDOCS_PLUGIN_GIT_COMMITTERS_CACHE_DIR, - .cache/plugins/git-committers/, - ] - - git-revision-date-localized: - enabled: !ENV [MKDOCS_ENABLE_PLUGIN_GIT_DATES, false] - enable_creation_date: true - fallback_to_build_date: true - locale: fr - - meta: - meta_file: "content/**/.meta.yml" - - minify: - minify_css: true - css_files: - - theme/assets/stylesheets/extra.css - - theme/assets/stylesheets/homepage.css - minify_html: true - htmlmin_opts: - remove_comments: true - - search: - lang: fr - - macros: - include_dir: content/toc_nav_ignored/snippets - - tags: - enabled: !ENV [MKDOCS_ENABLE_PLUGIN_TAGS, true] - tags_file: tags.md - tags_compare: !!python/name:material.plugins.tags.casefold - tags_pages_compare: !!python/name:material.plugins.tags.page_url - - termynal - - privacy: - enabled: !ENV [MKDOCS_ENABLE_PLUGIN_PRIVACY, true] - cache_dir: - !ENV [MKDOCS_PLUGIN_PRIVACY_EXTERNAL_CACHE_DIR, .cache/plugins/privacy] - links_attr_map: - target: _blank - assets_exclude: - # mandatory - https://squidfunk.github.io/mkdocs-material/setup/ensuring-data-privacy/ - - cdn.jsdelivr.net/npm/mathjax@3/* - - giscus.app/* - # geotribu - - cdn.geotribu.fr/images/* - - cdn.geotribu.fr/img/* - - geotribu.net/* - - www.geotribu.net/* - - ks356007.kimsufi.com/* - # external - - baliz-geospatial.com/images/mediatheque/2008-08/* - - cdn.jsdelivr.net/**/*/twemoji* - - cdnjs.cloudflare.com/ajax/libs/twemoji/* - - github.com/**/*.gif - - i.imgur.com/* - - raw.githubusercontent.com/* - - sondekla.com/buid/widget/* - - cdnjs.cloudflare.com/ajax/libs/twemoji/* - - twemoji.maxcdn.com/* - - upload.wikimedia.org/* - - user-images.githubusercontent.com/**/*.gif - # to remove later: - - dev.openstreetmap.org/* - - www.portailsig.org/assets/images/* - - 88.191.39.115/* - - cdn.theatlanticcities.com/img/* - - boundlessgeo.com/* - - i3.codeplex.com/* - - drfhlmcehrc34.cloudfront.net/* - - social: - enabled: !ENV [MKDOCS_ENABLE_PLUGIN_SOCIAL, true] - cache_dir: !ENV [MKDOCS_PLUGIN_SOCIAL_CACHE_DIR, .cache/plugins/social] - cards: !ENV [MKDOCS_ENABLE_PLUGIN_SOCIAL_CARDS, true] - cards_exclude: - - index.md - - toc_nav_ignored/*.md - cards_layout_options: - background_color: "#00000000" - background_image: content/theme/assets/images/geotribu/background_geotribu.png - color: "#3e93a7" - font_family: Ubuntu - -# Theme + # -- MINIMAL -- + - group: + enabled: true + plugins: + - awesome-pages + - exclude: + glob: + - "*/templates/*" + - "*.yml" + - macros: + include_dir: content/toc_nav_ignored/snippets + + # -- COMMON -- + - group: + enabled: !ENV [MKDOCS_ENABLE_THEME_COMMON, true] + plugins: + - git-authors: + enabled: !ENV [MKDOCS_ENABLE_PLUGIN_GIT_AUTHORS, false] + exclude: + - index.md + show_contribution: true + - git-revision-date-localized: + enabled: !ENV [MKDOCS_ENABLE_PLUGIN_GIT_DATES, false] + enable_creation_date: true + fallback_to_build_date: true + locale: fr + - glightbox: + auto_caption: true + caption_position: bottom + draggable: true + effect: zoom + height: auto + skip_classes: + - img-rdp-news-thumb + - emojione + - twemoji + touchNavigation: true + width: 90% + zoomable: true + - minify: + minify_css: true + css_files: + - theme/assets/stylesheets/extra.css + - theme/assets/stylesheets/homepage.css + minify_html: true + htmlmin_opts: + remove_comments: true + - rss: + abstract_chars_count: 500 + categories: + - categories + - tags + comments_path: "#__comments" + date_from_meta: + as_creation: "date" + as_update: false + datetime_format: "%Y-%m-%d %H:%M" + default_timezone: Europe/Paris + default_time: "14:00" + enabled: !ENV [MKDOCS_ENABLE_PLUGIN_RSS, false] + image: "https://cdn.geotribu.fr/img/internal/charte/geotribu_logo_64x64.png" + length: 50 + match_path: "(articles|rdp)/.*" + pretty_print: false + url_parameters: + utm_source: "rss-feed" + utm_medium: "RSS" + utm_campaign: "feed-syndication" + - search: + lang: fr + - termynal + + # -- FREE -- + - group: + enabled: !ENV [MKDOCS_ENABLE_THEME_FREE, false] + plugins: + - social: + enabled: !ENV [MKDOCS_ENABLE_PLUGIN_SOCIAL, true] + cache_dir: + !ENV [MKDOCS_PLUGIN_SOCIAL_CACHE_DIR, .cache/plugins/social] + cards: !ENV [MKDOCS_ENABLE_PLUGIN_SOCIAL_CARDS, true] + cards_layout_options: + font_family: Ubuntu + - tags: + enabled: !ENV [MKDOCS_ENABLE_PLUGIN_TAGS, true] + tags_file: tags.md + + # -- INSIDERS -- + - group: + enabled: !ENV [MKDOCS_ENABLE_THEME_INSIDERS, false] + plugins: + - git-committers: + enabled: !ENV [MKDOCS_ENABLE_PLUGIN_GIT_COMMITTERS, false] + repository: geotribu/website + branch: master + docs_path: content/ + cache_dir: + !ENV [ + MKDOCS_PLUGIN_GIT_COMMITTERS_CACHE_DIR, + .cache/plugins/git-committers/, + ] + - meta: + meta_file: "content/**/.meta.yml" + - privacy: + enabled: !ENV [MKDOCS_ENABLE_PLUGIN_PRIVACY, true] + cache_dir: + !ENV [ + MKDOCS_PLUGIN_PRIVACY_EXTERNAL_CACHE_DIR, + .cache/plugins/privacy, + ] + links_attr_map: + target: _blank + assets_exclude: + # mandatory - https://squidfunk.github.io/mkdocs-material/setup/ensuring-data-privacy/ + - cdn.jsdelivr.net/npm/mathjax@3/* + - giscus.app/* + # geotribu + - cdn.geotribu.fr/images/* + - cdn.geotribu.fr/img/* + - geotribu.net/* + - www.geotribu.net/* + - ks356007.kimsufi.com/* + # external + - baliz-geospatial.com/images/mediatheque/2008-08/* + - cdn.jsdelivr.net/**/*/twemoji* + - cdnjs.cloudflare.com/ajax/libs/twemoji/* + - github.com/**/*.gif + - i.imgur.com/* + - raw.githubusercontent.com/* + - sondekla.com/buid/widget/* + - cdnjs.cloudflare.com/ajax/libs/twemoji/* + - twemoji.maxcdn.com/* + - upload.wikimedia.org/* + - user-images.githubusercontent.com/**/*.gif + # to remove later: + - dev.openstreetmap.org/* + - www.portailsig.org/assets/images/* + - 88.191.39.115/* + - cdn.theatlanticcities.com/img/* + - boundlessgeo.com/* + - i3.codeplex.com/* + - drfhlmcehrc34.cloudfront.net/* + - social: + enabled: !ENV [MKDOCS_ENABLE_PLUGIN_SOCIAL, true] + cache_dir: + !ENV [MKDOCS_PLUGIN_SOCIAL_CACHE_DIR, .cache/plugins/social] + cards: !ENV [MKDOCS_ENABLE_PLUGIN_SOCIAL_CARDS, true] + cards_exclude: + - index.md + - toc_nav_ignored/*.md + cards_layout_options: + background_color: "#00000000" + background_image: content/theme/assets/images/geotribu/background_geotribu.png + color: "#3e93a7" + font_family: Ubuntu + - tags: + enabled: !ENV [MKDOCS_ENABLE_PLUGIN_TAGS, true] + tags_file: tags.md + tags_compare: !!python/name:material.plugins.tags.casefold + tags_pages_compare: + !!python/name:material.plugins.tags.page_url # Theme + + theme: name: "material" insiders_flavor: true