Easy procedure to start blogging with Python's static site generator "Pelican"

Introduction

I used to use the blog as it was, but it was a mixture of everyday silly stories and TECH topics, and it was hard to see and write, so I decided to separate them.

Apart from that, I'm glad I used TECH blogs as well as WordPress, but I wanted to write in a slightly different way, and when I googled, I came up with ** "Pelican + Markdown + GitHub Pages" ** It was a way to write in.

I decided to use this method because it didn't seem to be so difficult and there were many themes distributed.

environment

Windows 10 Python 3.5.2 pip pelican 3.7.1

Create a repository for GitHub Pages

Create a new repository from your GitHub page. There are two types of Github Pages, User Pages and Project Pages, but if it's a personal blog, User Pages is fine. Create a repository with the name [username.github.io].

Once that's done, clone the repository locally.

$ git clone https://github.com/username/username.github.io

Installation and setup

Next, install what you need locally.

$ pip install pelican Markdown

Convenient pelican quick-start

Pelican has a handy command called $ pelican-quickstart, which you can interactively ask for blog titles, timezone settings, etc., and easily create a blog template. Maybe in the end the directory will look like this.

username.github.io/
├── content
├── output
├── develop_server.sh
├── fabfile.py
├── Makefile
├── pelicanconf.py       
└── publishconf.py       

Write a blog

If you come this far, it's almost over. After that, write an article in Markdown format or reStructuredText format as you like and save it in / content. By the way, if you do something like /content/category/***.md, it will be automatically categorized (like).

Check locally

Since it is not easy to build using the make command on Windows, download here and rewrite a part to replace it. Specifically, in pmake.cmd

set _PELICAN=$pelican
set _PELICANOPTS=$pelicanopts

Part of

set _PELICAN=pelican
set _PELICANOPTS=

If you rewrite it to, it's okay.

$ pmake html

If no error occurs with this, it means that the html file has been successfully generated. It is created under / output by default.

$ pmake serve

After starting up safely, check with ``` http: // localhost: 8000 / .

Change the theme

This depends on the person, but you may want to change the default theme. There is no problem if you make it from scratch. If you want to change the theme a little easier, just pull your favorite from Pelican Themes.

① After cloning from the public repository of your favorite theme to your favorite local directory, pelican-themes - i [Clone directory]/simple-blog-theme Install the theme like this. Once that's done

pelicanconf.Open py



THEME = 'simple-blog-theme'


 Please add.

 If that doesn't work, check if the theme is installed.
```pelican-themes -l```
 You should see a list of themes installed in.

 (2) Create a new directory like themes on the same directory as ``` pelicanconf.py```. There is also a way to keep all the themes published here. (I'm here)
 In particular

git clone --recursive https://github.com/getpelican/pelican-themes themes/pelican-themes

 It will probably take a long time, but if you do this, you can easily change the theme later.
 After finishing, open ``` pelicanconf.py```

THEME = './themes/pelican-themes/simple-blog-theme'

 If you add something like this, it's okay.

 As you can see by actually changing the theme, each has different specifications and can be customized freely. If there is an official website etc., you may try rewriting css etc. with reference to them. (At your own risk)

### Recommended theme

[blueidea](https://github.com/blueicefield/pelican-blueidea/tree/8f11c0e3b4b8e9ef45d1243b0175db91b7b42ba8)

[blue-penguin](https://github.com/jody-frankowski/blue-penguin/tree/c5e23e7753367b5beacce87b732cd1567c4818f9)

[pelican-clean-blog](https://github.com/gilsondev/pelican-clean-blog/tree/ea156f8f1741e473bc0ab848b7c8898112d6ffb5)

[Flex](https://github.com/alexandrevicenzi/Flex/tree/5bc235cf579cb03bcc8f54b6029ff74493a0cb44)

[medius](https://github.com/onur/medius/tree/c4399ffdae1070fcd476157f4ab4109448d15b77)

## Upload to GitHub Pages

 Finally the last. To publish a blog on GitHub Pages, if you have a module called ghp-inmport in Python, you can create a separate branch and publish only html and css, which is convenient.

$ pip install ghp-import $ ghp-import output $ git commit -m "first post" $ git push -f origin gh-pages:master


 This is the end. Open your browser and open ``` http://username.github.io```.
 (Note that it may take about 10 minutes to be reflected)


## References

 [The first step to start a blog with Pelican-Mokumoku Blog](http://blog.muuny-blue.info/64517d8435994992e682b3e4aa0a0661.html)

 [How to create a blog managed by Pelican + Markdown + GitHub Pages --Human as a Service days](http://blog.sotm.jp/2014/01/04/Pelican-Markdown-GithubPages-install-guide/)

 [The story of making a blog with PELICAN + GITHUB PAGES --FUTON NOTE](http://daikishimada.github.io/pelican-start.html)

 [Migrated blog generator from Tinkerer to Pelican-Continued rough lab](https://memo.laughk.org/2014/08/10/tinker2pelican-repo.html)

 [Blogging with Pelican on Windows](http://qiita.com/daiki7nohe/items/ed82af5b302c83ff3336)

 [Introducing the theme to Pelican --Qiita](http://qiita.com/_rdtr/items/6e579750898738c663dd)


Recommended Posts

Easy procedure to start blogging with Python's static site generator "Pelican"
Easy IoT to start with Raspberry Pi and MESH
Lektor static site generator
How to publish GitHub Pages with Pelican, a static HTML generator made by Python
Blogging with Pelican on Windows
Easy to install pyspark with conda
Easy to draw graphs with matplotlib