Small Simplicity

Understanding Intelligence from Computational Perspective

Jan 10, 2020

Let's blog with Pelican

Makefile

  1. make html: generates output html files from files in content folder using development config file

    • make regenerate: do make html with "listening" to new changes
    • vs. make publish: similar to make html except it uses settings in pulishconf.py
  2. make serve: (re)starts a http server in the output folder. Default port is 8000

  3. Go to localhost:<PORT> to see the output website
  4. ghp-import -b <local-gh-branch> <outputdir>: imports content in to the local branch local-gh-branch

Workflow

Key points:

  • 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

  1. Activate the right conda env with pelican library
conda activate my-blog 

cd ~/Workspace/Blog
  1. Make sure you are on dev branch git checkout dev

  2. (this step is for github syncing) Add new files under content git add my-article.md

  3. Generate the content with pelican make html # or, make regenerate

  4. Start a local server make server

  5. Open a browser and go to localhost:8000 Or whatever the port number is, set in Makefile (under the variable name of PORT)

Global dev

  1. Use make publish instead of make html
  2. Update the blog-build branch with contents in output folder
  3. Push the blog-build branch's content to origin/master

These three steps can be done in one line:

make publish-to-github

Version control the source

Important: Write new contents only on the dev 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