- Pelican, a Python-based static blog site generator. a. Pelican relies on Jinja2, a templating language for Python. It allows you to insert code into parts of your HTML page so you can call scripts to piece your page together.
- Virtualenv sandboxes Python dependencies (
pip
installs packages globally, meaning you can't have multiple versions of the same library. If you have an old project that uses library v1 and you're starting a project that uses library v8, callingpip
might break your old project). - ghp-import. After committing in this repository, it pushes to my Github static site repository.
Just refer to the documentation.
- Install Python 3.3 or higher.
- Run
pip install virtualenv
to installvirtualenv
so you can sandbox your libraries. - Do not immediately run
virtualenv ~/virtualenvs/pelican
. You have to change your directory to where you want the virtual environments to live in.
If I run virtualenv ~/virtualenvs/pelican
in C:/Users/Charlie/Documents
, it would actually create the fucking folder C:/Users/Charlie/Documents/~/virtualenvs/pelican
instead of doing C:/Users/Charlie/virtualenvs/pelican
.
- Run
virtualenv {your virtualenvs directory}/{name of your sandbox}
to create the new sandbox. For example, my virtualenvs directory on Oreo isC:/python-virtualenvs
and I wany my sandbox to be calledpelican
, so I would runvirtualenv C:/python-virtualenvs/pelican
. - Do not run
source /virtualenvs/pelican/bin/activate
to set the current terminal session to the sandbox. First, Windows doesn't recognize thesource
command. Second, the script is not in /bin. It's in /Scripts. Just run{your virtualenvs directory}/{name of your sandbox}/Scripts/activate
instead. pip install pelican
to install pelican to the current sandbox.pip install Markdown
to install Markdown support for pelican.pip install ghp-import
to installghp-import
.
- Run
C:/python-virtualenvs/pelican/Scripts/activate
to set the current session to this blog's sandbox. - Do your shit.
- Go to
themes
to restyle the site, change the scripts, etc.themes/{theme}/templates
includes all the HTML templates that will be filled.themes/{theme}/static
includes the CSS/JS.- Right now my theme is
notmyidea
.
- Go to
content
to change the actual content. Just create a Markdown file. Look at existing Markdown files to see the required metadata. output
is wherepelican
outputs to.
# You *must* give pelican the directory of the CONTENT FOLDER, not the directory of the project, or it will fucking break
# For example, running `pelican` in your root directory fails, but running
pelican content
# works
# (it seems like by default it sets the output dir and the pelicanconf dir)
# I added a post-commit git hook that runs ghp-import, so after committing...
git commit -am "changes ya"
# it mmediately updates the main repo
- If you want to delete a blog post, you have to delete the old HTML in the
output
folder. - You can create arbitrary metadata for files. They have to follow the same format as the predefined ones.
- The variables in Jinja2 are lower cased:
For example, if you have the metadata CoverImage
, you have to access it as article.coverimage
. Spaces do not work, so I use Cover_Image
instead (which I access as article.cover_image
)
- By default, the articles are sorted by date (with most recent being first). I rely on that for the main page.