mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Removed continue reading link when there's nothing more to read
This commit is contained in:
parent
55603a70e8
commit
b7fc7bad5e
@ -271,8 +271,6 @@ class BlogPlugin(BasePlugin[BlogConfig]):
|
||||
raise PluginError(
|
||||
f"Couldn't find '{separator}' in post '{path}' in '{docs}'"
|
||||
)
|
||||
else:
|
||||
page.markdown += f"\n\n{separator}"
|
||||
|
||||
# Create excerpt for post and inherit authors and categories - excerpts
|
||||
# can contain a subset of the authors and categories of the post
|
||||
|
@ -156,6 +156,10 @@ class Excerpt(Page):
|
||||
self.authors: list[Author] = []
|
||||
self.categories: list[Category] = []
|
||||
|
||||
# Initialize content after separator - allow template authors to render
|
||||
# posts inline or to provide a link to the post's page
|
||||
self.more = None
|
||||
|
||||
# Initialize parser - note that we need to patch the configuration,
|
||||
# more specifically the table of contents extension
|
||||
config = _patch(config)
|
||||
@ -200,7 +204,9 @@ class Excerpt(Page):
|
||||
|
||||
# Convert Markdown to HTML and extract excerpt
|
||||
self.content = self.md.convert(self.markdown)
|
||||
self.content, *_ = self.content.split(separator, 1)
|
||||
self.content, *more = self.content.split(separator, 1)
|
||||
if more:
|
||||
self.more = more[0]
|
||||
|
||||
# Extract table of contents and reset post URL - if we wouldn't reset
|
||||
# the excerpt URL, linking to the excerpt from the view would not work
|
||||
|
@ -51,10 +51,12 @@
|
||||
</header>
|
||||
<div class="md-post__content md-typeset">
|
||||
{{ post.content }}
|
||||
<nav class="md-post__action">
|
||||
<a href="{{ post.url | url }}">
|
||||
{{ lang.t("blog.continue") }}
|
||||
</a>
|
||||
</nav>
|
||||
{% if post.more %}
|
||||
<nav class="md-post__action">
|
||||
<a href="{{ post.url | url }}">
|
||||
{{ lang.t("blog.continue") }}
|
||||
</a>
|
||||
</nav>
|
||||
{% endif %}
|
||||
</div>
|
||||
</article>
|
||||
|
@ -271,8 +271,6 @@ class BlogPlugin(BasePlugin[BlogConfig]):
|
||||
raise PluginError(
|
||||
f"Couldn't find '{separator}' in post '{path}' in '{docs}'"
|
||||
)
|
||||
else:
|
||||
page.markdown += f"\n\n{separator}"
|
||||
|
||||
# Create excerpt for post and inherit authors and categories - excerpts
|
||||
# can contain a subset of the authors and categories of the post
|
||||
|
@ -156,6 +156,10 @@ class Excerpt(Page):
|
||||
self.authors: list[Author] = []
|
||||
self.categories: list[Category] = []
|
||||
|
||||
# Initialize content after separator - allow template authors to render
|
||||
# posts inline or to provide a link to the post's page
|
||||
self.more = None
|
||||
|
||||
# Initialize parser - note that we need to patch the configuration,
|
||||
# more specifically the table of contents extension
|
||||
config = _patch(config)
|
||||
@ -200,7 +204,9 @@ class Excerpt(Page):
|
||||
|
||||
# Convert Markdown to HTML and extract excerpt
|
||||
self.content = self.md.convert(self.markdown)
|
||||
self.content, *_ = self.content.split(separator, 1)
|
||||
self.content, *more = self.content.split(separator, 1)
|
||||
if more:
|
||||
self.more = more[0]
|
||||
|
||||
# Extract table of contents and reset post URL - if we wouldn't reset
|
||||
# the excerpt URL, linking to the excerpt from the view would not work
|
||||
|
@ -90,10 +90,12 @@
|
||||
{{ post.content }}
|
||||
|
||||
<!-- Continue reading link -->
|
||||
<nav class="md-post__action">
|
||||
<a href="{{ post.url | url }}">
|
||||
{{ lang.t("blog.continue") }}
|
||||
</a>
|
||||
</nav>
|
||||
{% if post.more %}
|
||||
<nav class="md-post__action">
|
||||
<a href="{{ post.url | url }}">
|
||||
{{ lang.t("blog.continue") }}
|
||||
</a>
|
||||
</nav>
|
||||
{% endif %}
|
||||
</div>
|
||||
</article>
|
||||
|
Loading…
Reference in New Issue
Block a user