Skip to content

Commit

Permalink
Fixed further regression in blog plugin navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed Sep 4, 2023
1 parent 5e42517 commit fc566cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions material/plugins/blog/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from mkdocs.structure.files import File, Files, InclusionLevel
from mkdocs.structure.nav import Navigation, Section
from mkdocs.structure.pages import Page
from mkdocs.utils import get_relative_url
from mkdocs.utils import copy_file, get_relative_url
from paginate import Page as Pagination
from shutil import rmtree
from tempfile import mkdtemp
Expand Down Expand Up @@ -225,10 +225,6 @@ def on_nav(self, nav, *, config, files):
for at in range(1, len(view.pages)):
self._attach_at(view.parent, view, view.pages[at])

# Replace source file system path
view.pages[at].file.src_uri = view.file.src_uri
view.pages[at].file.abs_src_path = view.file.abs_src_path

# Prepare post for rendering (run later) - allow other plugins to alter
# the contents or metadata of a post before it is rendered and make sure
# that the post includes a separator, which is essential for rendering
Expand Down Expand Up @@ -640,6 +636,9 @@ def _generate_pages(self, view: View, config: MkDocsConfig, files: Files):
file = self._path_to_file(path, config)
files.append(file)

# Copy file to temporary directory
copy_file(view.file.abs_src_path, file.abs_src_path)

# Create view and attach to previous page
if not isinstance(file.page, View):
yield View(None, file, config)
Expand Down
9 changes: 4 additions & 5 deletions src/plugins/blog/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from mkdocs.structure.files import File, Files, InclusionLevel
from mkdocs.structure.nav import Navigation, Section
from mkdocs.structure.pages import Page
from mkdocs.utils import get_relative_url
from mkdocs.utils import copy_file, get_relative_url
from paginate import Page as Pagination
from shutil import rmtree
from tempfile import mkdtemp
Expand Down Expand Up @@ -225,10 +225,6 @@ def on_nav(self, nav, *, config, files):
for at in range(1, len(view.pages)):
self._attach_at(view.parent, view, view.pages[at])

# Replace source file system path
view.pages[at].file.src_uri = view.file.src_uri
view.pages[at].file.abs_src_path = view.file.abs_src_path

# Prepare post for rendering (run later) - allow other plugins to alter
# the contents or metadata of a post before it is rendered and make sure
# that the post includes a separator, which is essential for rendering
Expand Down Expand Up @@ -640,6 +636,9 @@ def _generate_pages(self, view: View, config: MkDocsConfig, files: Files):
file = self._path_to_file(path, config)
files.append(file)

# Copy file to temporary directory
copy_file(view.file.abs_src_path, file.abs_src_path)

# Create view and attach to previous page
if not isinstance(file.page, View):
yield View(None, file, config)
Expand Down

0 comments on commit fc566cf

Please sign in to comment.