自从我上次使用雨果以来已经有5年了,所以我忘记了很多东西,也许有些事情也发生了变化。
我使用Hugo发布静态博客,由于某些原因,所有内容都在您必须单击的“帖子”部分下发布,此时页面为“ #posts”。我不记得以前发生这种情况。
我尝试了 使用 - disable> - disables = pection
为了成功阻止“ Post”出现在我的主页上,但孩子们的页面也消失了。除了希望我的博客文章出现在我的主页上,我还希望URL结构反映该校正后的组织;即,现在所有内容都在 mywebsite.com/post/article-name-here
下出现在 mywebsite.com/article-name-here
时。]
在我的存储库中,我的博客文章实际上被存储在 content/post/acters-name-here
下,但是当我将文章直接移至 content
目录中时,雨果失败了显示它们。
我觉得这应该是一个非常简单的修复,但是我显然没有使用正确的搜索词来描述正在发生的事情。
请让我知道我还可以提供哪些其他信息,因为我很难阐明正在发生的事情。
It's been 5 years since I've last used Hugo, so there is a lot I am forgetting and perhaps some things have changed as well.
I use Hugo to publish a static blog, and for some reason everything is being published under a "Post" section that you have to click into, at which point the page is title "#Posts". I do not recall this ever happening before.
I tried using --disableKinds=section
to successfully stop "Post" from showing up on my main page, but the children pages disappeared as well. In addition to wanting my blog posts to show up on my main page, I want the URL structure to reflect this corrected organization; i.e., right now everything is showing up under mywebsite.com/post/article-name-here
when it should just be mywebsite.com/article-name-here
.]
Within my repository, my blog articles are in fact stored under content/post/article-name-here
, but when I moved my articles into the content
directory directly, Hugo failed to display them.
I feel like this should be a very easy fix, but I'm clearly not using the right search terms to describe what is going on.
Please let me know what other information I can provide as I am having a hard time articulating what is going on.


发布评论
评论(2)
设置永久链接
您使用时 时一个config.yaml文件,您可以将其添加到其中:
从您的URL中消除
post/
。对于.toml
,您必须稍微更改格式。主页解决方案
如果您在来自:
进入:
...您将获得预期的结果(主页上的帖子列表)。我测试了它。
Setting the permalink
When you are using a config.yaml file, you can add this to it:
That will eliminate the
post/
from your URL. For.toml
you have to slightly alter the formatting.The homepage solution
If you change line 8 in your layouts/index file from:
into:
... you will get the expected result (a list of your posts on the homepage). I tested it.
这是我为雨果先生在上方/下方的答案所做的临时解决方案:
url =“ Artist-Name-Here”
在每个博客文章的标记文件中。Hugo
通过命令行发布,在Publish/post/post/post
目录中以index.html和index.xml文件,然后将它们移至publish
目录(即,已经在那里覆盖index.html和index.xml文件)。H1
标签的内容从“ #posts”到“最近的文章”。希望我能找到一个更好的答案,并一旦我做到了这个堆栈溢出问题。
Here is the temporary solution I worked out thanks to Mr. Hugo's answer above/below:
url = "article-name-here"
inside every blog post's Markdown file.hugo
via command line, take the index.html and index.xml files within thepublish/post
directory, and move them into thepublish
directory (i.e., overwrite the index.html and index.xml files already there).h1
tag inside index.html from "#Posts" to "Recent Articles".Hopefully I can figure out a better answer and update this Stack Overflow question once I do.