This commit is contained in:
Wcowin 2024-01-06 16:31:32 +08:00
parent 79cbfb45f3
commit c81c8d2155
25 changed files with 265 additions and 4 deletions

View File

@ -17,9 +17,13 @@ jobs:
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
key: mkdocs-material-${{ env.cache_id }} key: mkdocs-material-${ env.cache_id }
path: .cache path: .cache
restore-keys: | restore-keys: |
mkdocs-material- 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: pip install mkdocs-material
- run: mkdocs gh-deploy --force - run: mkdocs gh-deploy --force

View File

@ -4,7 +4,31 @@ authors: [Wcowin]
date: 2023-10-05 date: 2023-10-05
categories: categories:
- 网站更新记录 - 网站更新记录
--- ---
## </p><h1 id="01" name="01"><strong>2024-01-05</strong></h1><p>
* 优化网站流畅度(玄学)
* 引入[git-revision-date-localized-plugin](https://timvink.github.io/mkdocs-git-revision-date-localized-plugin/)插件,以便记录文档创建和最后一次修改时间
* 看了更多的猫咪
## </p><h1 id="01" name="01"><strong>2023-12-14</strong></h1><p>
* 优化个别网页标签的显示问题
* 优化网站图片加载流畅度(玄学)
* 看了更多的猫咪
## </p><h1 id="01" name="01"><strong>2023-12-09</strong></h1><p>
* 首次引入人工智能问答机器人,地址:<https://wcowin.work/about/geren/>缺点是每月25条消息限制优点是可以智能回复本站所有信息包括但不限于个人信息技术分享博客留言板友链等等
* 优化网站流畅度
* 撸了更多的猫咪
## </p><h1 id="01" name="01"><strong>2023-11-22</strong></h1><p>
* 修复翻译问题
* 优化移动端效果
* 提升网站流畅度(玄学)
## </p><h1 id="01" name="01"><strong>2023-11-11</strong></h1><p>
* 新增多语言支持,特别新增中国台湾语言支持
## </p><h1 id="01" name="01"><strong>2023-10-14</strong></h1><p> ## </p><h1 id="01" name="01"><strong>2023-10-14</strong></h1><p>
* 正式建立[Mkdocs-Wcowin主题](https://github.com/Wcowin/Mkdocs-Wcowin) * 正式建立[Mkdocs-Wcowin主题](https://github.com/Wcowin/Mkdocs-Wcowin)

View File

@ -1,3 +1,9 @@
---
title: 自定义Mkdocs显示字体(霞鹜文楷)
tags:
- Mkdocs
---
我目前在用的字体:[霞鹜文楷](https://github.com/lxgw/LxgwWenKai){target=_blank} 我目前在用的字体:[霞鹜文楷](https://github.com/lxgw/LxgwWenKai){target=_blank}
想必你可以直观从我的网站感受到,[这款字体](https://chawyehsu.github.io/lxgw-wenkai-webfont/)的美观程度。 想必你可以直观从我的网站感受到,[这款字体](https://chawyehsu.github.io/lxgw-wenkai-webfont/)的美观程度。

View File

@ -0,0 +1,49 @@
---
title: 为MKdocs添加文章修订时间戳
tags:
- Mkdocs
comments: false #评论,默认不开启
---
![img](https://cn.mcecy.com/image/20240106/ee0ece547112ac1b67fb61ac7f9c1a90.png)
参考方法:[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`来禁用它。

View File

@ -0,0 +1,172 @@
<!--
Copyright (c) 2016-2023 Martin Donath <martin.donath@squidfunk.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
-->
<!-- Render date of last update -->
{% macro render_updated(date) %}
<span class="md-source-file__fact">
<span class="md-icon" title="{{ lang.t('source.file.date.updated') }}">
{% include ".icons/material/clock-edit-outline.svg" %}
</span>
{{ date }}
</span>
{% endmacro %}
<!-- Render date of creation -->
{% macro render_created(date) %}
<span class="md-source-file__fact">
<span class="md-icon" title="{{ lang.t('source.file.date.created') }}">
{% include ".icons/material/clock-plus-outline.svg" %}
</span>
{{ date }}
</span>
{% endmacro %}
<!-- ---------------------------------------------------------------------- -->
<!-- Render authors -->
{% macro render_authors(authors) %}
{% set git_authors = config.plugins.get("git-authors") %}
<span class="md-source-file__fact">
<span class="md-icon" title="{{ lang.t('source.file.contributors') }}">
{% if authors | length == 1 %}
{% include ".icons/material/account.svg" %}
{% else %}
{% include ".icons/material/account-group.svg" %}
{% endif %}
</span>
<nav>
{% for author in authors %}
{%- if git_authors.config.show_email_address %}
<a href="mailto:{{ author.email }}">
{{- author.name -}}
</a>
{%- else -%}
{{- author.name -}}
{% endif -%}
{%- if loop.revindex > 1 %}, {% endif -%}
{% endfor %}
</nav>
</span>
{% endmacro %}
<!-- ---------------------------------------------------------------------- -->
<!-- Render committers from GitHub -->
{% macro render_committers_github(title) %}
<span class="md-icon" title="{{ lang.t('source.file.contributors') }}">
{% include ".icons/material/github.svg" %}
</span>
<span>{{ title }}</span>
{% endmacro %}
<!-- Render committers from GitLab -->
{% macro render_committers_gitlab(title) %}
<span class="md-icon" title="{{ lang.t('source.file.contributors') }}">
{% include ".icons/material/gitlab.svg" %}
</span>
<span>{{ title }}</span>
{% endmacro %}
<!-- Render committers -->
{% macro render_committers(authors) %}
<span class="md-source-file__fact">
{% if committers_source == "gitlab" %}
{{ render_committers_gitlab("GitLab") }}
{% else %}
{{ render_committers_github("GitHub") }}
{% endif %}
<nav>
{% for author in authors[:4] %}
<a
href="{{ author.url }}"
class="md-author"
title="@{{ author.login }}"
>
{% set separator = "&" if "?" in author.avatar else "?" %}
<img
src="{{ author.avatar }}{{ separator }}size=72"
alt="{{ author.name or 'GitHub user' }}"
/>
</a>
{% endfor %}
<!-- More authors -->
{% set more = authors[4:] | length %}
{% if more > 0 %}
{% if page.edit_url %}
<a
href="{{ page.edit_url | replace('edit', 'blob') }}"
class="md-author md-author--more"
>
+{{ more }}
</a>
{% else %}
<span class="md-author md-author--more">
+{{ more }}
</span>
{% endif %}
{% endif %}
</nav>
</span>
{% endmacro %}
<!-- ---------------------------------------------------------------------- -->
<!-- Determine date of last update -->
{% 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 %}
<!-- Determine date of creation -->
{% if page.meta.git_creation_date_localized %}
{% set created = page.meta.git_creation_date_localized %}
{% endif %}
{% endif %}
<!-- Source file information -->
{% if updated or created or git_info or committers %}
<aside class="md-source-file">
<!-- Date of last update -->
{% if updated %}
{{ render_updated(updated) }}
{% endif %}
<!-- Date of creation -->
{% if created %}
{{ render_created(created) }}
{% endif %}
<!-- Authors (git-authors plugin) -->
{% if git_info %}
{{ render_authors(git_info.get("page_authors")) }}
{% endif %}
<!-- Authors (git-committers plugin) -->
{% if committers %}
{{ render_committers(committers) }}
{% endif %}
</aside>
{% endif %}

View File

@ -5,7 +5,7 @@ site_author: Wcowin # your name
#[UI] #[UI]
theme: theme:
name: material name: material
custom_dir: overrides #覆写路径 custom_dir: docs/overrides #覆写路径
# font: #谷歌字体,自行搜索 # font: #谷歌字体,自行搜索
# text: Bitter #文本字体 # text: Bitter #文本字体
# code: Roboto Mono #代码字体 # code: Roboto Mono #代码字体
@ -79,7 +79,8 @@ nav:
- 修改网站字体: blog/websitebeauty/mkdocsfont.md - 修改网站字体: blog/websitebeauty/mkdocsfont.md
- JS实现鼠标样式: blog/websitebeauty/shubiao.md - JS实现鼠标样式: blog/websitebeauty/shubiao.md
- 背景特效: blog/websitebeauty/backgroud.md - 背景特效: blog/websitebeauty/backgroud.md
- 添加404页面: blog/websitebeauty/404.md - 添加404页面: blog/websitebeauty/404.md
- 为MKdocs添加文章修订时间戳: blog/websitebeauty/time.md
- 建设MKdocs技能指北: - 建设MKdocs技能指北:
- Markdown: - Markdown:
- Markdown指南: develop/Markdown/markdown.md - Markdown指南: develop/Markdown/markdown.md
@ -148,6 +149,11 @@ extra:
plugins: plugins:
- search #搜索配置 - search #搜索配置
- git-revision-date-localized:
type: iso_date
enable_creation_date: false
exclude:
- index.md
- blog: #博客配置 - blog: #博客配置
post_date_format: full #时间 post_date_format: full #时间
draft: true draft: true