I used pelican as the static site generator to build a static site. I wanted to host it on GitLab Pages and let the site generate with GitLab's continuous integration with Makefile.
The site successfully builds locally as well as on GitLab via its CI/CD pipeline.
The build code passes with artifacts uploaded and job succeeded. The content files are built and produced in the public
folder.
Somehow, after the build being passed and artifacts being uploaded in public
folder as desired, it was expected to have the static site hosted on the user pages of GitLab Pages like username.gitlab.io/projectname
.
This did not work even after 15+ hours though the recommended wait time was fifteen minutes to half an hour.
Hosting on a custom subdomain was also tried. The subdomain is verified, yet the site is not being generated.
For reference, minimal code in use is mentioned below.
.gitlab-ci.yml
# default to using the latest Python docker image for builds
image: python:3.7.0
# our build job installs the Python requirements and Pelican
# plugins, then runs ``make publish`` to generate the output
build:
stage: deploy
script:
- apt-get update -qq && apt-get install -y -qq python python-pip
- python -v
- pip install -r requirements.txt
- git clone --recursive https://github.com/getpelican/pelican-plugins ../plugins
- pelican -s publishconf.py
- make publish
# specify the artifacts to save
artifacts:
paths:
- public/
only:
- master
publishconf.py
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import os
AUTHOR = 'Tanya Jain'
SITENAME = 'Tanya Jain'
SITEURL = '/public'
DESCRIPTION = ''
THEME = 'themes/stellarAdventurerTheme'
PATH = 'content'
OUTPUT_PATH = 'public'
pelicanconf.py
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import os
AUTHOR = 'Tanya Jain'
SITENAME = 'Tanya Jain'
SITEURL = '/public'
DESCRIPTION = ''
THEME = 'themes/stellarAdventurerTheme'
PATH = 'content'
OUTPUT_PATH = 'public'
Makefile
PY?=python3
PELICAN?=pelican
PELICANOPTS=
BASEDIR=$(CURDIR)
INPUTDIR=$(BASEDIR)/content
OUTPUTDIR=$(BASEDIR)/public
CONFFILE=$(BASEDIR)/pelicanconf.py
PUBLISHCONF=$(BASEDIR)/publishconf.py
FTP_HOST=localhost
FTP_USER=anonymous
FTP_TARGET_DIR=/
SSH_HOST=localhost
SSH_PORT=22
SSH_USER=root
SSH_TARGET_DIR=/var/www
Kindly help out on how to generate the site on GitLab Pages!
Update 1:
Tried these changes which too did not work. Yet, I believe the changes are to be made in the pelican settings and not the GitLab's YAML.
pelicanconf.py
SITEURL = ''
publishconf.py
SITEURL = 'http://subdomain.example.com'