pythonpelican

How to prevent Pelican from copying Markdown source files into output folder?


I am converting my Jekyll blog to Pelican. The directory structure of the source content folder uses YYYY/MM/DD/slug.md to organize blog posts and stores static files in files/YYYY/filename.ext. Static pages are in 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

I have added the following to my pelicanconf.py settings file:

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"

The HTML files are generated as I want and where I want, but the source Markdown files are copied to the output directory as well, despite explicitly setting OUTPUT_SOURCES to False as suggested in the docs. I could add another line to Makefile to delete these unwanted files after the build, but how can I prevent them being copied in the first place?


Solution

  • The source of this problem appears to originate from two Markdown files in your content:

    In both files, there is the following reference link near the bottom:

    [third_bit]: {static}/
    

    Changing the link target to / (which is what I imagine was the original intention) fixes the problem:

    [third_bit]: /