To publish GitHub Pages, I created a page using Pelican, a static HTML generator made by Python. I was addicted to the release, so make a note of the procedure as a memorandum. The detailed procedure is very helpful because the following reference site is detailed, so it is good to work based on that.
# pip install pelican
# pip install ghp-import
Create a repository from the GitHub Pages page. There are two types, one for users and one for projects, but this time I created it for users.
Clone the repository.
# git clone <Repository URL>
# pelican-quickstart
> Where do you want to create your new web site? [.]
> What will be the title of this web site? yusukew62 blog
> Who will be the author of this web site? yusukew62
> What will be the default language of this web site? [en] ja
> Do you want to specify a URL prefix? e.g., http://example.com (Y/n) Y
> What is your URL prefix? (see above example; no trailing slash) http://yusukew62.github.io
> Do you want to enable article pagination? (Y/n) Y
> How many articles per page do you want? [10]
> What is your time zone? [Europe/Paris] Asia/Tokyo
> Do you want to generate a Fabfile/Makefile to automate generation and publishing? (Y/n) Y
> Do you want an auto-reload & simpleHTTP script to assist with theme and site development? (Y/n) Y
> Do you want to upload your website using FTP? (y/N) N
> Do you want to upload your website using SSH? (y/N) N
> Do you want to upload your website using Dropbox? (y/N) N
> Do you want to upload your website using S3? (y/N) N
> Do you want to upload your website using Rackspace Cloud Files? (y/N) N
> Do you want to upload your website using GitHub Pages? (y/N) y
> Is this your personal page (username.github.io)? (y/N) y
Done. Your new project is available at /root/testpelican
When pelican-quickstart is completed, the following files will be created.
Makefile content develop_server.sh fabfile.py output pelicanconf.py publishconf.py
Create an article to post under the content directory. This time I created an article with reStructuredText, which is more like Python. When creating with Markdown, put Markdown from pip.
# vi content/20161210.rst
Article example
First Post By Pelican
#####################
:date: 2016-12-08 12:00
:modified: 2016-12-10 14:40
:tags: Python, Pelican
:category: Python
:authors: yusukew62
:summary: first post by pelican
.. code-block:: python
print "Hello World"
Generate an html file.
# make html
Check the display.
# make serve
Connect to the IP address of the above execution host with a browser on port 8000.
Output the file published on GitHub Pages to the gh-pages branch.
# ghp-import output
Add the generated html file to your local repository.
# git add output/
# git commit -m 'Added all created html files'
Publish a set of files from the gh-pages branch to the master branch of the remote repository
# git push -f origin gh-pages:master
After a while, make sure the page is refreshed.
The gh-pages branch does not include the content directory or pelican configuration file (* .py), so cut another branch and push it. Here, it is created as a branch called source from master and uploaded to the remote repository.
# git branch source
# git push origin source
Access from a browser and check
http://<User name>.github.io
I referred to the following site. How to create a blog managed by Pelican + Markdown + GitHub Pages
Recommended Posts