Skip to content

Commit

Permalink
improve(hook): détermine s'il s'agit de l'édition Insiders à partir d…
Browse files Browse the repository at this point in the history
…e la version du thème (#1140)
  • Loading branch information
Guts authored Jun 15, 2024
2 parents 8afe7bf + 3f2bb19 commit a9f48db
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
9 changes: 4 additions & 5 deletions hooks/mkdocs/G003_social_cards_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from typing import Optional

# Mkdocs
from material import __version__ as material_version
from material.plugins.social.plugin import SocialPlugin
from mkdocs.config.defaults import MkDocsConfig
from mkdocs.plugins import event_priority
Expand All @@ -43,6 +44,9 @@
logger = logging.getLogger("mkdocs")
hook_name = Path(__file__).stem

# check si c'est la version Insiders (payante) ou la version Communauté (gratuite) du thème
is_insiders = "insiders" in material_version

# ###########################################################################
# ########## Functions #############
# ##################################
Expand All @@ -66,9 +70,6 @@ def on_page_markdown(
Returns:
Markdown source text of page as string
"""
# check si c'est la version Insiders (payante) ou la version Communauté (gratuite) du thème
is_insiders = config.theme.get("insiders_flavor")

# vérifie que le plugin social est bien installé et configuré
if not config.plugins.get("material/social"):
logger.warning(
Expand Down Expand Up @@ -111,8 +112,6 @@ def on_page_markdown(
)
elif is_insiders:
cards_layout = social_plugin.config.cards_layout
else:
pass

# indique l'URL de l'image qui sera utilisée par le plugin RSS
page.meta["image"] = social_card_url
Expand Down
1 change: 0 additions & 1 deletion mkdocs-free.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ plugins:
# Theme
theme:
name: "material"
insiders_flavor: false
custom_dir: "./content/theme/"
favicon: theme/assets/images/geotribu/logo_geotribu.png

Expand Down
1 change: 0 additions & 1 deletion mkdocs-minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ plugins:
# Theme
theme:
name: "material"
insiders_flavor: false
custom_dir: "./content/theme/"
favicon: theme/assets/images/geotribu/logo_geotribu.png

Expand Down
1 change: 0 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ plugins:
# Theme
theme:
name: "material"
insiders_flavor: true
custom_dir: "./content/theme/"
favicon: theme/assets/images/geotribu/logo_geotribu.png

Expand Down

0 comments on commit a9f48db

Please sign in to comment.