如何防止 Pelican 将 Markdown 源文件复制到输出文件夹中?

问题描述 投票:0回答:1

我正在将我的 Jekyll 博客转换为 Pelican。源

content
文件夹的目录结构使用
YYYY/MM/DD/slug.md
来组织博客文章,并在
files/YYYY/filename.ext
中存储静态文件。静态页面在
pages/filename.md
:

content
|-- 2023
|   |-- 01
|   |   |-- 01
|   |   |   |-- plans-for-the-year.md
|   |   |   +-- sdxjs-introduction.md
|   |   |-- 02
|   |   |   +-- sdxjs-systems-programming.md
|   |   |-- 03
|   |   |   +-- sdxjs-async-programming.md
|   |   |-- 04
|   |   |   +-- sdxjs-unit-test.md
|-- 2024
|   |-- 01
|   |   |-- 03
|   |   |   +-- the-other-examples.md
|-- files
|   |-- 2023
|   |   |-- awesome-robot.png
|   |   |-- blackberry-pie.jpg
+-- pages
    +-- about.md

我已将以下内容添加到我的

pelicanconf.py
设置文件中:

OUTPUT_SOURCES = False

SLUGIFY_SOURCE = "basename"
ARTICLE_URL = "{date:%Y}/{date:%m}/{date:%d}/{slug}/"
ARTICLE_SAVE_AS = "{date:%Y}/{date:%m}/{date:%d}/{slug}/index.html"
PAGE_URL = "{slug}/"
PAGE_SAVE_AS = "{slug}/index.html"

HTML 文件是根据我想要的位置生成的,但源 Markdown 文件也被复制到输出目录,尽管按照

文档
中的建议将
OUTPUT_SOURCES
显式设置为 False。我可以在
Makefile
中添加另一行以在构建后删除这些不需要的文件,但如何才能防止它们首先被复制?

  • 鹈鹕:4.10.0
  • Python:3.12.6
python pelican
1个回答
0
投票

此问题的根源似乎源自您内容中的两个 Markdown 文件:

  • 内容/2023/01/01/sdxjs-introduction.md
  • 内容/2024/04/01/sdxjs-introduction.md

在这两个文件的底部附近都有以下参考链接:

[third_bit]: {static}/

将链接目标更改为

/
(这就是我想象的初衷)解决了问题:

[third_bit]: /
© www.soinside.com 2019 - 2024. All rights reserved.