From c81c8d21558bd2dd1e2e79e651c27e9e7239c19f Mon Sep 17 00:00:00 2001 From: Wcowin <1135801806@qq.com> Date: Sat, 6 Jan 2024 16:31:32 +0800 Subject: [PATCH] 1.6 --- .github/workflows/ci.yml | 6 +- docs/blog/posts/update.md | 26 ++- docs/blog/websitebeauty/mkdocsfont.md | 6 + docs/blog/websitebeauty/time.md | 49 +++++ {overrides => docs/overrides}/404.html | 0 .../assets/javascripts/custom.9458f965.min.js | 0 .../javascripts/custom.9458f965.min.js.map | 0 .../assets/javascripts/glightbox.min.js | 0 .../assets/javascripts/iconsearch_index.json | 0 .../stylesheets/custom.00c04c01.min.css | 0 .../stylesheets/custom.00c04c01.min.css.map | 0 .../assets/stylesheets/glightbox.min.css | 0 {overrides => docs/overrides}/home.html | 0 .../__pycache__/shortcodes.cpython-311.pyc | Bin .../__pycache__/translations.cpython-311.pyc | Bin .../overrides}/hooks/shortcodes.py | 0 .../overrides}/hooks/translations.html | 0 .../overrides}/hooks/translations.py | 0 {overrides => docs/overrides}/main.html | 0 .../overrides}/partials/announce.html | 0 .../overrides}/partials/comments.html | 0 .../overrides}/partials/feedback.html | 0 .../overrides}/partials/footer.html | 0 docs/overrides/partials/source-file.html | 172 ++++++++++++++++++ mkdocs.yml | 10 +- 25 files changed, 265 insertions(+), 4 deletions(-) create mode 100644 docs/blog/websitebeauty/time.md rename {overrides => docs/overrides}/404.html (100%) rename {overrides => docs/overrides}/assets/javascripts/custom.9458f965.min.js (100%) rename {overrides => docs/overrides}/assets/javascripts/custom.9458f965.min.js.map (100%) rename {overrides => docs/overrides}/assets/javascripts/glightbox.min.js (100%) rename {overrides => docs/overrides}/assets/javascripts/iconsearch_index.json (100%) rename {overrides => docs/overrides}/assets/stylesheets/custom.00c04c01.min.css (100%) rename {overrides => docs/overrides}/assets/stylesheets/custom.00c04c01.min.css.map (100%) rename {overrides => docs/overrides}/assets/stylesheets/glightbox.min.css (100%) rename {overrides => docs/overrides}/home.html (100%) rename {overrides => docs/overrides}/hooks/__pycache__/shortcodes.cpython-311.pyc (100%) rename {overrides => docs/overrides}/hooks/__pycache__/translations.cpython-311.pyc (100%) rename {overrides => docs/overrides}/hooks/shortcodes.py (100%) rename {overrides => docs/overrides}/hooks/translations.html (100%) rename {overrides => docs/overrides}/hooks/translations.py (100%) rename {overrides => docs/overrides}/main.html (100%) rename {overrides => docs/overrides}/partials/announce.html (100%) rename {overrides => docs/overrides}/partials/comments.html (100%) rename {overrides => docs/overrides}/partials/feedback.html (100%) rename {overrides => docs/overrides}/partials/footer.html (100%) create mode 100644 docs/overrides/partials/source-file.html diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b4b5b2..c7c8676 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,13 @@ jobs: - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV - uses: actions/cache@v3 with: - key: mkdocs-material-${{ env.cache_id }} + key: mkdocs-material-${ env.cache_id } path: .cache restore-keys: | mkdocs-material- + - run: pip install mkdocs-git-revision-date-localized-plugin + - run: pip install mkdocs-git-authors-plugin + # - run: pip install mkdocs-rss-plugin - run: pip install mkdocs-material - run: mkdocs gh-deploy --force + diff --git a/docs/blog/posts/update.md b/docs/blog/posts/update.md index d5bd1b6..81d7b6a 100644 --- a/docs/blog/posts/update.md +++ b/docs/blog/posts/update.md @@ -4,7 +4,31 @@ authors: [Wcowin] date: 2023-10-05 categories: - 网站更新记录 ---- +--- + +##
+* 优化网站流畅度(玄学) +* 引入[git-revision-date-localized-plugin](https://timvink.github.io/mkdocs-git-revision-date-localized-plugin/)插件,以便记录文档创建和最后一次修改时间 +* 看了更多的猫咪 + +##
+* 优化个别网页标签的显示问题 +* 优化网站图片加载流畅度(玄学) +* 看了更多的猫咪 + +##
+* 首次引入人工智能问答机器人,地址:
+* 修复翻译问题 +* 优化移动端效果 +* 提升网站流畅度(玄学) + +##
+* 新增多语言支持,特别新增中国台湾语言支持 + ##
* 正式建立[Mkdocs-Wcowin主题](https://github.com/Wcowin/Mkdocs-Wcowin) diff --git a/docs/blog/websitebeauty/mkdocsfont.md b/docs/blog/websitebeauty/mkdocsfont.md index 3b071e4..5e43482 100644 --- a/docs/blog/websitebeauty/mkdocsfont.md +++ b/docs/blog/websitebeauty/mkdocsfont.md @@ -1,3 +1,9 @@ +--- +title: 自定义Mkdocs显示字体(霞鹜文楷) +tags: + - Mkdocs +--- + 我目前在用的字体:[霞鹜文楷](https://github.com/lxgw/LxgwWenKai){target=_blank} 想必你可以直观从我的网站感受到,[这款字体](https://chawyehsu.github.io/lxgw-wenkai-webfont/)的美观程度。 diff --git a/docs/blog/websitebeauty/time.md b/docs/blog/websitebeauty/time.md new file mode 100644 index 0000000..61efca5 --- /dev/null +++ b/docs/blog/websitebeauty/time.md @@ -0,0 +1,49 @@ +--- +title: 为MKdocs添加文章修订时间戳 +tags: + - Mkdocs +comments: false #评论,默认不开启 +--- + + + +参考方法:[git 修订日期本地化](https://squidfunk.github.io/mkdocs-material/setup/adding-a-git-repository/#revisioning) + +利用[git -revision-date-localized插件](https://github.com/timvink/mkdocs-git-revision-date-localized-plugin)添加了对添加上次更新日期和在每个页面底部创建文档的支持 + +## 安装 + +```bash +pip install mkdocs-git-revision-date-localized-plugin +``` + +## 配置 + +然后将以下行添加到mkdocs.yml: +```yml +plugins: + - git-revision-date-localized: + enable_creation_date: true +``` + +详细的配置请看:[mkdocs-git-revision-date-localized-plugin](https://timvink.github.io/mkdocs-git-revision-date-localized-plugin/index.html) + +可选的配置很多: +```yml +plugins: + - git-revision-date-localized: + type: timeago #时间类型 + custom_format: "%d. %B %Y" # 时间格式 + timezone: Europe/Amsterdam #时区 + locale: en #首选语言 + fallback_to_build_date: false #许回退到git 不可用时mkdocs build执行的时间 + enable_creation_date: true #是否启用创建时间 + exclude: #排除的页面 + - index.md + enabled: true #是否启用 + strict: true +``` + +## 温馨提示 + +对于大型单一的文档库,执行`mkdocs serve`后的渲染速度明显变慢,这是因为每次渲染都会检查所有文件的git历史记录。如果您不需要这个功能,可以通过将`enabled`设置为`false`来禁用它。 \ No newline at end of file diff --git a/overrides/404.html b/docs/overrides/404.html similarity index 100% rename from overrides/404.html rename to docs/overrides/404.html diff --git a/overrides/assets/javascripts/custom.9458f965.min.js b/docs/overrides/assets/javascripts/custom.9458f965.min.js similarity index 100% rename from overrides/assets/javascripts/custom.9458f965.min.js rename to docs/overrides/assets/javascripts/custom.9458f965.min.js diff --git a/overrides/assets/javascripts/custom.9458f965.min.js.map b/docs/overrides/assets/javascripts/custom.9458f965.min.js.map similarity index 100% rename from overrides/assets/javascripts/custom.9458f965.min.js.map rename to docs/overrides/assets/javascripts/custom.9458f965.min.js.map diff --git a/overrides/assets/javascripts/glightbox.min.js b/docs/overrides/assets/javascripts/glightbox.min.js similarity index 100% rename from overrides/assets/javascripts/glightbox.min.js rename to docs/overrides/assets/javascripts/glightbox.min.js diff --git a/overrides/assets/javascripts/iconsearch_index.json b/docs/overrides/assets/javascripts/iconsearch_index.json similarity index 100% rename from overrides/assets/javascripts/iconsearch_index.json rename to docs/overrides/assets/javascripts/iconsearch_index.json diff --git a/overrides/assets/stylesheets/custom.00c04c01.min.css b/docs/overrides/assets/stylesheets/custom.00c04c01.min.css similarity index 100% rename from overrides/assets/stylesheets/custom.00c04c01.min.css rename to docs/overrides/assets/stylesheets/custom.00c04c01.min.css diff --git a/overrides/assets/stylesheets/custom.00c04c01.min.css.map b/docs/overrides/assets/stylesheets/custom.00c04c01.min.css.map similarity index 100% rename from overrides/assets/stylesheets/custom.00c04c01.min.css.map rename to docs/overrides/assets/stylesheets/custom.00c04c01.min.css.map diff --git a/overrides/assets/stylesheets/glightbox.min.css b/docs/overrides/assets/stylesheets/glightbox.min.css similarity index 100% rename from overrides/assets/stylesheets/glightbox.min.css rename to docs/overrides/assets/stylesheets/glightbox.min.css diff --git a/overrides/home.html b/docs/overrides/home.html similarity index 100% rename from overrides/home.html rename to docs/overrides/home.html diff --git a/overrides/hooks/__pycache__/shortcodes.cpython-311.pyc b/docs/overrides/hooks/__pycache__/shortcodes.cpython-311.pyc similarity index 100% rename from overrides/hooks/__pycache__/shortcodes.cpython-311.pyc rename to docs/overrides/hooks/__pycache__/shortcodes.cpython-311.pyc diff --git a/overrides/hooks/__pycache__/translations.cpython-311.pyc b/docs/overrides/hooks/__pycache__/translations.cpython-311.pyc similarity index 100% rename from overrides/hooks/__pycache__/translations.cpython-311.pyc rename to docs/overrides/hooks/__pycache__/translations.cpython-311.pyc diff --git a/overrides/hooks/shortcodes.py b/docs/overrides/hooks/shortcodes.py similarity index 100% rename from overrides/hooks/shortcodes.py rename to docs/overrides/hooks/shortcodes.py diff --git a/overrides/hooks/translations.html b/docs/overrides/hooks/translations.html similarity index 100% rename from overrides/hooks/translations.html rename to docs/overrides/hooks/translations.html diff --git a/overrides/hooks/translations.py b/docs/overrides/hooks/translations.py similarity index 100% rename from overrides/hooks/translations.py rename to docs/overrides/hooks/translations.py diff --git a/overrides/main.html b/docs/overrides/main.html similarity index 100% rename from overrides/main.html rename to docs/overrides/main.html diff --git a/overrides/partials/announce.html b/docs/overrides/partials/announce.html similarity index 100% rename from overrides/partials/announce.html rename to docs/overrides/partials/announce.html diff --git a/overrides/partials/comments.html b/docs/overrides/partials/comments.html similarity index 100% rename from overrides/partials/comments.html rename to docs/overrides/partials/comments.html diff --git a/overrides/partials/feedback.html b/docs/overrides/partials/feedback.html similarity index 100% rename from overrides/partials/feedback.html rename to docs/overrides/partials/feedback.html diff --git a/overrides/partials/footer.html b/docs/overrides/partials/footer.html similarity index 100% rename from overrides/partials/footer.html rename to docs/overrides/partials/footer.html diff --git a/docs/overrides/partials/source-file.html b/docs/overrides/partials/source-file.html new file mode 100644 index 0000000..b3ecfc2 --- /dev/null +++ b/docs/overrides/partials/source-file.html @@ -0,0 +1,172 @@ + + + +{% macro render_updated(date) %} + + +{% endmacro %} + + +{% macro render_created(date) %} + + {{ date }} + + +{% endmacro %} + + + + +{% macro render_authors(authors) %} + {% set git_authors = config.plugins.get("git-authors") %} + + {{ date }} + + +{% endmacro %} + + + + +{% macro render_committers_github(title) %} + + + + {{ title }} +{% endmacro %} + + +{% macro render_committers_gitlab(title) %} + + {{ title }} +{% endmacro %} + + +{% macro render_committers(authors) %} + + {% if committers_source == "gitlab" %} + {{ render_committers_gitlab("GitLab") }} + {% else %} + {{ render_committers_github("GitHub") }} + {% endif %} + + +{% endmacro %} + + + + +{% if page.meta %} + {% if page.meta.git_revision_date_localized %} + {% set updated = page.meta.git_revision_date_localized %} + {% elif page.meta.revision_date %} + {% set updated = page.meta.revision_date %} + {% endif %} + + + {% if page.meta.git_creation_date_localized %} + {% set created = page.meta.git_creation_date_localized %} + {% endif %} +{% endif %} + + +{% if updated or created or git_info or committers %} + +{% endif %} diff --git a/mkdocs.yml b/mkdocs.yml index 6a75d42..537a347 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -5,7 +5,7 @@ site_author: Wcowin # your name #[UI] theme: name: material - custom_dir: overrides #覆写路径 + custom_dir: docs/overrides #覆写路径 # font: #谷歌字体,自行搜索 # text: Bitter #文本字体 # code: Roboto Mono #代码字体 @@ -79,7 +79,8 @@ nav: - 修改网站字体: blog/websitebeauty/mkdocsfont.md - JS实现鼠标样式: blog/websitebeauty/shubiao.md - 背景特效: blog/websitebeauty/backgroud.md - - 添加404页面: blog/websitebeauty/404.md + - 添加404页面: blog/websitebeauty/404.md + - 为MKdocs添加文章修订时间戳: blog/websitebeauty/time.md - 建设MKdocs技能指北: - Markdown: - Markdown指南: develop/Markdown/markdown.md @@ -148,6 +149,11 @@ extra: plugins: - search #搜索配置 + - git-revision-date-localized: + type: iso_date + enable_creation_date: false + exclude: + - index.md - blog: #博客配置 post_date_format: full #时间 draft: true