diff --git a/assets/css/_custom.scss b/assets/css/_custom.scss index ef793da..ab24432 100644 --- a/assets/css/_custom.scss +++ b/assets/css/_custom.scss @@ -205,6 +205,63 @@ } } +#toc-auto { + .follow-container { + display: flex; + align-items: center; + gap: 16px; + padding-bottom: 8px; + margin-bottom: 8px; + border-bottom: 1px solid $global-border-color; + + [data-theme='dark'] & { + border-color: $global-border-color-dark; + } + + .author-link { + display: flex; + align-items: center; + gap: 4px; + font-weight: 500; + color: $single-link-color; + + [data-theme='dark'] & { + color: $single-link-color-dark; + } + + &:active, + &:hover { + color: $single-link-hover-color; + + [data-theme='dark'] & { + color: $single-link-hover-color-dark; + } + } + + .author-avatar { + width: 34px; + border-radius: 50%; + border: 1px solid $global-border-color; + + [data-theme='dark'] & { + border-color: $global-border-color-dark; + } + } + } + .follow-btn { + border: 1px solid #d1d9e0; + background-color: #f6f8fa; + border-radius: 6px; + padding: 4px 10px; + + [data-theme='dark'] & { + border-color: #3d444d; + background-color: #2a313c; + } + } + } +} + [lang='en'] { .collection-details .collection-summary .collection-name::before { content: ''; diff --git a/config/_default/params.toml b/config/_default/params.toml index 3ce06c0..07d3514 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -824,6 +824,12 @@ disableThemeInject = false "inject/cmpt-translate.html", "inject/shortcode-caniuse.html", ] + postTocBefore = [ + "custom/follow-me.html", + ] + postTocAfter = [] + postContentBefore = [] + postContentAfter = [] postFooterBefore = [] postFooterAfter = [] diff --git a/content/en/documentation/advanced/index.md b/content/en/documentation/advanced/index.md index fd20b0b..b86dd36 100644 --- a/content/en/documentation/advanced/index.md +++ b/content/en/documentation/advanced/index.md @@ -296,6 +296,10 @@ Next, taking the [component-projects] component as an example, we will introduce assets = [ "inject/component-projects.html", ] + postTocBefore = [] + postTocAfter = [] + postContentBefore = [] + postContentAfter = [] postFooterBefore = [] postFooterAfter = [] ``` diff --git a/content/en/references/blocks/index.md b/content/en/references/blocks/index.md index 7b89684..bc683a7 100644 --- a/content/en/references/blocks/index.md +++ b/content/en/references/blocks/index.md @@ -48,6 +48,10 @@ You can implement these blocks through `define`. | `custom-footer` | Footer custom block | `layouts/partials/footer.html` | | `custom-widgets` | Widgets custom block | `layouts/partials/widgets.html` | | `custom-assets` | Assets custom block | `layouts/partials/assets.html` | +| `custom-post__toc:before` | Custom block before post toc | `layouts/posts/single.html` | +| `custom-post__toc:after` | Custom block after post toc | `layouts/posts/single.html` | +| `custom-post__content:before`| Custom block before post content| `layouts/posts/single.html` | +| `custom-post__content:after` | Custom block after post content | `layouts/posts/single.html` | | `custom-post__footer:before` | Custom block before post footer | `layouts/posts/single.html` | | `custom-post__footer:after` | Custom block after post footer | `layouts/posts/single.html` | @@ -71,6 +75,10 @@ Custom partials must be stored in the `/layouts/partials/` directory. footer = [] widgets = [] assets = [] + postTocBefore = [] + postTocAfter = [] + postContentBefore = [] + postContentAfter = [] postFooterBefore = [] postFooterAfter = [] ``` diff --git a/content/zh-cn/documentation/advanced/index.md b/content/zh-cn/documentation/advanced/index.md index 82da8e0..953e03a 100644 --- a/content/zh-cn/documentation/advanced/index.md +++ b/content/zh-cn/documentation/advanced/index.md @@ -296,6 +296,10 @@ li[data-task='tip'] { assets = [ "inject/component-projects.html", ] + postTocBefore = [] + postTocAfter = [] + postContentBefore = [] + postContentAfter = [] postFooterBefore = [] postFooterAfter = [] ``` diff --git a/content/zh-cn/references/blocks/index.md b/content/zh-cn/references/blocks/index.md index 158eb33..e406d76 100644 --- a/content/zh-cn/references/blocks/index.md +++ b/content/zh-cn/references/blocks/index.md @@ -37,19 +37,23 @@ cp themes/FixIt/layouts/partials/custom.html layouts/partials/custom.html 你可以通过 `define` 来实现这些块。 -| 块名称 | 描述 | 位置 | -| :--------------------------- | :----------------- | :------------------------------------- | -| `custom-head` | 头部自定义块 | `layouts/_default/baseof.html` | -| `custom-menu:desktop` | 桌面菜单自定义块 | `layouts/partials/header.html` | -| `custom-menu:mobile` | 移动菜单自定义块 | `layouts/partials/header.html` | -| `custom-profile` | 首页自定义块 | `layouts/partials/home/profile.html` | -| `custom-aside` | 侧栏自定义块 | `layouts/posts/single.html` | -| `custom-comment` | 评论系统自定义块 | `layouts/partials/single/comment.html` | -| `custom-footer` | 页脚自定义块 | `layouts/partials/footer.html` | -| `custom-widgets` | 小部件自定义块 | `layouts/partials/widgets.html` | -| `custom-assets` | 资源自定义块 | `layouts/partials/assets.html` | -| `custom-post__footer:before` | 文章页脚前自定义块 | `layouts/posts/single.html` | -| `custom-post__footer:after` | 文章页脚后自定义块 | `layouts/posts/single.html` | +| 块名称 | 描述 | 位置 | +| :---------------------------- | :------------------- | :------------------------------------- | +| `custom-head` | 头部自定义块 | `layouts/_default/baseof.html` | +| `custom-menu:desktop` | 桌面菜单自定义块 | `layouts/partials/header.html` | +| `custom-menu:mobile` | 移动菜单自定义块 | `layouts/partials/header.html` | +| `custom-profile` | 首页自定义块 | `layouts/partials/home/profile.html` | +| `custom-aside` | 侧栏自定义块 | `layouts/posts/single.html` | +| `custom-comment` | 评论系统自定义块 | `layouts/partials/single/comment.html` | +| `custom-footer` | 页脚自定义块 | `layouts/partials/footer.html` | +| `custom-widgets` | 小部件自定义块 | `layouts/partials/widgets.html` | +| `custom-assets` | 资源自定义块 | `layouts/partials/assets.html` | +| `custom-post__toc:before` | 文章页目录前自定义块 | `layouts/posts/single.html` | +| `custom-post__toc:after` | 文章页目录后自定义块 | `layouts/posts/single.html` | +| `custom-post__content:before` | 文章页内容前自定义块 | `layouts/posts/single.html` | +| `custom-post__content:after` | 文章页内容后自定义块 | `layouts/posts/single.html` | +| `custom-post__footer:before` | 文章页脚前自定义块 | `layouts/posts/single.html` | +| `custom-post__footer:after` | 文章页脚后自定义块 | `layouts/posts/single.html` | ## 主题配置 @@ -71,6 +75,10 @@ cp themes/FixIt/layouts/partials/custom.html layouts/partials/custom.html footer = [] widgets = [] assets = [] + postTocBefore = [] + postTocAfter = [] + postContentBefore = [] + postContentAfter = [] postFooterBefore = [] postFooterAfter = [] ``` diff --git a/go.mod b/go.mod index 9b44842..4374060 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/hugo-fixit/docs go 1.20 require ( - github.com/hugo-fixit/FixIt v0.3.17-0.20241226022407-21750077baed // indirect + github.com/hugo-fixit/FixIt v0.3.17-0.20241227073812-30a67c4b523b // indirect github.com/hugo-fixit/cmpt-translate v1.5.0 // indirect github.com/hugo-fixit/component-projects v1.5.3 // indirect github.com/hugo-fixit/shortcode-caniuse v1.2.2 // indirect diff --git a/go.sum b/go.sum index d30b562..83a2f09 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/hugo-fixit/FixIt v0.3.17-0.20241226022407-21750077baed h1:5bKyBHPejXz66N6lI9fryNSlUdowvLMU2CeNTP/p5v4= -github.com/hugo-fixit/FixIt v0.3.17-0.20241226022407-21750077baed/go.mod h1:3XIRedrqakO7/a4ZnhE46haMRF8HgsT0N0B5j5D2iRU= +github.com/hugo-fixit/FixIt v0.3.17-0.20241227073812-30a67c4b523b h1:MtJjdg27kAkFmcggkLKfmVEE5GgvwoxeiwwxPuP+VQo= +github.com/hugo-fixit/FixIt v0.3.17-0.20241227073812-30a67c4b523b/go.mod h1:3XIRedrqakO7/a4ZnhE46haMRF8HgsT0N0B5j5D2iRU= github.com/hugo-fixit/cmpt-translate v1.5.0 h1:UoJ+YzVvn13CzwhMzRcXxnaFh1gDSH/1K/WyUeTcwvY= github.com/hugo-fixit/cmpt-translate v1.5.0/go.mod h1:JZ0STubquTlRgyyGhGPlt2s0KJ1gCa99+P8ltTwQRM4= github.com/hugo-fixit/component-projects v1.5.3 h1:phKG//aW4sF9CSUn6kJry2ovBGSlJzxF5H7+ZSlemQw= diff --git a/i18n/en.toml b/i18n/en.toml index 41487c9..b58cb09 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -17,3 +17,5 @@ breadcrumbTitle = "Basics Syntax" breadcrumbTitle = "Extended Syntax" # === Translations for pages === +[follow] +other = "Follow" diff --git a/i18n/zh-CN.toml b/i18n/zh-CN.toml index 82baec8..1f50c7f 100644 --- a/i18n/zh-CN.toml +++ b/i18n/zh-CN.toml @@ -22,3 +22,6 @@ breadcrumbTitle = "扩展语法" [admonition] ban = "禁止" # === shortcodes/admonition.html === + +[follow] +other = "关注" diff --git a/layouts/partials/custom/follow-me.html b/layouts/partials/custom/follow-me.html new file mode 100644 index 0000000..2b3db6b --- /dev/null +++ b/layouts/partials/custom/follow-me.html @@ -0,0 +1,16 @@ +{{- $author := partial "function/get-author-map.html" .Params.author -}} +{{- $follows := slice + "Lruihao" + "hugo-fixit" +-}} + +{{- if in $follows $author.name -}} +
+{{- end -}}