Let's blog with Pelican
Makefile
-
make html
: generates output html files from files incontent
folder using development config filemake regenerate
: domake html
with "listening" to new changes- vs.
make publish
: similar tomake html
except it uses settings inpulishconf.py
-
make devserver
: (re)starts a http server in theoutput
folder. Default port is 8000 - Go to
localhost:<PORT>
to see the output website ghp-import -b <local-gh-branch> <outputdir>
: imports content in
Workflow
Key: Do every work in dev
branch. Do not touch blog-build
or master
.
blog-build
will be indirectly modified by ghp-import
(or make publish-to-github
)
and master
is the branch that Github will access to show my website.
So, manage the source (and outputs) only in dev
branch.
- Local dev
conda activate pelican-blog
cd ~/Workspace/Blog
# Make sure you are on `dev` branch
git checkout dev
# Add new files under `content`
git add my-article.md
# Generate the content with pelican
make html # or, make regenerate
# Start a local server
make devserver
# Open a browser and go to localhost:8000
-
Global dev
- Use
make publish
instead ofmake html
- Update the
blog-build
branch with contents inoutput
folder - Push the
blog-build
branch's content toorigin/master
These three steps can be done in one line:
- Use
make publish-to-github
- Version control the source
Important: Write new contents only on thedev
branch
git add <files> # make sure not to push the output folder
git cm "<commit message>"
git push origin dev #origin/dev is the remote branch that keeps track of blog sources