- CSS 100%
|
|
||
|---|---|---|
| .forgejo/workflows | ||
| assets | ||
| content | ||
| resources/_gen/images/images | ||
| static | ||
| themes | ||
| .gitignore | ||
| config.toml | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| README.md | ||
Example Hugo website using Ilot Pages.
Learn more about Ilot Pages at https://pages.ilot.io and the official documentation https://wiki.ilot.io/books/pages
Forge CI
This project's static Pages are built by Forge CI, following the steps
defined in .forgejo/workflows/pages.yaml:
on:
push:
branches:
- 'main'
env:
HUGO_ENV: production
THEME_URL: "github.com/adityatelange/hugo-PaperMod"
jobs:
render:
runs-on: aarch64
container:
image: ghcr.io/gohugoio/hugo:v0.160.1
steps:
- name: Repo pull
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: recursive
- name: Pages repo pull
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: pages
path: public
- name: Render website
run: hugo --minify
- name: Website upload
run: |
[ -f .domains ] && cp .domains public/.domains || echo '.domains not found, skipping.'
[ -f _redirects ] && cp _redirects public/_redirects || echo '_redirects not found, skipping.'
git log -1 --pretty=%B > commit.txt
cd public
date > generated.txt
# Note: the following account information will not work on GHES
git config user.name "forgejo-actions[bot]"
git config user.email "pages@ilot.page"
git add .
git commit -F ../commit.txt
git push
Forge makes available to the hosting server whatever files are sent to
the pages branch. The workflow does the following:
- Fetches
ghcr.io/gohugoio/hugoimage - Fetches the
mainbranch and submodules, and changes directory into it - Fetches the
pagesbranch under./public - Renders website to
./public - Copies (if available)
.domainsand_redirectsfile if using custom domains or custom directs - Writes current commit information to
commit.txtto be picked up later - Commits changes to
pagesbranch, matching commit message - Pushes changes to
pagesbranch
Set baseURL in config.toml
Update the baseURL setting in your config.toml file from "https://pages.ilot.io/hugo/" to your deployed Pages URL.
Building locally
To work locally with this project, you'll have to follow the steps below:
-
Fork, clone or download this project.
-
Install Hugo.
-
Install the theme as a Hugo module:
hugo mod get -u github.com/adityatelange/hugo-PaperMod -
Preview your project:
hugo server -
Add content.
-
Optional. Generate the website:
hugo
Read more at Hugo's documentation and how to use the theme.
Use a custom theme
Hugo supports a variety of themes.
Visit https://themes.gohugo.io/ and pick the theme you want to use. In the Pages example, we use https://themes.gohugo.io/themes/hugo-papermod/.
Use a custom theme using a Hugo module
The example .pages.yaml uses Hugo modules to import the theme.
To use your own theme, the following steps will help you recreate the hugo modules that include the information of your theme. You must perform them locally:
-
Edit
config.tomland comment out the already existing theme:#theme = ["github.com/adityatelange/hugo-PaperMod"] -
Remove
go.modandgo.sum:rm -f go.mod go.sum -
Recreate the theme module:
hugo mod init gitlab.com/pages/hugo -
Recreate the checksum:
hugo mod get -u github.com/adityatelange/hugo-PaperMod -
Edit
config.tomland add the theme back:theme = ["github.com/adityatelange/hugo-PaperMod"] -
Finally, edit
.gitlab-ci.yml, and replace theTHEME_URLvariable with the URL of your theme:THEME_URL: "github.com/adityatelange/hugo-PaperMod" -
Remove the files under
content/as they might be specific to the default theme. -
Add content under
content/. -
Commit all the changes and push them to your repository.
Did you fork this project?
If you forked this project for your own use, please go to your project's Settings and remove the forking relationship, which won't be necessary unless you want to contribute back to the upstream project.
Troubleshooting
CSS is missing!
That means two things:
- Either that you have wrongly set up the CSS URL in your templates.
- Or the
baseURLinconfig.tomlis not corretly set. For more information see issue https://gitlab.com/pages/hugo/-/issues/18.
Minify the assets
If you want to minify the assets (JS, CSS, images, etc.), take a look at the Hugo documentation and at this merge request.