File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -250,10 +250,26 @@ def get_social_cards_cache_dir(self, mkdocs_config: MkDocsConfig) -> Path:
250250 Path: The cache dir if the theme material and the plugin social cards is enabled.
251251 """
252252 social_plugin_cfg = mkdocs_config .plugins .get ("material/social" )
253- self .social_cards_cache_dir = Path (social_plugin_cfg .config .cache_dir ).resolve ()
253+
254+ if (
255+ Path (social_plugin_cfg .config .cache_dir )
256+ .resolve ()
257+ .is_relative_to (Path (mkdocs_config .config_file_path ).parent .resolve ())
258+ ):
259+ self .social_cards_cache_dir = Path (
260+ social_plugin_cfg .config .cache_dir
261+ ).resolve ()
262+ else :
263+ self .social_cards_cache_dir = (
264+ Path (mkdocs_config .config_file_path )
265+ .parent .resolve ()
266+ .joinpath (social_plugin_cfg .config .cache_dir )
267+ )
254268
255269 logger .debug (
256- "Material Social cards cache folder: " f"{ self .social_cards_cache_dir } ."
270+ "Material Social cards cache folder: "
271+ f"{ self .social_cards_cache_dir } . "
272+ f"Already exists: { self .social_cards_cache_dir .is_dir ()} "
257273 )
258274
259275 return self .social_cards_cache_dir
You can’t perform that action at this time.
0 commit comments