Skip to content

Commit 7d0f759

Browse files
committed
Removed hack in blog plugin for MkDocs < 1.5.3
1 parent 50c273c commit 7d0f759

File tree

2 files changed

+0
-48
lines changed

2 files changed

+0
-48
lines changed

material/plugins/blog/plugin.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -163,30 +163,6 @@ def on_nav(self, nav, *, config, files):
163163
if not self.config.enabled:
164164
return
165165

166-
# Hack: since MkDocs will always create a page for the entrypoint even
167-
# though we already created it in `on_files`, we must replace the page
168-
# that MkDocs created with the entrypoint we already have on our hands.
169-
# Hopefully, this hack can be removed soon - see https://t.ly/9nehI
170-
page = self.blog.file.page
171-
self._attach_at(page.parent, page, self.blog)
172-
173-
# Hack: update page instances in navigation - this can also be removed
174-
# once an already open pull request is merged - see https://t.ly/9C_Kz
175-
for page in [self.blog, *self.blog.posts, *self.blog.views]:
176-
assert isinstance(page, Page)
177-
178-
# Check if the page that we generated is identical to the page that
179-
# is associated with the file - if it is, we're good
180-
temp = page.file.page
181-
if not temp or temp == page:
182-
continue
183-
184-
# If not, MkDocs overwrote our page with a new instance, which we
185-
# need to replace with the one we generated
186-
page.file.page = page
187-
for items in [self._resolve_siblings(page, nav), nav.pages]:
188-
items[items.index(temp)] = page
189-
190166
# If we're not building a standalone blog, the entrypoint will always
191167
# have a parent when it is included in the navigation. The parent is
192168
# essential to correctly resolve the location where the archive and

src/plugins/blog/plugin.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -163,30 +163,6 @@ def on_nav(self, nav, *, config, files):
163163
if not self.config.enabled:
164164
return
165165

166-
# Hack: since MkDocs will always create a page for the entrypoint even
167-
# though we already created it in `on_files`, we must replace the page
168-
# that MkDocs created with the entrypoint we already have on our hands.
169-
# Hopefully, this hack can be removed soon - see https://t.ly/9nehI
170-
page = self.blog.file.page
171-
self._attach_at(page.parent, page, self.blog)
172-
173-
# Hack: update page instances in navigation - this can also be removed
174-
# once an already open pull request is merged - see https://t.ly/9C_Kz
175-
for page in [self.blog, *self.blog.posts, *self.blog.views]:
176-
assert isinstance(page, Page)
177-
178-
# Check if the page that we generated is identical to the page that
179-
# is associated with the file - if it is, we're good
180-
temp = page.file.page
181-
if not temp or temp == page:
182-
continue
183-
184-
# If not, MkDocs overwrote our page with a new instance, which we
185-
# need to replace with the one we generated
186-
page.file.page = page
187-
for items in [self._resolve_siblings(page, nav), nav.pages]:
188-
items[items.index(temp)] = page
189-
190166
# If we're not building a standalone blog, the entrypoint will always
191167
# have a parent when it is included in the navigation. The parent is
192168
# essential to correctly resolve the location where the archive and

0 commit comments

Comments
 (0)