After you have your repository created and the required software installed its time to install Pelican.
Linux and OS X
$ sudo pip install virtualenv
Restart your terminal
Where <path> is the directory you want to save the virtualenv files. Usually something like /home/<username>/virtualenvs/pelican on Linux
or /Users/<UserName>/virtualenvs/pelican on OS X.
Whenever you need work in the virtualenv:
$ source <path>/bin/activate
c:\>pip install virtualenv
Where <path> is the directory you want to save the virtual env files. Usually something like c:Users<Username>virtualenvspelican
Whenever you need to work in the virtualenv:
Generate the Base Site
With your virtualenv still active.
$ mkdir blogname
$ cd blogname
Welcome to pelican-quickstart v3.7.1.
This script will help you create a new Pelican-based website.
Please answer the following questions so this script can generate the files
needed by Pelican.
> Where do you want to create your new web site? [.] <enter>
> What will be the title of this web site? My Blog <enter>
> Who will be the author of this web site? My Name <enter>
> What will be the default language of this web site? [en] <enter>
> Do you want to specify a URL prefix? e.g., http://example.com (Y/n) n <enter>
> Do you want to enable article pagination? (Y/n) <enter>
> How many articles per page do you want?  <enter>
> What is your time zone? [Europe/Paris] America/Chicago <enter>
> Do you want to generate a Fabfile/Makefile to automate generation and publishing? (Y/n) <enter>
> Do you want an auto-reload & simpleHTTP script to assist with theme and site development? (Y/n) <enter>
> Do you want to upload your website using FTP? (y/N) <enter>
> Do you want to upload your website using SSH? (y/N) <enter>
> Do you want to upload your website using Dropbox? (y/N) <enter>
> Do you want to upload your website using S3? (y/N) <enter>
> Do you want to upload your website using Rackspace Cloud Files? (y/N) <enter>
> Do you want to upload your website using GitHub Pages? (y/N) <enter>
Done. Your new project is available at /home/<username>/blogname
For most the most part you can leave all the defaults to the yes and now questions. Make sure to fill in the title of the website,
author of the website and time zone.
Setup for GitLab
By default Pelican outputs the generated files to a folder named "output", this
won't work with GitLab. Open the file pelicanconf.py and add the following line.
You can also customize any other options you wish in this file.
Navigate to your repository's Settings, and go to CI/CD Pipelines. Make sure
"Shared Runners" is enabled.
In order to tell GitLab we need Pelican installed to build out site, we need to
add a requirements.txt file.
Next we need to make the configuration file to actually build and deploy our site to
GitLab. Create a new file named .gitlab-ci.yml and add the following lines to it.
- pip install -r requirements.txt
- pelican -s publishconf.py
Since we don't have any content written yet, we need to add a .gitkeep file to
out content folder. Because Git doesn't track empty directories we add a blank
file to our content folder so that it exists when the build tool runs on GitLab's
servers. On windows simply make a empty text file and rename it .gitkeep. On Linux
or OS X you can do
Finally we are ready to test. We must stage the new/changed files, commit them
to Git then push them to GitLab where the site is built and published.
$ git add .
$ git commit -m "Inital Commit"
$ git push origin master
Navigate to your project on GitLab and go to "Pipelines". You should either see
a task running or completed or possibly failed. If the task is still running just
wait till it is complete. If the task fails you can click the "Failed" button and
go to "Failed Jobs" and get a build log to help you figure out where it went wrong.
Once the task as completed successfully you should be able to view your site at
http://<username/groupname>.gitlab.io or http://<username/groupname>.gitlab.io/projectname.
Adding New/Editing Posts
To add or edit posts just repeat the final step.
$ git add .
$ git commit -m "Some Descriptive Message"
$ git push origin master
Thats it! I hope you found this guide useful.