mirror of
https://github.com/Wcowin/Mkdocs-Wcowin.git
synced 2025-07-20 08:56:35 +00:00
1.6
This commit is contained in:
parent
79cbfb45f3
commit
c81c8d2155
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@ -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
|
||||
|
||||
|
@ -5,6 +5,30 @@ date: 2023-10-05
|
||||
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>
|
||||
|
||||
* 正式建立[Mkdocs-Wcowin主题](https://github.com/Wcowin/Mkdocs-Wcowin)
|
||||
|
@ -1,3 +1,9 @@
|
||||
---
|
||||
title: 自定义Mkdocs显示字体(霞鹜文楷)
|
||||
tags:
|
||||
- Mkdocs
|
||||
---
|
||||
|
||||
我目前在用的字体:[霞鹜文楷](https://github.com/lxgw/LxgwWenKai){target=_blank}
|
||||
想必你可以直观从我的网站感受到,[这款字体](https://chawyehsu.github.io/lxgw-wenkai-webfont/)的美观程度。
|
||||
|
||||
|
49
docs/blog/websitebeauty/time.md
Normal file
49
docs/blog/websitebeauty/time.md
Normal file
@ -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`来禁用它。
|
172
docs/overrides/partials/source-file.html
Normal file
172
docs/overrides/partials/source-file.html
Normal 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 %}
|
@ -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 #代码字体
|
||||
@ -80,6 +80,7 @@ nav:
|
||||
- JS实现鼠标样式: blog/websitebeauty/shubiao.md
|
||||
- 背景特效: blog/websitebeauty/backgroud.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
|
||||
|
Loading…
x
Reference in New Issue
Block a user