Skip to content

请问如何以文章文件名作为文章地址的url啊 #355

Answered by zhixuan2333
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

在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

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ghost
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants