From bf6e66bddd6cc94ab4fd9becf9fb9d9a2d33f6e2 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Fri, 24 Nov 2023 10:47:24 +0100 Subject: [PATCH] Prepare 9.4.12 release --- CHANGELOG | 11 +++++++++ docs/changelog/index.md | 5 ++++ docs/insiders/changelog/index.md | 6 +++++ docs/plugins/blog.md | 40 ++++++++++++++++++++++++++++++++ docs/schema/plugins/blog.json | 21 +++++++++++++++++ docs/setup/setting-up-a-blog.md | 4 ++++ material/__init__.py | 2 +- material/templates/base.html | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 10 files changed, 92 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 49debb518..e8a774966 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,14 @@ +mkdocs-material-9.4.12+insiders-4.45.0 (2023-11-24) + + * Added support for sorting blog categories by post count or custom function + * Improved tags plugin to generate Unicode-aware slugs by default + * Fixed non-deterministic order of multiple authors in blog plugin + +mkdocs-material-9.4.12 (2023-11-24) + + * Improved blog plugin to generate Unicode-aware slugs by default + * Fixed non-deterministic order of categories in blog plugin + mkdocs-material-9.4.11+insiders-4.44.0 (2023-11-23) * Added pagination settings for archive pages in blog plugin diff --git a/docs/changelog/index.md b/docs/changelog/index.md index 372768ee1..bcd362f3a 100644 --- a/docs/changelog/index.md +++ b/docs/changelog/index.md @@ -2,6 +2,11 @@ ## Material for MkDocs +### 9.4.12 November 24, 2023 { id="9.4.12" } + +- Improved blog plugin to generate Unicode-aware slugs by default +- Fixed non-deterministic order of categories in blog plugin + ### 9.4.11 November 23, 2023 { id="9.4.11" } - Fixed #6364: Search plugin crashing when enabling theme while serving diff --git a/docs/insiders/changelog/index.md b/docs/insiders/changelog/index.md index 049faf689..32a525bf3 100644 --- a/docs/insiders/changelog/index.md +++ b/docs/insiders/changelog/index.md @@ -2,6 +2,12 @@ ## Material for MkDocs Insiders +### 4.45.0 November 24, 2023 { id="4.45.0" } + +- Added support for sorting blog categories by post count or custom function +- Improved tags plugin to generate Unicode-aware slugs by default +- Fixed non-deterministic order of multiple authors in blog plugin + ### 4.44.0 November 23, 2023 { id="4.44.0" } - Added pagination settings for archive pages in blog plugin diff --git a/docs/plugins/blog.md b/docs/plugins/blog.md index 172e85d45..488770799 100644 --- a/docs/plugins/blog.md +++ b/docs/plugins/blog.md @@ -882,6 +882,46 @@ plugins: --- +#### + + + + + +Use this setting to specify a custom function for sorting categories. For +example, if you want to sort categories by the number of posts they contain, +use the following configuration: + +``` yaml +plugins: + - blog: + categories_sort_by: !!python/name:material.plugins.blog.view_post_count +``` + +Don't forget to enable [`categories_sort_reverse`][config.categories_sort_reverse]. +You can define your own comparison function, which must return something +that can be compared while sorting, i.e., a string or number. + +--- + +#### + + + + + +Use this setting to reverse the order in which categories are sorted. By +default, categories are sorted in ascending order, but you can reverse ordering +as follows: + +``` yaml +plugins: + - blog: + categories_sort_reverse: true +``` + +--- + #### diff --git a/docs/schema/plugins/blog.json b/docs/schema/plugins/blog.json index 5413cbba7..aaf4ba305 100644 --- a/docs/schema/plugins/blog.json +++ b/docs/schema/plugins/blog.json @@ -265,6 +265,27 @@ "type": "string", "default": "\"-\"" }, + "categories_sort_by": { + "title": "Sort categories by this function", + "markdownDescription": "https://squidfunk.github.io/mkdocs-material/plugins/blog/#config.categories_sort_by", + "default": "!!python/name:material.plugins.blog.view_name", + "oneOf": [ + { + "type": "string" + }, + { + "enum": [ + "!!python/name:material.plugins.blog.view_name", + "!!python/name:material.plugins.blog.view_post_count" + ] + } + ] + }, + "categories_sort_reverse": { + "title": "Soft categories in reverse", + "markdownDescription": "https://squidfunk.github.io/mkdocs-material/plugins/blog/#config.categories_sort_reverse", + "default": false + }, "categories_allowed": { "title": "Categories allowed", "markdownDescription": "https://squidfunk.github.io/mkdocs-material/plugins/blog/#config.categories_allowed", diff --git a/docs/setup/setting-up-a-blog.md b/docs/setup/setting-up-a-blog.md index d76326d5c..d6ef7fc93 100644 --- a/docs/setup/setting-up-a-blog.md +++ b/docs/setup/setting-up-a-blog.md @@ -45,6 +45,8 @@ the blog, but can be helpful for customizations: - [`archive_pagination`][config.archive_pagination] - [`archive_pagination_per_page`][config.archive_pagination_per_page] +- [`categories_sort_by`][config.categories_sort_by] +- [`categories_sort_reverse`][config.categories_sort_reverse] - [`categories_pagination`][config.categories_pagination] - [`categories_pagination_per_page`][config.categories_pagination_per_page] @@ -60,6 +62,8 @@ We'll add more settings here, as we discover new use cases. [config.archive_pagination]: ../plugins/blog.md#config.archive_pagination [config.archive_pagination_per_page]: ../plugins/blog.md#config.archive_pagination_per_page + [config.categories_sort_by]: ../plugins/blog.md#config.categories_sort_by + [config.categories_sort_reverse]: ../plugins/blog.md#config.categories_sort_reverse [config.categories_pagination]: ../plugins/blog.md#config.categories_pagination [config.categories_pagination_per_page]: ../plugins/blog.md#config.categories_pagination_per_page diff --git a/material/__init__.py b/material/__init__.py index e62bccf84..42e06b9d0 100644 --- a/material/__init__.py +++ b/material/__init__.py @@ -18,4 +18,4 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -__version__ = "9.4.11" +__version__ = "9.4.12" diff --git a/material/templates/base.html b/material/templates/base.html index af27a9ef3..795022d2d 100644 --- a/material/templates/base.html +++ b/material/templates/base.html @@ -32,7 +32,7 @@ {% endif %} - + {% endblock %} {% block htmltitle %} {% if page.meta and page.meta.title %} diff --git a/package-lock.json b/package-lock.json index 1af96115b..b15b3bb78 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mkdocs-material", - "version": "9.4.11", + "version": "9.4.12", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "mkdocs-material", - "version": "9.4.11", + "version": "9.4.12", "license": "MIT", "dependencies": { "clipboard": "^2.0.11", diff --git a/package.json b/package.json index 356b5565c..21b05fa26 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mkdocs-material", - "version": "9.4.11", + "version": "9.4.12", "description": "Documentation that simply works", "keywords": [ "mkdocs",