I decided to create a blog using a static site generator and so on. This time I used Pelican made by Python.
First, use the virtualenv command to create a virtual environment with the name pelican.
C:\> virtualenv pelican
Move to pelican
C:\> cd pelican
Move to virtual environment
C:\pelican> Scripts\activate
Install Pelican
(pelican)C:\pelican> pip install pelican
I want to write an article in Markdown format, so
(pelican)C:\pelican> pip install Markdown
Now you are ready to create a blog.
Create and move myblog project folder
(pelican)C:\pelican> mkdir myblog
(pelican)C:\pelican> cd myblog
Creating a blog template.
(pelican)C:\pelican\myblog> pelican-quickstart
At this time, I will answer various questions such as blog title and author name.
Write articles in Markdown format.
first-post.md
Title:Blog on Pelican
Date: 2016-05-20 22:40
Category: Pelican
Tags: pelican, python
Slug: first-post
Author: Daiki
Summary:Blogging with Pelican
Create a blog with Pelican.
Save this under \ myblog \ content .
Originally, you can easily generate a static page with the make html
command, but since it is not possible on Windows, use a batch file.
(https://gist.github.com/traeblain/4252511)
Put pmake.cmd here under myblog
pmake.cmd
set _PELICAN=$pelican
set _PELICANOPTS=$pelicanopts
.
.
cd %_OUTPUTDIR% && python -m SimpleHTTPServer
.
.
To
pmake.cmd
set _PELICAN=pelican
set _PELICANOPTS=
.
.
cd %_OUTPUTDIR% && python -m http.server
.
.
Edit the pelican path and the server start command for python3.4 (as is for 2.x),
Now you can compile with the pmake
command instead of make
.
(pelican)C:\pelican\myblog> pmake html
If there are no particular errors, HTML conversion was successful.
Start localhost server
(pelican)C:\pelican\myblog> pmake serve
Now you can check the created article by accessing http: // localhost: 8000
with a browser.
Generate HTML file for publication
(pelican)C:\pelican\myblog> pmake publish
Settings such as the public URL can be changed in pelicanconf.py.
Move to output directory
(pelican)C:\pelican\myblog> cd output
Publish page on Github (public URL: username.github.io)
(pelican)C:\pelican\myblog\output> git init
(pelican)C:\pelican\myblog\output> git add --all
(pelican)C:\pelican\myblog\output> git commit -m "first post"
(pelican) C: \ pelican \ myblog \ output> git push https://github.com/username/username.github.io.git master: master
Addition: If you create a git repository under output, an error will occur with pmake html
, so create it under myblog, and when pushing, use ghp-import to specify output and it seems that it can coexist well.
Addendum: Another change to DELETE_OUTPUT_DIRECTORY = False
in publishconf.py worked.
Reference: (http://docs.getpelican.com/en/3.6.3/tips.html)
Reference site ―― I want to quit Wordpress and move to Pelican, but I don't have the energy to overcome obstacles. -I decided to start a technical blog with the static page generator Pelican -Write a blog with the static site generator Pelican -How to create a blog managed by Pelican + Markdown + GitHub Pages -Create a blog on github --Pelican -Pelican installation / operation check memo
Recommended Posts