Skip to content

Commit fc566cf

Browse files
committed
Fixed further regression in blog plugin navigation
1 parent 5e42517 commit fc566cf

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

material/plugins/blog/plugin.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from mkdocs.structure.files import File, Files, InclusionLevel
3535
from mkdocs.structure.nav import Navigation, Section
3636
from mkdocs.structure.pages import Page
37-
from mkdocs.utils import get_relative_url
37+
from mkdocs.utils import copy_file, get_relative_url
3838
from paginate import Page as Pagination
3939
from shutil import rmtree
4040
from tempfile import mkdtemp
@@ -225,10 +225,6 @@ def on_nav(self, nav, *, config, files):
225225
for at in range(1, len(view.pages)):
226226
self._attach_at(view.parent, view, view.pages[at])
227227

228-
# Replace source file system path
229-
view.pages[at].file.src_uri = view.file.src_uri
230-
view.pages[at].file.abs_src_path = view.file.abs_src_path
231-
232228
# Prepare post for rendering (run later) - allow other plugins to alter
233229
# the contents or metadata of a post before it is rendered and make sure
234230
# that the post includes a separator, which is essential for rendering
@@ -640,6 +636,9 @@ def _generate_pages(self, view: View, config: MkDocsConfig, files: Files):
640636
file = self._path_to_file(path, config)
641637
files.append(file)
642638

639+
# Copy file to temporary directory
640+
copy_file(view.file.abs_src_path, file.abs_src_path)
641+
643642
# Create view and attach to previous page
644643
if not isinstance(file.page, View):
645644
yield View(None, file, config)

src/plugins/blog/plugin.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from mkdocs.structure.files import File, Files, InclusionLevel
3535
from mkdocs.structure.nav import Navigation, Section
3636
from mkdocs.structure.pages import Page
37-
from mkdocs.utils import get_relative_url
37+
from mkdocs.utils import copy_file, get_relative_url
3838
from paginate import Page as Pagination
3939
from shutil import rmtree
4040
from tempfile import mkdtemp
@@ -225,10 +225,6 @@ def on_nav(self, nav, *, config, files):
225225
for at in range(1, len(view.pages)):
226226
self._attach_at(view.parent, view, view.pages[at])
227227

228-
# Replace source file system path
229-
view.pages[at].file.src_uri = view.file.src_uri
230-
view.pages[at].file.abs_src_path = view.file.abs_src_path
231-
232228
# Prepare post for rendering (run later) - allow other plugins to alter
233229
# the contents or metadata of a post before it is rendered and make sure
234230
# that the post includes a separator, which is essential for rendering
@@ -640,6 +636,9 @@ def _generate_pages(self, view: View, config: MkDocsConfig, files: Files):
640636
file = self._path_to_file(path, config)
641637
files.append(file)
642638

639+
# Copy file to temporary directory
640+
copy_file(view.file.abs_src_path, file.abs_src_path)
641+
643642
# Create view and attach to previous page
644643
if not isinstance(file.page, View):
645644
yield View(None, file, config)

0 commit comments

Comments
 (0)