mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Added support for adding update dates to blog posts
This commit is contained in:
@@ -50,6 +50,16 @@
|
|||||||
</time>
|
</time>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
{% if page.meta.date_updated %}
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<div class="md-nav__link">
|
||||||
|
{% include ".icons/material/calendar-clock.svg" %}
|
||||||
|
<time datetime="{{ page.meta.date_updated }}" class="md-ellipsis">
|
||||||
|
{{- page.meta.date_updated_format -}}
|
||||||
|
</time>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
{% if page.categories %}
|
{% if page.categories %}
|
||||||
<li class="md-nav__item">
|
<li class="md-nav__item">
|
||||||
<div class="md-nav__link">
|
<div class="md-nav__link">
|
||||||
|
|||||||
@@ -358,6 +358,12 @@ class BlogPlugin(BasePlugin[BlogConfig]):
|
|||||||
page.meta["date"], date_format, config
|
page.meta["date"], date_format, config
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Format date of last update for rendering
|
||||||
|
if "date_updated" in page.meta:
|
||||||
|
page.meta["date_updated_format"] = self._format_date(
|
||||||
|
page.meta["date_updated"], date_format, config
|
||||||
|
)
|
||||||
|
|
||||||
# Compute readtime if desired and not explicitly set
|
# Compute readtime if desired and not explicitly set
|
||||||
if self.config.post_readtime:
|
if self.config.post_readtime:
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ theme:
|
|||||||
|
|
||||||
# Plugins
|
# Plugins
|
||||||
plugins:
|
plugins:
|
||||||
|
- blog
|
||||||
- search:
|
- search:
|
||||||
separator: '[\s\-,:!=\[\]()"`/]+|\.(?!\d)|&[lg]t;|(?!\b)(?=[A-Z][a-z])'
|
separator: '[\s\-,:!=\[\]()"`/]+|\.(?!\d)|&[lg]t;|(?!\b)(?=[A-Z][a-z])'
|
||||||
- minify:
|
- minify:
|
||||||
@@ -231,10 +232,3 @@ nav:
|
|||||||
- Changelog: insiders/changelog.md
|
- Changelog: insiders/changelog.md
|
||||||
- Blog:
|
- Blog:
|
||||||
- blog/index.md
|
- blog/index.md
|
||||||
- 2022:
|
|
||||||
- blog/posts/blog-support-just-landed.md
|
|
||||||
- blog/posts/chinese-search-support.md
|
|
||||||
- 2021:
|
|
||||||
- blog/posts/the-past-present-and-future.md
|
|
||||||
- blog/posts/excluding-content-from-search.md
|
|
||||||
- blog/posts/search-better-faster-smaller.md
|
|
||||||
|
|||||||
@@ -87,6 +87,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<!-- Page date updated -->
|
||||||
|
{% if page.meta.date_updated %}
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<div class="md-nav__link">
|
||||||
|
{% include ".icons/material/calendar-clock.svg" %}
|
||||||
|
<time datetime="{{ page.meta.date_updated }}" class="md-ellipsis">
|
||||||
|
{{- page.meta.date_updated_format -}}
|
||||||
|
</time>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<!-- Page categories -->
|
<!-- Page categories -->
|
||||||
{% if page.categories %}
|
{% if page.categories %}
|
||||||
<li class="md-nav__item">
|
<li class="md-nav__item">
|
||||||
|
|||||||
@@ -358,6 +358,12 @@ class BlogPlugin(BasePlugin[BlogConfig]):
|
|||||||
page.meta["date"], date_format, config
|
page.meta["date"], date_format, config
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Format date of last update for rendering
|
||||||
|
if "date_updated" in page.meta:
|
||||||
|
page.meta["date_updated_format"] = self._format_date(
|
||||||
|
page.meta["date_updated"], date_format, config
|
||||||
|
)
|
||||||
|
|
||||||
# Compute readtime if desired and not explicitly set
|
# Compute readtime if desired and not explicitly set
|
||||||
if self.config.post_readtime:
|
if self.config.post_readtime:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user