Skip to content

Commit 8e56fba

Browse files
committed
Refactor: 适配 Hugo 0.146.0 及 FixIt 0.4.0
FixIt 版本低于 0.4.0 请勿升级!
1 parent 4336a23 commit 8e56fba

File tree

8 files changed

+11
-11
lines changed

8 files changed

+11
-11
lines changed

README.en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
## Requirements
3131

32-
- [FixIt](https://github.com/hugo-fixit) v0.3.7 or higher
32+
- [FixIt](https://github.com/hugo-fixit) v0.4.0 or higher
3333

3434
## Installation
3535

@@ -75,7 +75,7 @@ theme = ["FixIt", "component-projects"]
7575

7676
## Configuration
7777

78-
Finally, in order to Inject the partial `{component-xxx}.html` into the `custom-assets` through the [custom block](https://fixit.lruihao.cn/references/blocks/) opened by the FixIt theme in the `layouts/partials/custom.html` file, you need to fill in the following necessary configurations:
78+
Finally, in order to Inject the partial `{component-projects}.html` into the `custom-assets` through the [custom block](https://fixit.lruihao.cn/references/blocks/) opened by the FixIt theme in the `layouts/_partials/custom.html` file, you need to fill in the following necessary configurations:
7979

8080
```toml
8181
[params]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ theme = ["FixIt", "component-projects"]
7575

7676
## 配置
7777

78-
最后,为了通过 FixIt 主题在 `layouts/partials/custom.html` 文件中开放的 [自定义块](https://fixit.lruihao.cn/references/blocks/)`component-projects.html` 注入到 `custom-head``custom-assets` 中,你需要填写以下必要配置:
78+
最后,为了通过 FixIt 主题在 `layouts/_partials/custom.html` 文件中开放的 [自定义块](https://fixit.lruihao.cn/references/blocks/)`component-projects.html` 注入到 `custom-head``custom-assets` 中,你需要填写以下必要配置:
7979

8080
```toml
8181
[params]

layouts/partials/inject/component-projects.html renamed to layouts/_partials/inject/component-projects.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{- /* repo-card.min.css */ -}}
22
{{- if (.HasShortcode "gh-repo-card") | and (ne .Layout "projects") -}}
3-
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
3+
{{- $fingerprint := .Site.Store.Get "fingerprint" -}}
44
{{- $options := dict "Source" "css/component-projects/repo-card.scss" "Fingerprint" $fingerprint -}}
55
{{- $toCSS := dict "targetPath" "css/component-projects/repo-card.min.css" "enableSourceMap" true -}}
66
{{- $options = dict "Context" . "ToCSS" $toCSS | merge $options -}}
@@ -14,7 +14,7 @@
1414

1515
{{- /* adapter.min.css */ -}}
1616
{{- if (eq .Params.fromAdapters "projects") | and $isContentAdapter -}}
17-
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
17+
{{- $fingerprint := .Site.Store.Get "fingerprint" -}}
1818
{{- $options := dict "Source" "css/component-projects/adapter.scss" "Fingerprint" $fingerprint -}}
1919
{{- $toCSS := dict "targetPath" "css/component-projects/adapter.min.css" "enableSourceMap" true -}}
2020
{{- $options = dict "Context" . "ToCSS" $toCSS | merge $options -}}

layouts/shortcodes/gh-repo-card.html renamed to layouts/_shortcodes/gh-repo-card.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
{{- errorf "gh-repo-card shortcode: missing repo parameter" -}}
44
{{- end -}}
55

6-
{{- $headers := dict "headers" (page.Scratch.Get "githubTokenHeader") -}}
6+
{{- $headers := dict "headers" (hugo.Store.Get "githubTokenHeader") -}}
77
{{- $url := printf "https://api.github.com/repos/%v" $repo -}}
88
{{- $repoInfo := partial "function/get-remote-json" (dict "URL" $url "OPTIONS" $headers ) -}}
9-
{{- $githubLangColors := .Scratch.Get "githubLangColors" -}}
9+
{{- $githubLangColors := hugo.Store.Get "githubLangColors" -}}
1010
{{- if not $githubLangColors -}}
1111
{{- $githubLangColors = partial "function/get-remote-json" (dict "URL" "https://raw.githubusercontent.com/ozh/github-colors/master/colors.json" "OPTIONS" $headers ) -}}
12-
{{- .Scratch.Set "githubLangColors" $githubLangColors -}}
12+
{{- hugo.Store.Set "githubLangColors" $githubLangColors -}}
1313
{{- end -}}
1414

1515
{{- dict "RepoInfo" $repoInfo "GithubLangColors" $githubLangColors | partial "plugin/gh-repo-card.html" -}}

layouts/projects.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66
{{- define "content" -}}
77
{{- $params := partial "function/params.html" -}}
8-
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
8+
{{- $fingerprint := .Site.Store.Get "fingerprint" -}}
99
{{- $pages := .Pages -}}
1010
{{- $hiddenAdapters := .Param "hiddenAdapters" | default false -}}
1111
{{- if $hiddenAdapters -}}
1212
{{- $pages = where $pages "File.IsContentAdapter" "ne" true -}}
1313
{{- end -}}
1414
{{- $data := index .Site.Data (printf "projects.%v" .Language) | default .Site.Data.projects -}}
15-
{{- $toc := .Scratch.Get "toc" -}}
15+
{{- $toc := .Store.Get "toc" -}}
1616
{{- $tableOfContents := .Fragments.ToHTML ($toc.startlevel | int) ($toc.endlevel | int) false -}}
1717
{{- $contentToc := ne $tableOfContents `<nav id="TableOfContents"></nav>` -}}
1818
{{- $hasToc := $contentToc | or (gt (len $data) 0) | or (gt (len $pages) 0) -}}
@@ -109,7 +109,7 @@ <h1 class="single-title animate__animated animate__pulse animate__faster">
109109
<div class="content" id="content">
110110
{{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
111111
{{- warnf "component-projects\n%v" (T "projects.warningLayout" (dict "RelPermalink" .RelPermalink)) -}}
112-
{{- $headers := dict "headers" (.Scratch.Get "githubTokenHeader") -}}
112+
{{- $headers := dict "headers" (hugo.Store.Get "githubTokenHeader") -}}
113113
{{- $githubLangColors := partial "function/get-remote-json" (dict "URL" "https://raw.githubusercontent.com/ozh/github-colors/master/colors.json" "OPTIONS" $headers ) -}}
114114
{{- range $group := $data -}}
115115
<h2 id="{{ $group.title | anchorize }}" class="heading-element">

0 commit comments

Comments
 (0)