你好我昨天发了一个标题为“Oi”的帖子,现在我正在尝试用不同的标题创建新帖子,但是它试图弄乱旧的帖子而我
收到此警告和错误消息:
WARNING: There are 2 variants of "oi" with lang en
WARNING: Development/web_projects/weeklyUpdate/content/2015_06_06_oi.md
WARNING: Development/web_projects/weeklyUpdate/content/2015_06_07_oi.md
CRITICAL: File Development/web_projects/weeklyUpdate/output/oi.html is to be overwritten
答案 0 :(得分:4)
假设您的内容目录中有两个帖子,
content/
├── post1.md
└── post2.md
具有相同的标题但作者/内容不同。
<强> post1.md 强>
Title: Oi
Author: Dr. Jekyll
Date: 2015-07-15 10:30
Category: StackOverflow
Tags: pelican
"Well, I tell you so again," continued the lawyer. "I have been
learning something of young Hyde."
The large handsome face of Dr. Jekyll grew pale to the very lips,
and there came a blackness about his eyes. "I do not care to hear
more," said he. "This is a matter I thought we had agreed to drop."
<强> post2.md 强>
Title: Oi
Author: Mr. Hyde
Date: 2015-07-15 10:20
Category: StackOverflow
Tags: pelican
"We have common friends," said Mr. Utterson.
"Common friends?" echoed Mr. Hyde, a little hoarsely. "Who are
they?"
"Jekyll, for instance," said the lawyer.
因为Pelican&#34;挫败了&#34;这些帖子使用帖子标题,会导致名称冲突,你会看到。
解决方案是将Slug: my-slug-line
元数据添加到每个帖子,以强制帖子呈现为my-slug-line.html
。在我们的例子中:
<强> post1.md 强>
Title: Oi
Author: Dr. Jekyll
Date: 2015-07-15 10:30
Category: StackOverflow
Tags: pelican
Slug: oi-dr-jekyll
"Well, I tell you so again," continued the lawyer. "I have been
learning something of young Hyde."
The large handsome face of Dr. Jekyll grew pale to the very lips,
and there came a blackness about his eyes. "I do not care to hear
more," said he. "This is a matter I thought we had agreed to drop."
<强> post2.md 强>
Title: Oi
Author: Mr. Hyde
Date: 2015-07-15 10:20
Category: StackOverflow
Tags: pelican
Slug: oi-mr-hyde
"We have common friends," said Mr. Utterson.
"Common friends?" echoed Mr. Hyde, a little hoarsely. "Who are
they?"
"Jekyll, for instance," said the lawyer.
这将把Jekyll博士的第一篇文章输出到oi-dr-jekyll.html
,将Hyde先生的第二篇文章输出到oi-mr-hyde.html
。
Slug:
元数据是可选的,因此除非您遇到命名冲突,否则不要 执行此操作。但它有时会派上用场。
另请注意:
如果你想为非博客或&#34;静态&#34;做同样的事情。页面,如&#34;关于我&#34;在Markdown中编写的页面,您可以使用save_as: my_page.html
元数据强制Markdown呈现为my_page.html
,无论页面标题是什么。
答案 1 :(得分:1)
似乎两个帖子都有相同的slug(帖子URL的本地部分)。它可以通过帖子中的“slug”元数据字段显式设置,也可以通过日期,标题等生成。在您的情况下,两个帖子都具有相同的URL“/oi.html”,并且pelican拒绝使用第二个帖子的内容覆盖第一个生成的文件。