mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 23:38:56 +00:00
✨ Feat: add recently updated section (#50)
This commit is contained in:
@@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
|
||||
- :tada: Feat: add Artalk comment support ([#54](https://github.com/Lruihao/FixIt/issues/54), [#57](https://github.com/Lruihao/FixIt/pull/57)@hiifong)
|
||||
- :tada: Feat: add Waline comment support ([#36](https://github.com/Lruihao/FixIt/issues/36))
|
||||
- :tada: Feat: add Twikoo comment support ([#64](https://github.com/Lruihao/FixIt/issues/64))
|
||||
- :sparkles: Feat: add recently updated section ([#50](https://github.com/Lruihao/FixIt/issues/50))
|
||||
- :sparkles: Style: add media style for print view ([#61](https://github.com/Lruihao/FixIt/issues/61))
|
||||
- :sparkles: Feat: add pageStyle option ([#62](https://github.com/Lruihao/FixIt/issues/62))
|
||||
- :sparkles: Feat: add article expiration reminder support ([#51](https://github.com/Lruihao/FixIt/issues/51))
|
||||
|
||||
@@ -68,7 +68,6 @@
|
||||
}
|
||||
|
||||
.archive-item-date {
|
||||
width: 4em;
|
||||
text-align: right;
|
||||
color: $global-font-secondary-color;
|
||||
white-space: nowrap;
|
||||
|
||||
@@ -591,6 +591,13 @@ enableEmoji = true
|
||||
# amount of RSS pages
|
||||
# RSS 文章数目
|
||||
rss = 10
|
||||
# recently updated posts settings since v0.2.13
|
||||
# 最近更新文章设置 since v0.2.13
|
||||
[params.section.recentlyUpdated]
|
||||
enable = true
|
||||
rss = true
|
||||
days = 30
|
||||
maxCount = 10
|
||||
|
||||
# List (category or tag) page config
|
||||
# List (目录或标签) 页面配置
|
||||
|
||||
@@ -298,6 +298,12 @@ Please open the code block below to view the complete sample configuration :(far
|
||||
dateFormat = "01-02"
|
||||
# amount of RSS pages
|
||||
rss = 10
|
||||
# {{< version 0.2.13 >}} recently updated posts settings
|
||||
[params.section.recentlyUpdated]
|
||||
enable = false
|
||||
rss = false
|
||||
days = 30
|
||||
maxCount = 10
|
||||
|
||||
# {{< version 0.2.0 >}} List (category or tag) page config
|
||||
[params.list]
|
||||
|
||||
@@ -309,6 +309,12 @@ hugo
|
||||
dateFormat = "01-02"
|
||||
# RSS 文章数目
|
||||
rss = 10
|
||||
# {{< version 0.2.13 >}} 最近更新文章设置
|
||||
[params.section.recentlyUpdated]
|
||||
enable = false
|
||||
rss = false
|
||||
days = 30
|
||||
maxCount = 10
|
||||
|
||||
# {{< version 0.2.0 >}} List(目录或标签)页面配置
|
||||
[params.list]
|
||||
|
||||
+5
-1
@@ -29,9 +29,13 @@ other = "Category"
|
||||
|
||||
[categories]
|
||||
other = "Categories"
|
||||
|
||||
# === Taxonomy ===
|
||||
|
||||
# === Section ===
|
||||
[recentlyUpdated]
|
||||
other = "Recently Updated"
|
||||
# === Section ===
|
||||
|
||||
# === Pagination ===
|
||||
[more]
|
||||
other = "More"
|
||||
|
||||
+5
-1
@@ -30,9 +30,13 @@ other = "分类"
|
||||
|
||||
[categories]
|
||||
other = "分类"
|
||||
|
||||
# === Taxonomy ===
|
||||
|
||||
# === Section ===
|
||||
[recentlyUpdated]
|
||||
other = "最近更新"
|
||||
# === Section ===
|
||||
|
||||
# === Pagination ===
|
||||
[more]
|
||||
other = "更多"
|
||||
|
||||
+5
-1
@@ -30,9 +30,13 @@ other = "分類"
|
||||
|
||||
[categories]
|
||||
other = "分類"
|
||||
|
||||
# === Taxonomy ===
|
||||
|
||||
# === Section ===
|
||||
[recentlyUpdated]
|
||||
other = "最近更新"
|
||||
# === Section ===
|
||||
|
||||
# === Pagination ===
|
||||
[more]
|
||||
other = "更多"
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
{{- else -}}
|
||||
{{- $pages = .Paginate $pages -}}
|
||||
{{- end -}}
|
||||
{{- partial "recently-updated.html" . -}}
|
||||
{{- range $pages.PageGroups -}}
|
||||
<h3 class="group-title">{{ .Key }}</h3>
|
||||
{{- range .Pages -}}
|
||||
@@ -24,7 +25,7 @@
|
||||
<a href="{{ .RelPermalink }}" class="archive-item-link">
|
||||
{{- .Title -}}
|
||||
</a>
|
||||
<span class="archive-item-date" title={{ "2006-01-02 15:04:05" | .Date.Format }}>
|
||||
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Date.Format }}'>
|
||||
{{- $.Site.Params.section.dateFormat | default "01-02" | .Date.Format -}}
|
||||
</span>
|
||||
</article>
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
{{- if and .Site.Params.section.recentlyUpdated.enable (eq $.Paginator.PageNumber 1) -}}
|
||||
{{- $hasTitle := false }}
|
||||
{{- $postCount := 0 -}}
|
||||
{{- $maxPostCount := .Site.Params.section.recentlyUpdated.maxCount | default 10 -}}
|
||||
{{- $days := .Site.Params.section.recentlyUpdated.days | default 30 -}}
|
||||
{{- range (where .Data.Pages.ByLastmod.Reverse "Section" "!=" "") -}}
|
||||
{{- if gt (add .Lastmod.Unix (mul 86900 $days)) now.Unix -}}
|
||||
{{- if lt $postCount $maxPostCount -}}
|
||||
{{- if ne .Lastmod.Unix .Date.Unix }}
|
||||
{{- $postCount = add $postCount 1 -}}
|
||||
{{- if eq $hasTitle false -}}
|
||||
<h3 class="group-title">{{- T "recentlyUpdated" -}}</h3>
|
||||
{{- $hasTitle = true -}}
|
||||
{{- end -}}
|
||||
<article class="archive-item">
|
||||
<a href="{{ .RelPermalink }}" class="archive-item-link">
|
||||
{{- .Title -}}
|
||||
</a>
|
||||
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Lastmod.Format }}'>
|
||||
{{- default $.Site.Params.section.dateFormat | default "01-02" | .Lastmod.Format -}}
|
||||
</span>
|
||||
</article>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -34,6 +34,20 @@
|
||||
</lastBuildDate>
|
||||
{{- end -}}
|
||||
<atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" />
|
||||
{{- if .Site.Params.section.recentlyUpdated.rss -}}
|
||||
{{- $postCount := 0 -}}
|
||||
{{- $maxPostCount := .Site.Params.section.recentlyUpdated.maxCount | default 10 -}}
|
||||
{{- $days := .Site.Params.section.recentlyUpdated.days | default 30 -}}
|
||||
{{- range (where .Data.Pages.ByLastmod.Reverse "Section" "!=" "") -}}
|
||||
{{- if gt (add .Lastmod.Unix (mul 86900 $days)) now.Unix -}}
|
||||
{{- if lt $postCount $maxPostCount -}}
|
||||
{{- if ne .Lastmod.Unix .Date.Unix }}
|
||||
{{- dict "Page" . "Site" .Site | partial "rss/item.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- range .Pages | first (.Site.Params.section.rss | default 10) -}}
|
||||
{{- dict "Page" . "Site" .Site | partial "rss/item.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
{{- /* Content */ -}}
|
||||
<div class="content" id="content">
|
||||
{{- /* Expiration Reminder */ -}}
|
||||
{{- partial "single/expirationReminder.html" . -}}
|
||||
{{- partial "single/expiration-reminder.html" . -}}
|
||||
{{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user