mirror of https://gitlab.com/curben/blog
4.2 KiB
4.2 KiB
curben.gitlab.io
Forked from GitLab's Hexo example with Typing theme.
Installation (GitLab Pages only)
- Fork this project.
- Make sure Shared Runners is enabled. Go to your (forked) project
Settings -> CI / CD -> Shared Runners
. - Change project website to a user website, so the website's home page is available at
<your-username>.gitlab.io/
, instead of<your-username>.gitlab.io/hexo
. Go toSettings -> General -> Advanced -> Rename repository
. Change the Path to<your-username>.gitlab.io
. - Clone this project to your workstation. Change
<folder>
to a preferred name.
git clone https://gitlab.com/curben/curben.gitlab.io <folder>
- Install Node.js.
# Installing npm will also install nodejs as dependency.
# Ubuntu/Debian
sudo apt-get install npm
# Fedora/Red Hat
sudo yum install npm
# Arch Linux
sudo pacman -S npm
- Install Hexo and its dependencies (defined in package.json).
sudo npm install -g hexo-cli
cd <folder>
npm install
- Edit README.md and make whatever changes, can be just a word.
- Generate static files to check for any error. You should always do this before pushing/merging commits to the
master
branch.
hexo generate
- Commit the changes and push them. The generated
public
andnode_modules
are ignored, as GitLab runner will generate itself. - Check the build status by going to your project
CI /CD -> Pipelines
. Due to the limitation ofhexo
, the build will always pass even when error occurred. Check the Jobs log, look for any error in$ hexo deploy
. - If no error, the generated website would be available on
<your-username>.gitlab.io/
or the link shown on your projectSettings -> Pages
. - Follow this guide to create a new post or a new page.
Configuration
Favicon (recommended)
RealFaviconGenerator provides a web-based tool to generate favicons with wide compatibility.
- Upload your favicon (at least 260x260) and configure however you want.
- Install the generated package to favicons folder.
- Edit head.ejs. Change the
color
values ofmask-icon
andmsapplication-TileColor
to the values you configured on the generator. - Check for any error using
hexo generate
(you should do this before you push any commit). - Commit and push.
- Check your favicon with the favicon checker.
Project page (optional)
If you prefer to have a project page on GitLab
- go to
Settings -> General -> Advanced -> Rename repository
. Change the Path to<directory>
, so the website is available at<your-username>.gitlab.io/<directory>
,<directory>
can be any name, likeblog
orhexo
. - Edit _config.yml, change the
root:
value from""
to"/<directory/"
. - Commit and push.
Remove fork relationship (optional)
If you don't have any plan to send merge requests to the upstream, you can remove fork relationship permanently by going to Settings -> General -> Advanced -> Remove fork relationship
.
Changes
The following are the major changes I made from the upstream.
Hexo
- Update .gitlab-ci.yml to use the latest version of Node.js in the Docker image.
- Update package.json to use latest version of hexo and its related packages.
- Replace the bundled Landscape theme with Typing theme.
Typing theme
- Homepage shows index of posts.
- Remove header and footer display (except for
/about
page). - Use the latest version of jQuery, fancyBox and Font Awesome
- All js and css files are self-hosted.
- Remove analytic, comment system and donation links.
Useful links: Hexo Docs GitLab Pages