Pelican Tutorial: Posting on the NGCM Blog

Pelican Tutorial: Posting on the NGCM Blog

Students received training for part of the Professional and Research Skills module in how to use Pelican – a tool NGCM uses to update its blog. The tutorial was given by Ian Hawke.

First, an environment named blog needs to be created in the terminal using conda create -n blog python=3. Once markdown has been rendered, conda install markdown, and the environment activated with source activate blog, students can install the pelican packages in to their working directories with the command pip install pelican or through conda using install -c conda-forge pelican.

Next, the files containing the blog entries need to be cloned from a fork of the NGCM github repository. This step will only be possible if the user has access to this private repository. The files are then cloned in to the desired directory via git clone https://github.com/<username>/blog.git, replacing <username> with your github username. It is good practice to make edits to these files on a different branch, and then push them to the master when happy.

From the git directory, one can navigate to the content/seminars directory and add their blog post in Markdown or reStructuredText format. It is useful to copy a previous file and alter the contents of this to ensure all the metadata (for example: authors’ names, tags) is present. Once happy with their content, and once they have committed their changes to git, students can build the webpage by entering make html in the /blog/pelican directory and view it locally with open output/index.html.

At this stage, students should ensure that they have the most current version of the blog files on their local machine. To do this, create a remote to the original NGCM github repository with git remote add upstream https://github.com/ngcm/blog.git, and update all files with git pull upstream master. Any new blog posts on the webpage that have been added since the initial fork will have been added locally.

When students want to submit their post, they push their files on to github as normal with git push origin master, and create a new pull request.

Posted by Alex Wright