请问如何以文章文件名作为文章地址的url啊 #355
-
主题默认情况是 “post: /p/:slug/”,生成的文章链接与文章标题有关,但是我的文章标题都是中文,甚至会修改变动。如果要改成以文章的文件名作为 url 该怎么更改啊? 比如 “post:/p/????/”,该用什么标签呢? |
Beta Was this translation helpful? Give feedback.
Answered by
zhixuan2333
Sep 17, 2021
Replies: 3 comments 1 reply
-
在FrontMatter里设定 slug: xxx 如果你使用 hugo new 进行创建文章的话 <!-- archetypes\default.md -->
---
title: "{{ replace .Name "-" " " | title }}"
slug: "{{ replace .Name "-" " " | title }}"
description:
date: {{ .Date }}
image:
math:
license:
hidden: false
comments: true
draft: true
--- 命令 hugo new post/hello-world/index.md |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected
-
也可以直接改 https://gohugo.io/content-management/urls/#permalink-configuration-values 用 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
在FrontMatter里设定
如果你使用 hugo new 进行创建文章的话
命令