Code Monkey home page Code Monkey logo

Comments (11)

AmazingRise avatar AmazingRise commented on July 4, 2024

暂时无法复现出这个问题。
建议检查一下:

  1. 你是否正确配置了Taxonomies
  2. 另外请劳烦您提供一下某篇博文的 Frontmatter 区。(一篇就够

from hugo-theme-diary.

guyueshui avatar guyueshui commented on July 4, 2024

暂时无法复现出这个问题。
建议检查一下:

  1. 你是否正确配置了Taxonomies
  2. 另外请劳烦您提供一下某篇博文的 Frontmatter 区。(一篇就够

你好,我的配置文件如下:

# hugo site config
baseurl = "https://guyueshui.github.io/yukynn"
languageCode = "zh-cn"
defaultContentLanguage = "zh-cn"
title = "Yukynnの窝"
theme = "diary"

# copyright = ""

# googleAnalytics = ""

# disqusShortname = ""

# enableRobotsTXT = true

# baseURL = "https://guyueshui.github.io/yukynn"
# preserveTaxonomyNames = true
enableRobotsTXT = true
enableEmoji = true
footnoteReturnLinkContents = ""
hasCJKLanguage = true


[params]
  subtitle="子在川上曰,逝者如斯夫。"
  # background = "#f8f8f5"

  author = "Yukynn"
  description = "Yukynn's showcase"

  siteStartYear = 2020

  # paginate of archives, tags and categories             # 归档、标签、分类每页显示的文章数目,建议修改为一个较大的值
  # archivePaginate = 15

  # The date format to use; for a list of valid formats, see https://gohugo.io/functions/format/
  dateFormatToUse = "January 2, 2006"


[blackfriday]
  # translate new line into linebreaks
  # extensions = ["hardLineBreak"]
  smartypants = false


[taxonomies]
  tag = "tags"
  category = "categories"

[[menu.main]]
  url = "/posts"
  name = "文章"
  weight = 1
[[menu.main]]
  url = "/categories"
  name = "分类"
  weight = 2
[[menu.main]]
  url = "/tags"
  name = "标签"
  weight = 3
[[menu.main]]
  url = "/about"
  name = "关于"
  weight = 4
[[menu.main]]
  url = "/index.xml"
  name = "订阅"
  weight = 5

昨天刚开始建站,从我的博客里拷了几篇文章来,frontmatter如下:

---
title: Hello World
date: 2020-03-11T20:50:39+08:00
lastmod: 2020-03-11T20:50:39+08:00
categories: "cat1"
tags: ["tag1", "tag2"]
featured_image: "/artworks/bilibilier.jpg"
description: 你好世界,愿这里成为你的一片净土。
---

上面这个是hello-world, 我也从我之前博客里复制了几篇过来,frontmatter可能不一样,但仅仅只是date format的区别。

from hugo-theme-diary.

AmazingRise avatar AmazingRise commented on July 4, 2024

我今天尝试了一下复现这个 bug,但是并没有成功。
图片
图片
图片

from hugo-theme-diary.

AmazingRise avatar AmazingRise commented on July 4, 2024

我的复现步骤:

  1. 将博客目录重新复制了一份,清除contents下的内容
  2. posts下新建一个空白的.md文件,将你的Frontmatter复制过来。(为方便起见 我去掉了和此问题无关紧要的featured_image选项)并且随手粘贴了一点其他内容
  3. 替换掉config.toml

你可以再检查一下,重新启动hugo server,看看结果是否正常。
因为hugo server默认处于快速渲染模式下,更改博文的分类,hugo server默认并不会实时更新。

from hugo-theme-diary.

guyueshui avatar guyueshui commented on July 4, 2024

佛了,我复现了一下,

hugo new site test
cd test
cd themes
git clone https://github.com/AmazingRise/hugo-theme-diary.git diary
cd ..
mv themes/diary/exampleSite/config.toml ./config.toml
cp /path/to/hello-world.md ./content/posts/
cat ./content/hello-world.md
---
title: Hello World
date: 2020-03-11T20:50:39+08:00
lastmod: 2020-03-11T20:50:39+08:00
categories: "cat1"
tags: ["tag1", "tag2"]
description: 你好世界,愿这里成为你的一片净土。

---


balabala....

然后还是有这个问题:
image
image
难道是看机器的吗orz..., 麻烦你了,你还是找不到原因的话就算了吧,感谢!

from hugo-theme-diary.

AmazingRise avatar AmazingRise commented on July 4, 2024

图片

  1. 你的 Hugo 版本是多少?(hugo version)
  2. 打开 F12,看看控制台里面是否有报错?
  3. 另外如果你换一个主题,这个现象是否能够复现?

from hugo-theme-diary.

guyueshui avatar guyueshui commented on July 4, 2024
$ hugo version
Hugo Static Site Generator v0.65.0/extended linux/amd64 BuildDate: unknown

image

以下是even主题的截图:
image
category和tag页面正常。

from hugo-theme-diary.

AmazingRise avatar AmazingRise commented on July 4, 2024

佛了,我复现了一下,

hugo new site test
cd test
cd themes
git clone https://github.com/AmazingRise/hugo-theme-diary.git diary
cd ..
mv themes/diary/exampleSite/config.toml ./config.toml
cp /path/to/hello-world.md ./content/posts/
cat ./content/hello-world.md
---
title: Hello World
date: 2020-03-11T20:50:39+08:00
lastmod: 2020-03-11T20:50:39+08:00
categories: "cat1"
tags: ["tag1", "tag2"]
description: 你好世界,愿这里成为你的一片净土。

---


balabala....

按照本楼层的配置,尝试用 hugo 命令生成网站,看 /public/categories目录下是否有文件夹?
或者说用hugo server,看是否能访问 http://localhost:1313/categories/cat1/

如果上面的回答都是 Yes,那么你尝试一下修改这行代码
{{ range .Paginator.Pages }} 改为 {{ range .Pages }}
看看问题是否存在

from hugo-theme-diary.

guyueshui avatar guyueshui commented on July 4, 2024

Yes, and 有了!非常感谢!什么原因呢?

from hugo-theme-diary.

AmazingRise avatar AmazingRise commented on July 4, 2024

我以前在用 0.65 的时候没有这个问题。
这个地方是对所有的分类进行遍历,如果套了个 Paginator 就是要求分页。
所以去掉 Paginator 的后果就是,如果你有 1w 个分类,都会显示在一页上,不会分页。

我查了一下官方论坛上的说法:链接
这种用法是允许的,但是搞不明白为什么在你的环境下运行不通,貌似之前也没有别人反馈过这个问题。
我觉得这个问题:Pagination with terms doesn't work in my environment 可以反馈到 Hugo 那边。

from hugo-theme-diary.

AmazingRise avatar AmazingRise commented on July 4, 2024

I have pinned this issue.
If someone else can reproduce the bug, please re-open this issue.

from hugo-theme-diary.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.