🔧 Re Change default section display not use archive page.
This commit is contained in:
parent
832953372a
commit
6cbffe48b7
3
.gitignore
vendored
3
.gitignore
vendored
@ -3,8 +3,9 @@
|
|||||||
exampleSite/*
|
exampleSite/*
|
||||||
|
|
||||||
# Exclude special files in content folder
|
# Exclude special files in content folder
|
||||||
|
exampleSite/content/**/
|
||||||
!exampleSite/content
|
!exampleSite/content
|
||||||
exampleSite/content/*
|
!exmapleSite/content/about.md
|
||||||
!exampleSite/content/archives
|
!exampleSite/content/archives
|
||||||
!exampleSite/content/post
|
!exampleSite/content/post
|
||||||
|
|
||||||
|
27
exampleSite/content/about.md
Normal file
27
exampleSite/content/about.md
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
title: "关于 Hugo NexT 组织"
|
||||||
|
description: ""
|
||||||
|
|
||||||
|
date: 2022-06-09T20:12:52+08:00
|
||||||
|
lastmod: 2022-06-09T20:12:52+08:00
|
||||||
|
|
||||||
|
share: false
|
||||||
|
followme: false
|
||||||
|
nav: false
|
||||||
|
copyright: false
|
||||||
|
url: about.html
|
||||||
|
---
|
||||||
|
|
||||||
|
`Hugo NexT` 组织是由众多喜爱 `NexT` 主题及风格的世界各地友人共同组建而成,为的就是让这个主题继续在 `Hugo` 引擎中也能得到发扬光大,在此也欢迎你的加入!
|
||||||
|
|
||||||
|
# 我们的愿景
|
||||||
|
|
||||||
|
延续 `NexT` 经典的黑白调搭配,保持简单的易用性及强大的功能。
|
||||||
|
|
||||||
|
# 使用反馈
|
||||||
|
|
||||||
|
- 加入 [GitHub Discussions](https://github.com/hugo-next/hugo-theme-next/discussions) 或 [Gitter](https://gitter.im/hugo-next/community) 在线讨论 :beers:
|
||||||
|
- [GitHub Issues](https://github.com/hugo-next/hugo-theme-next/issues/new?labels=Bug&template=bug-report.md) 提交错误报告 :bug:
|
||||||
|
- [GitHub Feature](https://github.com/hugo-next/hugo-theme-next/issues/new?labels=Feature+Request&template=feature-request.md) 表新功能的想法 :sparkles:
|
||||||
|
|
||||||
|
> 同时国内用户也可加入 QQ 群交流: 604710815
|
@ -20,4 +20,4 @@ EOT
|
|||||||
|
|
||||||
next `cat ../VERSION`
|
next `cat ../VERSION`
|
||||||
|
|
||||||
hugo server -D -t ../.. --port 1414 --panicOnWarning --config config.dev.yaml
|
hugo server -t ../.. --port 1414 --panicOnWarning --config config.yaml
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
{{- if and .Page.IsSection (eq .Section "archives") }}
|
{{ $paginator := .Paginator.Pages.GroupByDate "2006" }}
|
||||||
{{- $paginator := (.Paginate (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections)).Pages.GroupByDate "2006" }}
|
|
||||||
{{ partial "list.html" $paginator }}
|
{{ partial "list.html" $paginator }}
|
||||||
{{ else }}
|
|
||||||
{{- $paginator := .Paginator.Pages.GroupByDate "2006" }}
|
|
||||||
{{ partial "list.html" $paginator }}
|
|
||||||
{{- end }}
|
|
||||||
|
@ -1,39 +1,15 @@
|
|||||||
{{- define "title" }}
|
{{- define "title" }}
|
||||||
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "AllSome" }} - {{ .Site.Title -}}
|
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "AllSome" }} - {{ .Site.Title -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{ define "main_inner_class" }}archive posts-collapse{{ end }}
|
{{ define "main_inner_class" }}index posts-expand{{ end }}
|
||||||
|
|
||||||
{{- define "main" }}
|
{{- define "main" }}
|
||||||
<div class="post-block">
|
|
||||||
<div class="post-content">
|
|
||||||
<div class="collection-title">
|
|
||||||
{{- $cheers := "Um" }}
|
|
||||||
{{- $posts := .Scratch.Get "postsCount" }}
|
|
||||||
{{- if and .Page.IsSection (ne .Section "archives") }}
|
|
||||||
{{- $posts = .Scratch.Get .Section }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if gt $posts 210 }}
|
|
||||||
{{- $cheers = "Excellent" }}
|
|
||||||
{{- else if gt $posts 130 }}
|
|
||||||
{{- $cheers = "Great" }}
|
|
||||||
{{- else if gt $posts 80 }}
|
|
||||||
{{- $cheers = "Good" }}
|
|
||||||
{{- else if gt $posts 50 }}
|
|
||||||
{{- $cheers = "Nice" }}
|
|
||||||
{{- else if gt $posts 30 }}
|
|
||||||
{{- $cheers = "Ok" }}
|
|
||||||
{{- end }}
|
|
||||||
<span class="collection-header">
|
|
||||||
{{- T (printf "PostArchiveCheers%s" $cheers) }}
|
|
||||||
{{- T "SymbolComma" }}
|
|
||||||
{{- T "ArchiveCounterTitle" $posts | safeHTML }}
|
|
||||||
{{- T "SymbolComma" }}
|
|
||||||
{{- T "PostArchiveKeepOn" }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{ .Render "list" }}
|
{{ $paginator := .Paginate (where .Site.RegularPages "Section" "==" .Section) }}
|
||||||
|
{{- range $paginator.Pages }}
|
||||||
</div>
|
{{ partial "post.html" (dict "ctx" . "IsHome" true) }}
|
||||||
</div>
|
{{- end }}
|
||||||
{{- partial "pagination.html" . }}
|
|
||||||
|
{{- partial "partials/pagination.html" . }}
|
||||||
|
|
||||||
{{- end }}
|
{{- end }}
|
2
layouts/archives/list.html
Normal file
2
layouts/archives/list.html
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
{{ $paginator := (.Paginate (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections)).Pages.GroupByDate "2006" }}
|
||||||
|
{{ partial "list.html" $paginator }}
|
36
layouts/archives/section.html
Normal file
36
layouts/archives/section.html
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{{- define "title" }}
|
||||||
|
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "AllSome" }} - {{ .Site.Title -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{ define "main_inner_class" }}archive posts-collapse{{ end }}
|
||||||
|
{{- define "main" }}
|
||||||
|
<div class="post-block">
|
||||||
|
<div class="post-content">
|
||||||
|
<div class="collection-title">
|
||||||
|
{{- $cheers := "Um" }}
|
||||||
|
{{- $posts := .Scratch.Get "postsCount" }}
|
||||||
|
{{- if gt $posts 210 }}
|
||||||
|
{{- $cheers = "Excellent" }}
|
||||||
|
{{- else if gt $posts 130 }}
|
||||||
|
{{- $cheers = "Great" }}
|
||||||
|
{{- else if gt $posts 80 }}
|
||||||
|
{{- $cheers = "Good" }}
|
||||||
|
{{- else if gt $posts 50 }}
|
||||||
|
{{- $cheers = "Nice" }}
|
||||||
|
{{- else if gt $posts 30 }}
|
||||||
|
{{- $cheers = "Ok" }}
|
||||||
|
{{- end }}
|
||||||
|
<span class="collection-header">
|
||||||
|
{{- T (printf "PostArchiveCheers%s" $cheers) }}
|
||||||
|
{{- T "SymbolComma" }}
|
||||||
|
{{- T "ArchiveCounterTitle" $posts | safeHTML }}
|
||||||
|
{{- T "SymbolComma" }}
|
||||||
|
{{- T "PostArchiveKeepOn" }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{ .Render "list" }}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{- partial "pagination.html" . }}
|
||||||
|
{{- end }}
|
@ -1,8 +1,11 @@
|
|||||||
{{- define "main_inner_class" }}index posts-expand{{- end }}
|
{{- define "main_inner_class" }}index posts-expand{{- end }}
|
||||||
|
|
||||||
{{- define "main" }}
|
{{- define "main" }}
|
||||||
|
|
||||||
{{ $paginator := .Paginate (where .Site.RegularPages "Section" "in" .Site.Params.mainSections) }}
|
{{ $paginator := .Paginate (where .Site.RegularPages "Section" "in" .Site.Params.mainSections) }}
|
||||||
{{- range $paginator.Pages }}
|
{{- range $paginator.Pages }}
|
||||||
{{ partial "post.html" (dict "ctx" . "IsHome" true) }}
|
{{ partial "post.html" (dict "ctx" . "IsHome" true) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- partial "partials/pagination.html" . }}
|
{{- partial "partials/pagination.html" . }}
|
||||||
{{- end }}
|
{{- end }}
|
@ -1,22 +1,20 @@
|
|||||||
{{/* Use to defind global variables */}}
|
{{/* Use to defind global variables */}}
|
||||||
|
|
||||||
{{ if not hugo.IsExtended }}
|
|
||||||
{{ warnf "Hugo NexT 主题使用了 SCSS 框架,请到官方地址下载 Hugo Extended 版本:https://github.com/gohugoio/hugo/releases" }}
|
|
||||||
{{ errorf "Because that use SCSS framework in Hugo NexT, Please download Hugo extended version on offical site: https://github.com/gohugoio/hugo/releases" }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ $version := int (index (split hugo.Version ".") 1) }}
|
{{ $version := int (index (split hugo.Version ".") 1) }}
|
||||||
{{ if lt $version 89 }}
|
{{ if lt $version 89 }}
|
||||||
{{ warnf "当前 Hugo 版本小于 0.89.0,请到官方地址下载 Hugo 最新版本:https://github.com/gohugoio/hugo/releases" }}
|
{{ warnf "当前 Hugo 版本小于 0.89.0,请到官方地址下载 Hugo 最新版本:https://github.com/gohugoio/hugo/releases" }}
|
||||||
{{ errorf "Current Hugo version is less then 0.89.0, Please download Hugo latest version on offical site: https://github.com/gohugoio/hugo/releases" }}
|
{{ errorf "Current Hugo version is less then 0.89.0, Please download Hugo latest version on offical site: https://github.com/gohugoio/hugo/releases" }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if not hugo.IsExtended }}
|
||||||
|
{{ warnf "Hugo NexT 主题使用了 SCSS 框架,请到官方地址下载 Hugo Extended 版本:https://github.com/gohugoio/hugo/releases" }}
|
||||||
|
{{ errorf "Because that use SCSS framework in Hugo NexT, Please download Hugo extended version on offical site: https://github.com/gohugoio/hugo/releases" }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
{{ $globalVars := newScratch }}
|
{{ $globalVars := newScratch }}
|
||||||
|
|
||||||
{{ $globalVars.Set "postsCount" (len (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections)) }}
|
{{ $globalVars.Set "postsCount" (len (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections)) }}
|
||||||
{{ range .Site.Params.mainSections }}
|
|
||||||
{{ $globalVars.Set . (len (where $.Page.Site.RegularPages "Section" .))}}
|
|
||||||
{{ end }}
|
|
||||||
{{ $globalVars.Set "catsCount" (len .Site.Taxonomies.categories) }}
|
{{ $globalVars.Set "catsCount" (len .Site.Taxonomies.categories) }}
|
||||||
{{ $globalVars.Set "tagsCount" (len .Site.Taxonomies.tags) }}
|
{{ $globalVars.Set "tagsCount" (len .Site.Taxonomies.tags) }}
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<article itemscope itemtype="http://schema.org/Article">
|
<article itemscope itemtype="http://schema.org/Article">
|
||||||
<header class="post-header">
|
<header class="post-header">
|
||||||
<div class="post-meta-container">
|
<div class="post-meta-container">
|
||||||
{{ $month := .Date.Format "01-02" }}
|
{{ $month := .Date.Format .Site.Params.monthFormat }}
|
||||||
<time itemprop="dateCreated" datetime="{{ .Date.Format "2006-01-02T15:04:05-07:00" }}" content="{{ $month }}">
|
<time itemprop="dateCreated" datetime="{{ .Date.Format .Site.Params.timeFormat }}" content="{{ $month }}">
|
||||||
{{ $month }}
|
{{ $month }}
|
||||||
</time>
|
</time>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user