Pelican is a static web site generator, written in Python, that requires no database or server-side logic. Some of the features include:
Install Pelican) is very easy, just run the following command:
sudo pip install pelican
Github Pages is designed to host your web sites directly from a Github repository. They have an URL username.github.io, where username is your username on Github.
In order to use Github Pages, we have to create a new repository with the name username.github.io
in Github. (This will be our site internet address).
Once we have the repository created, we can clone it.
git clone https://github.com/usuarioGithub/usuarioGithub.github.io.git
Additionally, we can clone the blog_template repository, this repository has the initial setup to make it easier to create the site.
git clone https://github.com/blogen5minutos/blog_template.git
If you prefer not to use the blog_template, you can start your own Pelican project with the command:
pelican-quickstart
The main files with the Pelican configurations are pelicanconf.py and publishconf.py, in the last one we should include the configurations for the final publishing of the site.
If you are using the blog_template
repository; you should change the variables SITENAME and SITESUBTITLE in the pelicanconf.py file and the variable SITEURL in the publishconf.py file.
To create the site articles, we should create a Markdown or reStructuredText file in the content folder. For example, using Markdown, we can create the following file:
Title: My Blog
Date: 2016-05-18
Category: Python
Tags: python
Author: Raul E. Lopez Briega
Test article to show how easy is to create a blog in internet with [github pages](https://pages.github.com/).
For more information, visit the Pelican documentation.
Other way to create articles, is using Jupyter notebooks. We will need to install the plugin liquid_tags.
Once the plugin is enable in the pelicanconf.py file; we should save ours notebooks in the subfolder notebooks
inside the content
folder and then write a new Markdown file, using the following syntax in the end:
{% notebook filename.ipynb [ cells[start:end] ]%}
For example:
Title: Batman, ecuaciones y python
Date: 2016-05-19
Category: Python
Tags: python, matematica, programacion, batman
Author: Raul E. Lopez Briega
{% notebook Batman.ipynb cells[2:] %}
Once we have configurated the Pelican project and the articles are ready; we can create the site with the following command:
make html
This command will create a new folder named output with all the content for running our site. We can test the results with the command:
make serve
and then going to localhost:8000 to see the site.
If everything is fine, we can create the final version with the command:
make publish
To publish our site, we have to copy the content of output folder into the username.github.io
folder and then committing and pushing the changes.
git add --all
git commit -m "publicando blog"
git push -u origin master
Congratulations, the site is ready! we can visit the site at https://username.github.io.
https://relopezbriega.github.io/
Twitter: @relopezbriega