Pelican comes with a nice command line tool
generates a starter project including
tasks.py, and other files and directories. The source code file
pelican_quickstart.py is a nice example on how to create similar programs.
It is not difficult to write a program which generates a new Pelican starter
post. The benefit of the program is that it can automatically fill some meta fields.
It can also present a list of tags that already used in other posts, and the user
can pick one or more tags from the list. In addition, each post will have
consistent meta fields. I write the
newpost.py python program
for this purpose.
Here is how to run the program.
(georgexyz.com) george@desktop:~/Desktop/georgexyz.com$ python newpost.py Welcome to pelican-post v4.2.0. This script will help you create a new pelican post. Please answer the following questions so this script can generate the post. > Where do you want to save the markdown file? [content/posts] > What will be the title of this post? [NEW TITLE] Python Program to Create New Pelican Post > What will be the slug of this post? [python-program-to-create -new-pelican-post]create-new-pelican-post > What will be the date/time of the post? [2020-05-02 15:47]
newpost.py program calls Pelican itself to read all existing posts and
presents the tags on a list. Before using the program, I usually open the
“Tags” page of my blog website to pick one
or more tags for the new post. The program can also generate a
meta field if a user chooses to do so. Feel free to copy and modify the program
for your own site.