1313# 3rd party
1414from mkdocs .config .defaults import MkDocsConfig
1515from mkdocs .plugins import get_plugin_logger
16- from mkdocs .structure .pages import Page
1716
1817# package
1918from mkdocs_rss_plugin .constants import MKDOCS_LOGGER_NAME
@@ -263,17 +262,17 @@ def get_social_cards_cache_dir(self, mkdocs_config: MkDocsConfig) -> Path:
263262 return self .social_cards_cache_dir
264263
265264 def get_social_card_build_path_for_page (
266- self , mkdocs_page : Page , mkdocs_site_dir : Optional [str ] = None
265+ self , mkdocs_page : MkdocsPageSubset , mkdocs_site_dir : Optional [str ] = None
267266 ) -> Optional [Path ]:
268267 """Get social card path in Mkdocs build dir for a specific page.
269268
270269 Args:
271- mkdocs_page (Page) : Mkdocs page object.
272- mkdocs_site_dir (Optional[str], optional) : Mkdocs build site dir. If None, the
270+ mkdocs_page: Mkdocs page object.
271+ mkdocs_site_dir: Mkdocs build site dir. If None, the
273272 'class.mkdocs_site_build_dir' is used. is Defaults to None.
274273
275274 Returns:
276- Path: path to the image once published
275+ path to the image once published
277276 """
278277 if mkdocs_site_dir is None and self .mkdocs_site_build_dir :
279278 mkdocs_site_dir = self .mkdocs_site_build_dir
@@ -285,12 +284,12 @@ def get_social_card_build_path_for_page(
285284 ):
286285 expected_built_card_path = Path (
287286 f"{ mkdocs_site_dir } /{ self .social_cards_assets_dir } /"
288- f"{ Path (mkdocs_page .file . dest_uri ).parent } .png"
287+ f"{ Path (mkdocs_page .dest_uri ).parent } .png"
289288 )
290289 else :
291290 expected_built_card_path = Path (
292291 f"{ mkdocs_site_dir } /{ self .social_cards_assets_dir } /"
293- f"{ Path (mkdocs_page .file . src_uri ).with_suffix ('.png' )} "
292+ f"{ Path (mkdocs_page .src_uri ).with_suffix ('.png' )} "
294293 )
295294
296295 if expected_built_card_path .is_file ():
@@ -304,7 +303,9 @@ def get_social_card_build_path_for_page(
304303 )
305304 return None
306305
307- def get_social_card_cache_path_for_page (self , mkdocs_page : Page ) -> Optional [Path ]:
306+ def get_social_card_cache_path_for_page (
307+ self , mkdocs_page : MkdocsPageSubset
308+ ) -> Optional [Path ]:
308309 """Get social card path in social plugin cache folder for a specific page.
309310
310311 Note:
@@ -315,10 +316,10 @@ def get_social_card_cache_path_for_page(self, mkdocs_page: Page) -> Optional[Pat
315316 any exposed matching criteria.
316317
317318 Args:
318- mkdocs_page (Page) : Mkdocs page object.
319+ mkdocs_page: Mkdocs page object.
319320
320321 Returns:
321- Path: path to the image in local cache folder if it exists
322+ path to the image in local cache folder if it exists
322323 """
323324 if self .IS_INSIDERS :
324325
@@ -328,11 +329,11 @@ def get_social_card_cache_path_for_page(self, mkdocs_page: Page) -> Optional[Pat
328329 and self .integration_material_blog .is_page_a_blog_post (mkdocs_page )
329330 ):
330331 expected_cached_card_path = self .social_cards_cache_dir .joinpath (
331- f"assets/images/social/{ Path (mkdocs_page .file . dest_uri ).parent } .png"
332+ f"assets/images/social/{ Path (mkdocs_page .dest_uri ).parent } .png"
332333 )
333334 else :
334335 expected_cached_card_path = self .social_cards_cache_dir .joinpath (
335- f"assets/images/social/{ Path (mkdocs_page .file . src_uri ).with_suffix ('.png' )} "
336+ f"assets/images/social/{ Path (mkdocs_page .src_uri ).with_suffix ('.png' )} "
336337 )
337338
338339 if expected_cached_card_path .is_file ():
0 commit comments