Skip to content

Commit 301793c

Browse files
authored
improve(integrations): refine some logs about Material integrations (#406)
2 parents 535702c + cf19489 commit 301793c

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed

mkdocs_rss_plugin/integrations/theme_material_blog_plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,14 @@ def is_page_a_blog_post(self, mkdocs_page: Post | MkdocsPageSubset) -> bool:
142142
bool: True if the given page is a Material Blog post.
143143
"""
144144
if self.IS_ENABLED and isinstance(mkdocs_page, Post):
145-
logger.info(
145+
logger.debug(
146146
f"page '{mkdocs_page.file.src_uri}' identified as Material Blog post."
147147
)
148148
return True
149149
elif isinstance(mkdocs_page, MkdocsPageSubset) and Path(
150150
mkdocs_page.src_uri
151151
).is_relative_to(self.blog_plugin_cfg.config.blog_dir):
152-
logger.info(
152+
logger.debug(
153153
f"page '{mkdocs_page.src_uri}' identified as Material Blog post "
154154
f"by src_uri matching."
155155
)

mkdocs_rss_plugin/integrations/theme_material_social_plugin.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,16 @@ def get_social_card_cache_path_for_page(
336336
self.integration_material_blog.IS_BLOG_PLUGIN_ENABLED
337337
and self.integration_material_blog.is_page_a_blog_post(mkdocs_page)
338338
):
339+
logger.debug(
340+
f"Looking for social card in cache for blog post: {mkdocs_page.src_uri}"
341+
)
339342
expected_cached_card_path = self.social_cards_cache_dir.joinpath(
340343
f"assets/images/social/{Path(mkdocs_page.dest_uri).parent}.png"
341344
)
342345
else:
346+
logger.debug(
347+
f"Looking for social card in cache for page: {mkdocs_page.src_uri}"
348+
)
343349
expected_cached_card_path = self.social_cards_cache_dir.joinpath(
344350
f"assets/images/social/{Path(mkdocs_page.src_uri).with_suffix('.png')}"
345351
)

mkdocs_rss_plugin/util.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,9 @@ def load_images_for_pages(
571571
page_info._mkdocs_page_ref
572572
and id(page_info._mkdocs_page_ref) not in processed_refs
573573
):
574-
logger.debug(f"Get image for '{page_info.title}'")
574+
logger.debug(
575+
f"Get image for '{page_info.title}' ({page_info.abs_path})"
576+
)
575577
page_info.image = self.get_image(
576578
in_page=page_info._mkdocs_page_ref, base_url=base_url
577579
)

tests/fixtures/mkdocs_item_image_social_cards_blog_directory_url_disabled.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ site_url: https://guts.github.io/mkdocs-rss-plugin
55
use_directory_urls: false
66

77
plugins:
8-
- blog:
9-
blog_dir: blog
10-
authors_profiles: true
11-
- rss:
12-
match_path: blog/posts/.*
13-
- social:
14-
enabled: true
15-
cards: true
8+
- blog:
9+
blog_dir: blog
10+
authors_profiles: true
11+
- rss:
12+
match_path: blog/posts/.*
13+
pretty_print: true
14+
- social:
15+
enabled: true
16+
cards: true
1617

1718
theme:
18-
name: material
19+
name: material

0 commit comments

Comments
 (0)