mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-09-02 19:52:40 +00:00
Merge branch 'v0.2.18-lts' into 1.0.0
* v0.2.18-lts: (22 commits) 🔖 Chore(release): 0.2.18-lts.5 📝 Docs: update chang log and docs 🔧 Chore: change the theme minimum supported Hugo versions above **0.110.0** 🔧 Chore: update default config in `hugo.toml` 🐛 Fix: active index of toc may result in error ✨ Feat: add hiddenFromRss param and front matter ⚡ Perf: preload some stylesheet 🔧 Chore: add Vercel config (#277) 🐛 Fix: fix logic error of lightgallery images rendering 📝 Docs: update the outputs configuration to avoid the following warnings in versions above Hugo 0.112.0 (resolve #354) 📝 Docs: update content license 🐛 Style: fix the emoji style of valine comment (resolve #376) ⚡ Perf: optimize featured image rendering 🔧 Chore: add decoding and referrerpolicy options for img plugin 🚸 Feat: change bilibili shortcode `muted` default value 🔖 Chore(release): 0.2.18-lts.4 📝 Docs: update change log for v0 ✨ Feat: add more options support for bilibili shortcode, e.g. `autoplay`, `muted` etc. (resolve #375) 🐛 Fix: disable encrypted articles from rendering to rss (fixed #374) 🐛 Fix: fix featured image path error in rss and show img tags in rss ...
This commit is contained in:
@@ -8,7 +8,37 @@ All notable changes to this project will be documented in this file.
|
||||
> Snapshot: <>
|
||||
|
||||
- :sparkles: Feat: add code block attributes support ([#330](https://github.com/hugo-fixit/FixIt/issues/330))
|
||||
- :sparkles: Feat: add options to cache remote image locally ([#362](https://github.com/hugo-fixit/FixIt/pull/362) Fixes [#348](https://github.com/hugo-fixit/FixIt/issues/348))
|
||||
- :sparkles: Feat: change post nav rule at post footer
|
||||
- :sparkles: Feat: add hiddenFromRss param and front matter
|
||||
- :zap: Perf: optimize lightgallery images rendering
|
||||
- :zap: Perf: preload some stylesheet
|
||||
- :bug: Fix: use dateFormat function to render localized dates (@stefanoginobili [#355](https://github.com/hugo-fixit/FixIt/pull/355))
|
||||
- :bug: Fix: total word count error in section
|
||||
- :bug: Fix: fix path errors in image src and 1.5x srcset ([#346](https://github.com/hugo-fixit/FixIt/issues/346))
|
||||
- :bug: Fix: fix toc active error when breadcrumb is enabled and set `sticky` to `true` ([#368](https://github.com/hugo-fixit/FixIt/issues/368))
|
||||
- :bug: Fix: add a option "Responsive" for plugin image fixed [#369](https://github.com/hugo-fixit/FixIt/issues/369)
|
||||
- :bug: Fix: fix featured image path error and show img tags in rss ([#373](https://github.com/hugo-fixit/FixIt/issues/373))
|
||||
- :bug: Fix: disable encrypted articles from rendering to rss ([#374](https://github.com/hugo-fixit/FixIt/issues/374))
|
||||
- :sparkles: Feat: add more options support for bilibili shortcode, e.g. `autoplay`, `muted` etc. ([#375](https://github.com/hugo-fixit/FixIt/issues/375))
|
||||
- :bug: Style: fix the emoji style of valine comment ([#376](https://github.com/hugo-fixit/FixIt/issues/376))
|
||||
- :bug: Fix: active index of toc may result in error ([#305](https://github.com/hugo-fixit/FixIt/issues/305))
|
||||
- :lipstick: Style: update define list style
|
||||
- :lipstick: Style: update footnote and footnote-ref style
|
||||
- :memo: Docs: update the outputs configuration to avoid the "taxonomyterm" warning in versions above Hugo 0.112.0 (resolve [#354](https://github.com/hugo-fixit/FixIt/issues/354))
|
||||
- :wrench: Chore: update default config in `hugo.toml`
|
||||
- :wrench: Chore: change the theme minimum supported Hugo versions above **0.110.0**
|
||||
- :arrow_up: Chore(libs):
|
||||
- Update algoliasearch from 4.14.2 to 4.20.0
|
||||
- Update Artalk from 2.5.2 to 2.6.4
|
||||
- Update fontawesome-free from 6.2.0 to 6.4.2
|
||||
- Update instant.page from 5.1.1 to 5.2.0
|
||||
- Update katex from 0.16.2 to 0.16.9
|
||||
- Update lightgallery from 2.6.1 to 2.7.2
|
||||
- Removed Renren, Digg and StumbleUpon in sharer.js 0.5.0
|
||||
- Update Twikoo from 1.6.8 to 1.6.22
|
||||
- Update vConsole from 3.14.6 to 3.15.1
|
||||
- Update eruda from 2.5.0 to 3.0.1
|
||||
- Update Waline from 2.14.7 to 2.15.8
|
||||
- Update simple-icons from 7.12.0 to 9.19.0
|
||||
- **Full Changelog:** @Lruihao [`v0.2.18...v1.0.0`](https://github.com/hugo-fixit/FixIt/compare/v0.2.18...v1.0.0)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# FixIt Theme | Hugo
|
||||
|
||||
[](https://github.com/hugo-fixit/FixIt/releases)
|
||||
[](https://gohugo.io/)
|
||||
[](https://gohugo.io/)
|
||||
[](/LICENSE)
|
||||
|
||||
👉 English README | [简体中文说明](README.zh-cn.md)
|
||||
@@ -45,7 +45,7 @@ And later you can update the submodule in your site directory to the latest comm
|
||||
git submodule update --remote --merge
|
||||
```
|
||||
|
||||
Next, go to the `config.toml` and change the default theme to `FixIt`.
|
||||
Next, go to the `hugo.toml` and change the default theme to `FixIt`.
|
||||
|
||||
```diff
|
||||
- theme = "LoveIt"
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
# FixIt 主题 | Hugo
|
||||
|
||||
[](https://github.com/hugo-fixit/FixIt/releases)
|
||||
[](https://gohugo.io/)
|
||||
[](https://gohugo.io/)
|
||||
[](/LICENSE)
|
||||
|
||||
👉 [English README](README.md) | 简体中文说明
|
||||
@@ -45,7 +45,7 @@ git submodule add https://github.com/hugo-fixit/FixIt.git themes/FixIt
|
||||
git submodule update --remote --merge
|
||||
```
|
||||
|
||||
接着,前往 `config.toml` 并将默认主题更改为 `FixIt`。
|
||||
接着,前往 `hugo.toml` 并将默认主题更改为 `FixIt`。
|
||||
|
||||
```diff
|
||||
- theme = "LoveIt"
|
||||
|
||||
@@ -19,6 +19,7 @@ categories:
|
||||
- draft
|
||||
hiddenFromHomePage: false
|
||||
hiddenFromSearch: false
|
||||
hiddenFromRss: false
|
||||
summary:
|
||||
resources:
|
||||
- name: featured-image
|
||||
|
||||
@@ -19,6 +19,7 @@ categories:
|
||||
- draft
|
||||
hiddenFromHomePage: false
|
||||
hiddenFromSearch: false
|
||||
hiddenFromRss: false
|
||||
summary:
|
||||
resources:
|
||||
- name: featured-image
|
||||
|
||||
@@ -290,7 +290,7 @@
|
||||
height: auto;
|
||||
}
|
||||
|
||||
&:is([loading='lazy']):not([data-lazyloaded]) {
|
||||
&[loading='lazy'][srcset]:not([data-lazyloaded]) {
|
||||
&:not(.suffix-invalid__small) {
|
||||
width: var(--width-small, var(--width));
|
||||
aspect-ratio: var(--aspect-ratio-small, var(--aspect-ratio));
|
||||
@@ -338,10 +338,6 @@
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
overflow: hidden;
|
||||
|
||||
&:not([width]) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -525,7 +525,7 @@ class FixIt {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (activeTocIndex !== -1) {
|
||||
if (activeTocIndex !== -1 && $tocLinkElements[activeTocIndex]) {
|
||||
$tocLinkElements[activeTocIndex].classList.add('active');
|
||||
let $parent = $tocLinkElements[activeTocIndex].parentElement;
|
||||
while ($parent !== $tocCore) {
|
||||
|
||||
@@ -64,9 +64,4 @@ $code-background-color-dark: #272C34 !default;
|
||||
background: $code-background-color-dark;
|
||||
}
|
||||
}
|
||||
|
||||
.emoji, .vemoji {
|
||||
max-width: 1.5em;
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
}
|
||||
+1
-1
Submodule docs updated: 6ab29deffb...f2d1caa1f3
+35
-2
@@ -3,6 +3,36 @@
|
||||
# Modifying this file may result in merge conflict
|
||||
# =====================================================================================
|
||||
|
||||
# -------------------------------------------------------------------------------------
|
||||
# Hugo Configuration
|
||||
# See: https://gohugo.io/getting-started/configuration/
|
||||
# -------------------------------------------------------------------------------------
|
||||
|
||||
# website title
|
||||
title = "FixIt"
|
||||
# Hostname (and path) to the root
|
||||
baseURL = "http://localhost:1313"
|
||||
# theme list
|
||||
theme = ["FixIt"]
|
||||
# determines default content language ["en", "zh-cn", "fr", "pl", ...]
|
||||
defaultContentLanguage = "en"
|
||||
# language code ["en", "zh-CN", "fr", "pl", ...]
|
||||
languageCode = "en"
|
||||
# language name ["English", "简体中文", "Français", "Polski", ...]
|
||||
languageName = "English"
|
||||
# whether to include Chinese/Japanese/Korean
|
||||
hasCJKLanguage = false
|
||||
# default amount of posts in each pages
|
||||
paginate = 12
|
||||
# copyright description used only for seo schema
|
||||
copyright = ""
|
||||
# whether to use robots.txt
|
||||
enableRobotsTXT = true
|
||||
# whether to use git commit log
|
||||
enableGitInfo = true
|
||||
# whether to use emoji code
|
||||
enableEmoji = true
|
||||
|
||||
# -------------------------------------------------------------------------------------
|
||||
# Menu Configuration
|
||||
# See: https://fixit.lruihao.cn/documentation/basics/#menu-configuration
|
||||
@@ -359,6 +389,8 @@
|
||||
hiddenFromHomePage = false
|
||||
# FixIt 0.2.0 | NEW whether to hide a page from search results
|
||||
hiddenFromSearch = false
|
||||
# FixIt 0.2.18-lts.5 | NEW whether to hide a page from RSS feed
|
||||
hiddenFromRss = false
|
||||
# FixIt 0.2.0 | NEW whether to enable twemoji
|
||||
twemoji = false
|
||||
# whether to enable lightgallery
|
||||
@@ -371,7 +403,7 @@
|
||||
# FixIt 0.2.0 | NEW whether to enable the fontawesome extended syntax
|
||||
fontawesome = true
|
||||
# license info (HTML format is supported)
|
||||
license = '<a rel="license external nofollow noopener noreferrer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
|
||||
license = '<a rel="license external nofollow noopener noreferrer" href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a>'
|
||||
# whether to show link to Raw Markdown content of the content
|
||||
linkToMarkdown = true
|
||||
# FixIt 0.2.4 | NEW whether to show the full text content in RSS
|
||||
@@ -840,7 +872,8 @@
|
||||
# Modules Configuration
|
||||
# See: https://gohugo.io/hugo-modules/configuration/#module-config-imports
|
||||
# -------------------------------------------------------------------------------------
|
||||
|
||||
[module]
|
||||
[module.hugoVersion]
|
||||
extended = true
|
||||
min = "0.109.0"
|
||||
min = "0.110.0"
|
||||
@@ -1,11 +1,11 @@
|
||||
{{- if .Title -}}
|
||||
{{- if .Title | and .Text -}}
|
||||
<figure>
|
||||
{{- dict "Src" .Destination "Alt" .Text "Caption" .Text "Title" .Title "Linked" true "Resources" .Page.Resources "Params" .Page.Params | partial "plugin/image.html" -}}
|
||||
{{- dict "Src" .Destination "Alt" .Text "Caption" .Text "Title" .Title "Linked" true "Resources" .Page.Resources "Params" .Page.Params "Responsive" true | partial "plugin/image.html" -}}
|
||||
<figcaption class="image-caption">
|
||||
{{- .Text | safeHTML -}}
|
||||
</figcaption>
|
||||
</figure>
|
||||
{{- else -}}
|
||||
{{- $linked := (eq .Page.Site.Params.page.lightgallery "force") | or (eq .Page.Params.lightgallery "force") -}}
|
||||
{{- dict "Src" .Destination "Alt" .Text "Linked" $linked "Resources" .Page.Resources "Params" .Page.Params | partial "plugin/image.html" -}}
|
||||
{{- $linked := (eq (.Page.Scratch.Get "params").lightgallery "force") | or (ne .Title "") -}}
|
||||
{{- dict "Src" .Destination "Alt" .Text "Title" .Title "Linked" $linked "Resources" .Page.Resources "Params" .Page.Params "Responsive" true | partial "plugin/image.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
{{- with $image -}}
|
||||
<div class="featured-image-preview">
|
||||
<a href="{{ $.RelPermalink }}" aria-label="{{ $.Title }}">
|
||||
{{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/image.html" -}}
|
||||
{{- dict "Src" . "Title" $.Description "Alt" $.Title "Resources" $.Resources | partial "plugin/image.html" -}}
|
||||
</a>
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
{{ range $index, $friend := .Site.Data.friends }}
|
||||
<a class="friend-link" title="{{ $friend.description }}" href="{{ $friend.url | safeURL }}" rel="external noopener noreferrer" target="_blank">
|
||||
{{ if $friend.avatar }}
|
||||
{{- dict "Src" $friend.avatar "Alt" $friend.nickname "Class" "friend-avatar" "Resources" $.Resources | partial "plugin/image.html" -}}
|
||||
{{- dict "Src" $friend.avatar "Alt" $friend.nickname "Class" "friend-avatar" "Resources" $.Resources "Params" $.Params | partial "plugin/image.html" -}}
|
||||
{{ else }}
|
||||
<svg class="friend-avatar" aria-hidden="true">
|
||||
<use xlink:href="#icon-{{ add 1 $index }}"></use>
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
|
||||
{{ end }}
|
||||
{{- range where .Site.RegularPages "Type" "posts" | first (.Site.Params.home.rss | default 10) -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- if $params.password | or $params.hiddenFromRss }}{{ continue }}{{ end -}}
|
||||
{{- dict "Page" . "Site" .Site | partial "rss/item.html" -}}
|
||||
{{- end -}}
|
||||
</channel>
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
{{- $math := .Scratch.Get "math" -}}
|
||||
{{- if $math.enable -}}
|
||||
{{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Preload" true | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.katexJS | default "lib/katex/katex.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $source := $cdn.katexAutoRenderJS | default "lib/katex/auto-render.min.js" -}}
|
||||
@@ -133,7 +133,7 @@
|
||||
{{- /* Mapbox GL */ -}}
|
||||
{{- if (.Scratch.Get "this").mapbox -}}
|
||||
{{- $source := $cdn.mapboxGLCSS | default "lib/mapbox-gl/mapbox-gl.css" -}}
|
||||
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint "Preload" true | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source = $cdn.mapboxGLJS | default "lib/mapbox-gl/mapbox-gl.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" "lib/mapbox-gl/mapbox-gl-language.js" "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
@@ -144,7 +144,7 @@
|
||||
{{- if (.Scratch.Get "this").music -}}
|
||||
{{- /* APlayer */ -}}
|
||||
{{- $source := $cdn.aplayerCSS | default "lib/aplayer/APlayer.min.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Preload" true | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $options := dict "targetPath" "lib/aplayer/dark.min.css" "enableSourceMap" true -}}
|
||||
{{- dict "Source" "lib/aplayer/dark.scss" "ToCSS" $options "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.aplayerJS | default "lib/aplayer/APlayer.min.js" -}}
|
||||
|
||||
@@ -32,17 +32,17 @@
|
||||
{{- end -}}
|
||||
|
||||
{{- /* style.min.css */ -}}
|
||||
{{- $style := dict "Source" "css/style.scss" "Fingerprint" $fingerprint -}}
|
||||
{{- $options := dict "targetPath" "css/style.min.css" "enableSourceMap" true -}}
|
||||
{{- $style = dict "Context" . "ToCSS" $options | merge $style -}}
|
||||
{{- partial "plugin/style.html" $style -}}
|
||||
{{- $options := dict "Source" "css/style.scss" "Fingerprint" $fingerprint -}}
|
||||
{{- $toCSS := dict "targetPath" "css/style.min.css" "enableSourceMap" true -}}
|
||||
{{- $options = dict "Context" . "ToCSS" $toCSS | merge $options -}}
|
||||
{{- partial "plugin/style.html" $options -}}
|
||||
|
||||
{{- /* Font Awesome */ -}}
|
||||
{{- $source := $cdn.fontawesomeFreeCSS | default "lib/fontawesome-free/all.min.css" -}}
|
||||
{{- $style := dict "Source" $source "Fingerprint" $fingerprint -}}
|
||||
{{- partial "plugin/style.html" $style -}}
|
||||
{{- $options := dict "Source" $source "Fingerprint" $fingerprint "Preload" true -}}
|
||||
{{- partial "plugin/style.html" $options -}}
|
||||
|
||||
{{- /* Animate.css */ -}}
|
||||
{{- $source := $cdn.animateCSS | default "lib/animate/animate.min.css" -}}
|
||||
{{- $style := dict "Source" $source "Fingerprint" $fingerprint -}}
|
||||
{{- partial "plugin/style.html" $style -}}
|
||||
{{- $options := dict "Source" $source "Fingerprint" $fingerprint "Preload" true -}}
|
||||
{{- partial "plugin/style.html" $options -}}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
{{- /* this method is only available for image resources that are raster images */ -}}
|
||||
{{- $src := .Src -}}
|
||||
{{- $class := .Class | default "" -}}
|
||||
{{- $style := "" -}}
|
||||
{{- $loading := .Loading | default "lazy" -}}
|
||||
@@ -7,53 +5,66 @@
|
||||
{{- $onerror := "" -}}
|
||||
{{- $cacheRemoteImages := (.Params.cacheRemoteImages | default dict) | merge site.Params.cacheRemoteImages -}}
|
||||
{{- $suffixList := slice ".jpeg" ".jpg" ".png" ".gif" ".bmp" ".tif" ".tiff" ".webp" -}}
|
||||
{{- $suffixValid := dict "Path" .Src "Suffixes" $suffixList | partial "function/suffix-validation.html" -}}
|
||||
{{- $suffixValidSmall := dict "Path" .SrcSmall "Suffixes" $suffixList | partial "function/suffix-validation.html" -}}
|
||||
{{- $suffixValidLarge := dict "Path" .SrcLarge "Suffixes" $suffixList | partial "function/suffix-validation.html" -}}
|
||||
|
||||
{{- /* handle for invalid suffix */ -}}
|
||||
{{- if not $suffixValid | and .Src -}}
|
||||
{{- $class = printf "%v suffix-invalid" $class -}}
|
||||
{{- end -}}
|
||||
{{- if not $suffixValidSmall | and .SrcSmall -}}
|
||||
{{- $class = printf "%v suffix-invalid__small" $class -}}
|
||||
{{- end -}}
|
||||
{{- if not $suffixValidLarge | and .SrcLarge -}}
|
||||
{{- $class = printf "%v suffix-invalid__large" $class -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* handle for default size image */ -}}
|
||||
{{- $src := .Src -}}
|
||||
{{- $suffixValid := dict "Path" $src "Suffixes" $suffixList | partial "function/suffix-validation.html" -}}
|
||||
{{- with dict "Path" $src "Resources" .Resources "CacheRemoteImages" $cacheRemoteImages.enable | partial "function/resource.html" -}}
|
||||
{{- $url := urls.Parse $src -}}
|
||||
{{- if not $url.Host | or $cacheRemoteImages.replace -}}
|
||||
{{- $src = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- if (eq .ResourceType "image") | and $suffixValid -}}
|
||||
{{- /* only available for image resources that are raster images */ -}}
|
||||
{{- if (eq .ResourceType "image") | and $suffixValid | and $.Responsive -}}
|
||||
{{- $style = printf "--width: %vpx;--aspect-ratio: %v / %v;" .Width .Width .Height | safeHTMLAttr -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* handle for small size image */ -}}
|
||||
{{- $srcSmall := .SrcSmall | default $src -}}
|
||||
{{- with dict "Path" .SrcSmall "Resources" .Resources "CacheRemoteImages" $cacheRemoteImages.enable | partial "function/resource.html" -}}
|
||||
{{- $url := urls.Parse $.SrcSmall -}}
|
||||
{{- if not $url.Host | or $cacheRemoteImages.replace -}}
|
||||
{{- $srcSmall = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- if (eq .ResourceType "image") | and $suffixValidSmall -}}
|
||||
{{- $style = printf "%v--width-small: %vpx;--aspect-ratio-small: %v / %v;" $style .Width .Width .Height | safeHTMLAttr -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* handle for large size image */ -}}
|
||||
{{- $srcMedium := $src -}}
|
||||
{{- $srcLarge := .SrcLarge | default $src -}}
|
||||
{{- with dict "Path" .SrcLarge "Resources" .Resources "CacheRemoteImages" $cacheRemoteImages.enable | partial "function/resource.html" -}}
|
||||
{{- $url := urls.Parse $.SrcLarge -}}
|
||||
{{- if not $url.Host | or $cacheRemoteImages.replace -}}
|
||||
{{- $srcLarge = .RelPermalink -}}
|
||||
|
||||
{{- if .Responsive }}
|
||||
{{- /* handle for small size image */ -}}
|
||||
{{- $suffixValidSmall := dict "Path" $srcSmall "Suffixes" $suffixList | partial "function/suffix-validation.html" -}}
|
||||
{{- with dict "Path" .SrcSmall "Resources" .Resources "CacheRemoteImages" $cacheRemoteImages.enable | partial "function/resource.html" -}}
|
||||
{{- $url := urls.Parse $.SrcSmall -}}
|
||||
{{- if not $url.Host | or $cacheRemoteImages.replace -}}
|
||||
{{- $srcSmall = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- if (eq .ResourceType "image") | and $suffixValidSmall -}}
|
||||
{{- $style = printf "%v--width-small: %vpx;--aspect-ratio-small: %v / %v;" $style .Width .Width .Height | safeHTMLAttr -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if (eq .ResourceType "image") | and $suffixValidLarge -}}
|
||||
{{- $style = printf "%v--width-large: %vpx;--aspect-ratio-large: %v / %v;" $style .Width .Width .Height | safeHTMLAttr -}}
|
||||
|
||||
{{- /* handle for large size image */ -}}
|
||||
{{- $suffixValidLarge := dict "Path" $srcLarge "Suffixes" $suffixList | partial "function/suffix-validation.html" -}}
|
||||
{{- with dict "Path" .SrcLarge "Resources" .Resources "CacheRemoteImages" $cacheRemoteImages.enable | partial "function/resource.html" -}}
|
||||
{{- $url := urls.Parse $.SrcLarge -}}
|
||||
{{- if not $url.Host | or $cacheRemoteImages.replace -}}
|
||||
{{- $srcLarge = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- if (eq .ResourceType "image") | and $suffixValidLarge -}}
|
||||
{{- $style = printf "%v--width-large: %vpx;--aspect-ratio-large: %v / %v;" $style .Width .Width .Height | safeHTMLAttr -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* handle for invalid suffix */ -}}
|
||||
{{- if not $suffixValid | and $src -}}
|
||||
{{- $class = printf "%v suffix-invalid" $class -}}
|
||||
{{- end -}}
|
||||
{{- if not $suffixValidSmall | and $srcSmall -}}
|
||||
{{- $class = printf "%v suffix-invalid__small" $class -}}
|
||||
{{- end -}}
|
||||
{{- if not $suffixValidLarge | and $srcLarge -}}
|
||||
{{- $class = printf "%v suffix-invalid__large" $class -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* set image srcset */ -}}
|
||||
{{- if (eq $src $srcSmall) | and (eq $src $srcLarge) -}}
|
||||
{{- $srcSmall = printf (cond (strings.Contains $srcSmall "?") "%v&size=small" "%v?size=small") $srcSmall -}}
|
||||
{{- $srcMedium = printf (cond (strings.Contains $srcMedium "?") "%v&size=medium" "%v?size=medium") $srcMedium -}}
|
||||
{{- $srcLarge = printf (cond (strings.Contains $srcLarge "?") "%v&size=large" "%v?size=large") $srcLarge -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -71,21 +82,19 @@
|
||||
{{- $style = printf " style=\"%vbackground: url(%v) no-repeat center;\"" $style (resources.Get "svg/loading.svg" | minify).RelPermalink | safeHTMLAttr -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* set image srcset */ -}}
|
||||
{{- $srcSmall = printf (cond (strings.Contains $srcSmall "?") "%v&size=small" "%v?size=small") $srcSmall -}}
|
||||
{{- $srcMedium := printf (cond (strings.Contains $src "?") "%v&size=medium" "%v?size=medium") $src -}}
|
||||
{{- $srcLarge = printf (cond (strings.Contains $srcLarge "?") "%v&size=large" "%v?size=large") $srcLarge -}}
|
||||
|
||||
{{- /* structure of lightgallery or img */ -}}
|
||||
{{- if .Linked -}}
|
||||
<a class="lightgallery" href="{{ $srcLarge | safeURL }}" data-thumbnail="{{ $srcSmall | safeURL }}"{{ with $caption }} data-sub-html="<h2>{{ . }}</h2>{{ with $.Title }}<p>{{ . }}</p>{{ end }}"{{ end }}{{ with .Rel }} rel="{{ . }}"{{ end }}>
|
||||
{{- end -}}
|
||||
<img loading="{{ $loading }}" src="{{ $src | safeURL }}" srcset="{{ $srcSmall | safeURL }}, {{ $srcMedium | safeURL }} 1.5x, {{ $srcLarge | safeURL }} 2x" sizes="auto"
|
||||
<img loading="{{ $loading }}" src="{{ $src | safeURL }}"
|
||||
{{- if .Responsive }} srcset="{{ $srcSmall | safeURL }}, {{ $srcMedium | safeURL }} 1.5x, {{ $srcLarge | safeURL }} 2x" sizes="auto"{{- end -}}
|
||||
{{- if eq $loading "lazy" }} data-title="{{ .Title | default $alt }}" data-alt="{{ $alt }}"
|
||||
{{- else }} title="{{ .Title | default $alt }}" alt="{{ $alt }}"{{- end -}}
|
||||
{{- with .Width }} width="{{ . }}"{{- end -}}
|
||||
{{- with .Height }} height="{{ . }}"{{- end -}}
|
||||
{{- with $class }} class="{{ trim . " " }}"{{- end -}}
|
||||
{{- with .Decoding }} decoding="{{ . }}"{{- end -}}
|
||||
{{- with .Referrerpolicy }} referrerpolicy="{{ . }}"{{- end -}}
|
||||
{{- with $style -}}{{ . }}{{- end -}}
|
||||
{{- with $onload -}}{{ . }}{{- end -}}
|
||||
{{- with $onerror -}}{{ . }}{{- end -}}
|
||||
|
||||
@@ -27,5 +27,20 @@
|
||||
{{- end -}}
|
||||
{{- $href = $resource.RelPermalink -}}
|
||||
{{- end -}}
|
||||
<link rel="stylesheet" href="{{ $href }}"{{ if .Crossorigin }} crossorigin="anonymous"{{ end }}{{ with $integrity }} integrity="{{ . }}"{{ end }}{{ with .Attr }} {{ . | safeHTMLAttr }}{{ end }}>
|
||||
{{- $attrs := printf `href="%v"` $href -}}
|
||||
{{- if .Crossorigin -}}
|
||||
{{- $attrs = ` crossorigin="anonymous"` | add $attrs -}}
|
||||
{{- end -}}
|
||||
{{- with $integrity -}}
|
||||
{{- $attrs = printf ` integrity="%v"` . | add $attrs -}}
|
||||
{{- end -}}
|
||||
{{- with .Attr -}}
|
||||
{{- $attrs = add " " . | add $attrs -}}
|
||||
{{- end -}}
|
||||
{{- if .Preload -}}
|
||||
<link rel="preload" {{ $attrs | safeHTMLAttr }} as="style" onload="this.removeAttribute('onload');this.rel='stylesheet'">
|
||||
<noscript><link rel="stylesheet" {{ $attrs | safeHTMLAttr }}></noscript>
|
||||
{{- else -}}
|
||||
<link rel="stylesheet" {{ $attrs | safeHTMLAttr }}>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -7,6 +7,13 @@
|
||||
{{- $authorName = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $image := $params.featuredimagepreview | default $params.featuredimage -}}
|
||||
{{- with .Page.Resources.GetMatch "featured-image" -}}
|
||||
{{- $image = .Permalink -}}
|
||||
{{- end -}}
|
||||
{{- with .Page.Resources.GetMatch "featured-image-preview" -}}
|
||||
{{- $image = .Permalink -}}
|
||||
{{- end -}}
|
||||
|
||||
<item>
|
||||
<title>
|
||||
@@ -24,9 +31,9 @@
|
||||
</guid>
|
||||
<description>
|
||||
{{- "<![CDATA[" | safeHTML -}}
|
||||
{{- with $params.featuredimage -}}
|
||||
{{- with $image -}}
|
||||
<div class="featured-image">
|
||||
<img src="{{ . | relURL }}" referrerpolicy="no-referrer">
|
||||
{{- dict "Src" . "Title" $.Page.Description "Alt" $.Page.Title "Resources" $.Page.Resources "Loading" "eager" "Referrerpolicy" "no-referrer" | partial "plugin/image.html" -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
{{- $content := .Page.Description -}}
|
||||
@@ -37,7 +44,8 @@
|
||||
{{- $content = dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $content | replaceRE `<figure[^>]*>.*</figure>` "" | replaceRE `<img[^>]*( /)?>` "" | safeHTML -}}
|
||||
{{/* {{- $content | replaceRE `<figure[^>]*>.*</figure>` "" | replaceRE `<img[^>]*( /)?>` "" | safeHTML -}} */}}
|
||||
{{- $content | safeHTML -}}
|
||||
{{- "]]>" | safeHTML -}}
|
||||
</description>
|
||||
</item>
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
{{- /* reference https://player.bilibili.com/ */ -}}
|
||||
{{- $bvid := cond .IsNamedParams (.Get "id") (.Get 0) -}}
|
||||
{{- $p := cond .IsNamedParams (.Get "p") (.Get 1) | default 1 -}}
|
||||
{{- $autoplay := .Get "autoplay" | default false -}}
|
||||
{{- $poster := .Get "poster" | default true -}}
|
||||
{{- $muted := .Get "muted" | default false -}}
|
||||
{{- $danmaku := .Get "danmaku" | default true -}}
|
||||
{{- $t := .Get "t" | default 0 -}}
|
||||
|
||||
<div class="bilibili">
|
||||
{{- if .IsNamedParams -}}
|
||||
<iframe src="//player.bilibili.com/player.html?bvid={{ .Get `id` }}&page={{ .Get `p` | default 1 }}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
|
||||
{{- else -}}
|
||||
<iframe src="//player.bilibili.com/player.html?bvid={{ .Get 0 }}&page={{ .Get 1 | default 1 }}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
|
||||
{{- end -}}
|
||||
<iframe src="//player.bilibili.com/player.html?bvid={{ $bvid }}&page={{ $p }}&autoplay={{ $autoplay }}&poster={{ $poster }}&muted={{ $muted }}&danmaku={{ $danmaku }}&t={{ $t }}" border="0" framespacing="0" allowfullscreen="true"></iframe>
|
||||
</div>
|
||||
{{- /* EOF */ -}}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
{{- $options = cond $caption true false | dict "Linked" | merge $options -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $options = dict "Resources" .Page.Resources "Params" .Page.Params | merge $options -}}
|
||||
{{- $options = dict "Resources" .Page.Resources "Params" .Page.Params "Responsive" true | merge $options -}}
|
||||
|
||||
{{- with $caption -}}
|
||||
<figure{{ with cond $.IsNamedParams ($.Get "class") "" }} class="{{ . }}"{{ end }}>
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ licenselink = "https://github.com/hugo-fixit/FixIt/blob/master/LICENSE"
|
||||
description = "A Clean, Elegant but Advanced Hugo Theme for Hugo."
|
||||
homepage = "https://github.com/hugo-fixit/FixIt"
|
||||
demosite = "https://fixit.lruihao.cn"
|
||||
min_version = "0.109.0"
|
||||
min_version = "0.110.0"
|
||||
|
||||
tags = [
|
||||
"blog",
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"routes": [
|
||||
{
|
||||
"handle": "filesystem"
|
||||
},
|
||||
{
|
||||
"src": "/zh-cn/(.*)",
|
||||
"status": 404,
|
||||
"dest": "/zh-cn/404.html"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user