File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 77# standard library
88from functools import lru_cache
99from pathlib import Path
10+ from typing import Union
1011
1112# 3rd party
1213from mkdocs .config .defaults import MkDocsConfig
2627 from material .plugins .blog .structure import Post
2728
2829except ImportError :
29- material_version = None
30+ material_version = BlogPlugin = Post = None
3031
3132
3233# ############################################################################
@@ -132,16 +133,16 @@ def author_name_from_id(self, author_id: str) -> str:
132133 )
133134 return author_id
134135
135- def is_page_a_blog_post (self , mkdocs_page : Post | MkdocsPageSubset ) -> bool :
136+ def is_page_a_blog_post (self , mkdocs_page : Union [ " Post" , MkdocsPageSubset ] ) -> bool :
136137 """Identifies if the given page is part of Material Blog.
137138
138139 Args:
139- mkdocs_page (Page) : page to identify
140+ mkdocs_page: page to identify
140141
141142 Returns:
142- bool: True if the given page is a Material Blog post.
143+ True if the given page is a Material Blog post.
143144 """
144- if self .IS_ENABLED and isinstance (mkdocs_page , Post ):
145+ if self .IS_ENABLED and Post is not None and isinstance (mkdocs_page , Post ):
145146 logger .debug (
146147 f"page '{ mkdocs_page .file .src_uri } ' identified as Material Blog post."
147148 )
You can’t perform that action at this time.
0 commit comments