Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tags page not display tag cloud 标签页没有显示标签云 #510

Closed
3 tasks done
XunZhan opened this issue May 1, 2022 · 11 comments
Closed
3 tasks done

Tags page not display tag cloud 标签页没有显示标签云 #510

XunZhan opened this issue May 1, 2022 · 11 comments

Comments

@XunZhan
Copy link

XunZhan commented May 1, 2022

Please follow this Issue template to provide relevant information, such as source code repository, website URL and screenshots, which will help us investigate.
请按照此 Issue 模版提供相关信息,例如源码仓库、网站链接和屏幕截图,这将有助于我们进行调查。

Issue Checklist


Expected behavior

After config the tags pages according to the doc, the tag cloud should be displayed
根据教程配置标签页之后应显示标签云

Actual behavior

Instead of the tag cloud, there is only the time line with post titles.
没有标签云,而是一个和archive页面很像的时间轴,应该显示的是tag.njk的内容,而非_partials/page/tags.njk.

  • Links to demo site with this issue:
  • Links to repository or source code of the blog:
  • Screenshots:

image

Steps to reproduce the behavior

  1. hexo new page tags 生成tags页面
  2. tags/index.md 更改 为:
---
title: Tags
date: 2014-12-22 12:39:04
type: tags
---
  1. Next config 配置Menu里的Tag (我的截图里面没有显示这一步,因为配置之后发现没有变化,但是local已经尝试过。另外也并不希望在menu里显示Tag, 应该不是这个原因 导致的?)
  2. Next config 配置tag cloud: (orderby和order我还是没有明白是什么意思,如果 能在doc里增加截图/举例会更好)
# TagCloud settings for tags page.
tagcloud:
 min: 12 # Minimum font size in px
 max: 30 # Maximum font size in px
 amount: 200 # Total amount of tags
 orderby: name # Order of tags
 order: 1 # Sort order

Environment Information

MacOS + VSCode

Node.js and NPM Information

v13.12.0
6.14.4

Package dependencies Information

hexo-site@0.0.0 /Users/xun/Documents/GitHub/XunZhan.github.io
├── chai@4.3.6
├── express@4.17.3
├── hexo@5.4.0
├── hexo-algolia@1.3.2
├── hexo-browsersync@0.3.0
├── hexo-deployer-git@3.0.0
├── hexo-generator-archive@1.0.0
├── hexo-generator-category-enhance@0.1.6
├── hexo-generator-feed@3.0.0
├── hexo-generator-index@2.0.0
├── hexo-generator-searchdb@1.4.0
├── hexo-generator-tag@1.0.0
├── hexo-prism-plugin@2.3.0
├── hexo-renderer-ejs@1.0.0
├── hexo-renderer-jade@0.5.0
├── hexo-renderer-marked@4.1.0
├── hexo-renderer-stylus@2.0.1
├── hexo-server@2.0.0
├── j-prism-toolbar@1.3.1
├── mocha@9.2.2
└── request@2.88.2

Hexo Configuration

# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/

# Site
title: Xun
subtitle: ''
description: ''
keywords:
author: Xun
language: 
- en
- zh-cn
timezone: 'America/Los_Angeles'

# URL
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
url: https://XunZhan.github.io/
# permalink: :year/:month/:day/:title/
permalink: :title/
permalink_defaults:
pretty_urls:
  trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
  trailing_html: true # Set to false to remove trailing '.html' from permalinks

# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:

# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link:
  enable: true # Open external links in new tab
  field: site # Apply to the whole site
  exclude: ''
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight:
  enable: true
  line_number: true
  auto_detect: false
  tab_replace: ''
  wrap: true
  hljs: false
prismjs:
  enable: false
  preprocess: true
  line_number: true
  tab_replace: ''

# Home page setting
# path: Root path for your blogs index page. (default = '')
# per_page: Posts displayed per page. (0 = disable pagination)
# order_by: Posts order. (Order by date descending by default)
index_generator:
  path: ''
  per_page: 10
  order_by: -date

# Category & Tag
default_category: uncategorized
category_map:
tag_map:

# Metadata elements
## https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
meta_generator: true

# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss
## updated_option supports 'mtime', 'date', 'empty'
updated_option: 'mtime'

# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page

# Include / Exclude file(s)
## include:/exclude: options only apply to the 'source/' folder
# include:
# exclude:
# ignore:

# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/

##########Theme Typography##########
# theme: typography
# plugin:
#   - hexo-generator-category-enhance
#   - hexo-generator-feed
#   - j-prism-toolbar
#   - hexo-asset-image
#   - hexo-prism-plugin
#   - prismjs
#   - prism-themes
#   - hexo-toc

##########Theme Next##########
theme: next

# Deployment (use Method 1)
## Method 1: Docs: https://hexo.io/docs/one-command-deployment
## Method 2: Docs: https://github.com/hexojs/hexo-deployer-git
deploy:
  type: git
  repo: https://github.com/XunZhan/XunZhan.github.io.git
  branch: gh-pages

# Generate archive page
archive_generator:
  per_page: 0

# Generate categories index page and each category page
category_generator:
  per_page: 10
  enable_index_page: true

# Generate tags index page and each tag page
tag_generator:
  per_page: 10
  enable_index_page: true

# Generator atom feed for you website
feed:
  type: atom
  path: atom.xml
  limit: 20
  hub:
  content:
  content_limit: 140
  content_limit_delim: ' '

# For syntax highlighting 
prism_plugin:
  mode: 'preprocess'
  #theme: 'one-light' # Uncomment for Typography
  line_number: true

algolia:
  applicationID: "C26FDABZJT"
  apiKey: "5e2bf58a82ded86292e4aed87771ca86"
  indexName: "dev_NAME"

# local search for NexT theme
search:
  path: search.xml
  field: post
  content: true
  format: html

NexT Configuration

menu:
  #home: / || fa fa-home
  #about: /about/ || fa fa-user
  #tags: /tags/ || fa fa-tags
  #categories: /categories/ || fa fa-th
  #archives: /archives/ || fa fa-archive
  #schedule: /schedule/ || fa fa-calendar
  #sitemap: /sitemap.xml || fa fa-sitemap
  #commonweal: /404/ || fa fa-heartbeat
  About Me 重帘: /about-me/ || fa fa-address-book
  Projects 轻舟: /projects/ || fa fa-server
  TechBlog 东风: /techblog/ || fa fa-pen
  Leetcode 箭雨: /leetcode/ || fa fa-flask
  Articles 惊梦: /articles/ || fa fa-coffee

# Table of Contents in the Sidebar
# Front-matter variable (nonsupport wrap expand_all).
toc:
  enable: true
  # Automatically add list number to toc.
  number: true
  # If true, all words will placed on next lines if header width longer then sidebar width.
  wrap: false
  # If true, all level of TOC in a post will be displayed, rather than the activated part of it.
  expand_all: true
  # Maximum heading depth of generated toc.
  max_depth: 6

# TagCloud settings for tags page.
tagcloud:
  min: 12 # Minimum font size in px
  max: 30 # Maximum font size in px
  amount: 200 # Total amount of tags
  orderby: name # Order of tags
  order: 1 # Sort order

font:
  enable: true

  # Uri of fonts host, e.g. https://fonts.googleapis.com (Default).
  host: 

  # Font options:
  # `external: true` will load this font family from `host` above.
  # `family: Times New Roman`. Without any quotes.
  # `size: x.x`. Use `em` as unit. Default: 1 (16px)

  # Global font settings used for all elements inside <body>.
  global:
    external: true
    family: Noto Sans
    size: 0.75

  # Font settings for site title (.site-title).
  title:
    external: true
    family: Noto Sans
    size: 

  # Font settings for headlines (<h1> to <h6>).
  headings:
    external: true
    family: Noto Sans
    size: 

  # Font settings for posts (.post-body).
  posts:
    external: true
    family: Noto Sans

  # Font settings for <code> and code blocks.
  codes:
    external: true
    family: Monaco

# Note tag (bootstrap callout)
note:
  # Note tag style values:
  #  - simple    bootstrap callout old alert style. Default.
  #  - modern    bootstrap callout new (v2-v3) alert style.
  #  - flat      flat callout style with background, like on Mozilla or StackOverflow.
  #  - disabled  disable all CSS styles import of note tag.
  style: mordern
  icons: false
  # Offset lighter of background in % for modern and flat styles (modern: -12 | 12; flat: -18 | 6).
  # Offset also applied to label tag variables. This option can work with disabled note tag.
  light_bg_offset: 0

Other Information

@XunZhan XunZhan added the Bug Something isn't working label May 1, 2022
@welcome
Copy link

welcome bot commented May 1, 2022

Thanks for opening this issue, maintainers will get back to you as soon as possible!

@stevenjoezhang
Copy link
Member

执行一下 hexo clean 试试

@XunZhan
Copy link
Author

XunZhan commented May 10, 2022

执行一下 hexo clean 试试

尝试过了,显示结果还是和截图一样,是否还有其他地方我没有配置成功?

@XunZhan
Copy link
Author

XunZhan commented May 10, 2022

我尝试hexo new page test 然后在 test里面:

---
title: test
date: 2022-05-10 15:30:27
type: tags
---

然后不从tags的按钮进入,而是在网页上输入 localhost:4000/test/, 在此页面上可以正常显示tag cloud,我想知道为什么会这样,似乎把page的名字写成tags是导致错误的一步。

@XunZhan
Copy link
Author

XunZhan commented May 16, 2022

另外,我在local测试的时候,如果有一个tag叫做array,localhost:4000/test/ 与 localhost:4000/test/array 都可以正常显示, 但是hexo deploy之后 xunzhan.github.io/test/ 可以正常显示但 xunzhan.github.io/test/array不能显示(404)

@ljcbaby
Copy link
Member

ljcbaby commented May 16, 2022

@XunZhan 看一下是没有文件还是 deploy 后 要 .../test/array/ 才是正常路径

@XunZhan
Copy link
Author

XunZhan commented May 16, 2022

抱歉之前写错了,hexo deploy之后 xunzhan.github.io/test/ 可以正常显示, xunzhan.github.io/test/array/不能显示(404),xunzhan.github.io/tags/array/可以正常显示(且结果正确)。 我觉得这样改其实比较trick,主要想知道为什么生成一个名为tags 的page后不能正常显示tag cloud的页面

@XunZhan
Copy link
Author

XunZhan commented May 16, 2022

@XunZhan 看一下是没有文件还是 deploy 后 要 .../test/array/ 才是正常路径

目前我debug到的问题是,对于test page 和tags page,两者从layout/_layout.njk进入,然后在
<div class="main-inner {% block class %}{% endblock %}"> 这里,test page 使用post.njk 而 tags page 使用tag.njk。我想知道如何确定使用哪一个njk呢?没有找到具体的代码

@XunZhan
Copy link
Author

XunZhan commented May 22, 2022

删除一部分hexo config里面不相关的东西之后解决了,删除的部分:

# Generate archive page
archive_generator:
  per_page: 0

# Generate categories index page and each category page
category_generator:
  per_page: 10
  enable_index_page: true

# Generate tags index page and each tag page
tag_generator:
  per_page: 10
  enable_index_page: true

# Generator atom feed for you website
feed:
  type: atom
  path: atom.xml
  limit: 20
  hub:
  content:
  content_limit: 140
  content_limit_delim: ' '

另外,如果使用category的第一个字母大写时需要添加category map(hexo config里面)否则不能正常link到指定页面

@XunZhan XunZhan closed this as completed May 22, 2022
@stevenjoezhang
Copy link
Member

stevenjoezhang commented May 22, 2022

enable_index_page: true 会和主题自带的标签页冲突。这个选项太不起眼了,之前也没有人遇到类似的问题,所以没有发现。不好意思。

hexojs/hexo-generator-tag#2
hexojs/hexo-generator-category#4
next-theme/theme-next-docs@7654832

@stevenjoezhang stevenjoezhang added Solved Hexo Plugin and removed Bug Something isn't working labels May 22, 2022
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. It is possible issue was solved or at least outdated. Feel free to open new for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants