Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/hugo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,7 @@ jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.169.0
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb

- name: Checkout
uses: actions/checkout@v4
with:
Expand All @@ -51,14 +44,21 @@ jobs:
if: ${{ !env.ACT }}
uses: actions/configure-pages@v5

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm

# Installs Hugo (pinned in package.json), Dart Sass, PostCSS and Pagefind.
- name: Install Node.js dependencies
run: npm install --no-audit --no-fund
run: npm ci --no-audit --no-fund

- name: Build with Hugo
env:
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
HUGO_ENVIRONMENT: production
run: |
npm run build:prod
run: npm run build

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nodejs 18.14.0
nodejs 22.12.0
44 changes: 25 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,12 @@ We encourage people to [join the community](https://fodydev.org/community) and g

This site is built using the [Hugo](https://gohugo.io) static site generator. The site uses the [Dot-Org Theme for Hugo](https://github.com/cncf/dot-org-hugo-theme) as a base and then has its own customisations.

In order to build or locally develop the website, you'll need to install [Hugo](https://gohugo.io) and [node.js](https://nodejs.org/en).
In order to build or locally develop the website, you only need [node.js](https://nodejs.org/en) **v22 or newer** (and git). Everything else comes from npm and is pinned in `package.json`:

If you don't have them installed, you can install them via [brew.sh](https://brew.sh).
- [Hugo](https://gohugo.io) **v0.170.1** (npm package `hugo-extended`; since Hugo v0.170 there is no separate "extended" edition)
- Dart Sass (`sass-embedded`), PostCSS/Autoprefixer, [Pagefind](https://pagefind.app) (search) and `serve` (static server for `npm start`)

```bash
# macOS
brew install hugo node
```

Then following these instructions:
Then follow these instructions:

1. Clone this repo to a local directory on your computer.

Expand All @@ -40,23 +36,31 @@ git submodule update --init --recursive
npm install
```

4. Build the site:
4. Start the local server with live reload (drafts and future posts included):

```bash
npm run build:dev
npm run dev
```

5. Start the local server with live reload:
## npm commands

```bash
npm run dev:start
```
The project uses the standard npm script names, so hosts with auto-deploy (Railpack, Railway, Nixpacks, …) work without extra configuration: `npm install` → `npm run build` → `npm start`.

## Other npm commands for working with a local instance
| Command | What it does |
| -------------------- | ------------------------------------------------------------------------------------------------ |
| `npm run dev` | Local dev server with live reload on http://localhost:1313 (no search index) |
| `npm run dev:search` | Builds the Pagefind search index first, then starts the dev server (search works locally) |
| `npm run build` | Production build (minified) into `public/` + Pagefind search index |
| `npm run build:dev` | Development build (drafts and future posts included) into `public/` + search index |
| `npm start` | Serves the built `public/` folder on `0.0.0.0:$PORT` (default `3000`) |

- `npm run dev:start` - Starts the local dev environment (without pagefind)
- `npm run dev:build` - Builds the site for dev environment
- `npm run dev:prod` - Builds the site for prod envirionment
The production build uses `baseURL: https://fodydev.org` (`config/production/hugo.yaml`). To deploy on another domain, set the `HUGO_BASEURL` environment variable at build time.

> On npm ≥ 11 with install scripts restricted, the `hugo-extended` postinstall may be skipped: Hugo is then downloaded automatically on its first run.

### Deploying with Railpack

No configuration is needed: Railpack detects Node.js (version from `engines.node`), runs `npm ci`, `npm run build`, then `npm start`, which listens on the `PORT` it provides.

### To run in docker

Expand All @@ -66,10 +70,12 @@ As mentioned above, fork and clone this repository, run `git submodule update --
./run-hugo-in-docker.sh
```

This command should give an address you can visit on your local machine to see the local copy of your site. Typically this is `localhost:1313`. Just navigate to http://localhost:1313 in your browser and you should see the site running.
It runs `npm install`, `npm run build:dev` and `npm run dev` in a `node:22` container (its `node_modules` is kept separate from yours). Then open http://localhost:1313 in your browser.

If modifying the theme files, you should never edit the theme that is imported via Git Submodule, as otherwise the changes will be overwritten or lost the next time the theme is updated. Changes should be made in override files inside the root directory as this will override the theme directory. [Read docs](https://gohugo.io/getting-started/directory-structure/).

The project follows the Hugo v0.146+ template layout: partials live in `layouts/_partials/`, shortcodes in `layouts/_shortcodes/`, the home page template is `layouts/home.html` and single pages use `page.html`. A few theme templates are overridden in `layouts/` only to replace APIs deprecated in recent Hugo releases (`.Site.Languages`, `.Site.Data`, `.Site.LanguageCode`, `.Language.LanguageName`); they can be removed once the upstream theme is updated.

## Updating the theme

From the site root:
Expand Down
6 changes: 6 additions & 0 deletions config/_default/hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ timeZone: "Africa/Douala"
# Defines the minimum amount of words to reddened in a summary
summaryLength: 50

######################## hugo version ####################
# Fail early with a clear message when built with an unsupported Hugo version.
module:
hugoVersion:
min: "0.170.0"

######################## i18n ####################
# Auto-detect Chinese/Japanese/Korean Languages in the content. see: https://gohugo.io/getting-started/configuration/#hascjklanguage
hasCJKLanguage: false
Expand Down
9 changes: 5 additions & 4 deletions config/_default/languages.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
en:
languageName: English
label: English
weight: 1
### copyright (markdown can be used) ###
copyright: "Copyright &copy; {{< current_year >}} FodyDev. All rights reserved. [Dot Org Theme](https://github.com/cncf/dot-org-hugo-theme) by [CNCF](https://www.cncf.io)."
Expand Down Expand Up @@ -57,12 +57,13 @@ en:
url: "/blog/"
weight: 4
fr:
languageName: Français
label: Français
contentDir: content/fr
weight: 2
### copyright (markdown can be used) ###
copyright: "Copyright &copy; {{< current_year >}} FodyDev. Tous droits réservés. [Dot Org Theme](https://github.com/cncf/dot-org-hugo-theme) par [CNCF](https://www.cncf.io)."
title: "FodyDev // Promouvoir la souveraineté africaine à travers l'open source"
params:
copyright: "Copyright &copy; {{< current_year >}} FodyDev. Tous droits réservés. [Dot Org Theme](https://github.com/cncf/dot-org-hugo-theme) par [CNCF](https://www.cncf.io)."
title: "FodyDev // Promouvoir la souveraineté africaine à travers l'open source"
description: "FodyDev est une organisation open source qui vise à promouvoir la souveraineté africaine à travers les technologies libres."
### accessibility ###
accessibility:
Expand Down
26 changes: 26 additions & 0 deletions layouts/_partials/blog/byline.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- $date := .Date.Format "January 2, 2006" }}
{{- $allAuthors := hugo.Data.authors }}
{{- $authorKey := .Params.author }}
{{- $authorData := index $allAuthors $authorKey }}

<div class="blog-item__byline">
<p>
{{ if $date }}
<span class="blog-item__date">{{ $date }}</span>
{{ end }}
{{ if $authorData }}
<span class="blog-item__author"
>{{ i18n "by" | default "by" }}
{{ if $authorData.twitter }}
<a
href="https://www.twitter.com/{{ $authorData.twitter }}"
title="Visit {{ $authorData.name }} on Twitter"
>{{ $authorData.name }}</a>
{{ else }}
{{ $authorData.name }}
{{ end }}
{{ if $authorData.company }}({{ $authorData.company }}){{ end }}
</span>
{{ end }}
</p>
</div>
14 changes: 14 additions & 0 deletions layouts/_partials/footer/github.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{ with .Site.Params.github }}
{{ if and .repo_url .show_edit_link }}
{{ with $.File }}
{{ $pageRelPath := replace .Path "\\" "/" }}
{{ $langPrefix := $.Site.Language.Lang }}
{{ $editURL := printf "%s/content/%s/%s" $.Site.Params.github.repo_url $langPrefix $pageRelPath }}

<a target="_blank" rel="noopener noreferrer" href="{{ $editURL }}" class="nowrap">
{{ $.Site.Params.github_edit | default "Edit this page on GitHub" }}
</a>

{{ end }}
{{ end }}
{{ end }}
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{{- $source := "scss/home.scss" }}
{{- $target := "css/home.css" }}
{{ $options := (dict "targetPath" $target) }}
{{ if eq hugo.Environment "production" }}
{{ $options = merge $options (dict "outputStyle" "compressed" "enableSourceMap" false) }}
{{ else }}
{{ $options = merge $options (dict "outputStyle" "nested" "enableSourceMap" true) }}
{{ end }}
{{ $style := resources.Get $source | toCSS $options | postCSS (dict "config" "postcss.config.js") | resources.Fingerprint "sha512" }}
{{- $options := dict
"targetPath" "css/home.css"
"transpiler" "dartsass"
"outputStyle" (cond hugo.IsProduction "compressed" "expanded")
"enableSourceMap" (not hugo.IsProduction)
}}
{{- $style := resources.Get "scss/home.scss" | css.Sass $options | css.PostCSS (dict "config" "postcss.config.js") | fingerprint "sha512" }}
{{ if (eq .Kind "home") }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}" integrity="{{ $style.Data.Integrity }}" media="all">
{{ end }}
Expand Down
25 changes: 25 additions & 0 deletions layouts/_partials/language-selector.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- /* Overrides the theme's language selector to avoid .Site.Languages / .LanguageName (deprecated in Hugo v0.156 / v0.158). */ -}}
{{ if gt (len hugo.Sites) 1 }}
{{ $page := . }}
{{ $currentLang := site.Language.Lang }}
<div class="language-selector dropdown">
<div class="dropdown-current">
<span class="dropdown-arrow"><span class="dropdown-selected">{{ site.Language.Label }}</span>
</span>
</div>
<nav class="dropdown-nav">
<ul class="dropdown-group">
{{ range hugo.Sites }}
{{ if ne .Language.Lang $currentLang }}
{{ $lang := .Language.Lang }}
{{ $url := .Home.Permalink }}
{{ range $page.Rotate "language" }}
{{ if eq .Language.Lang $lang }}{{ $url = .Permalink }}{{ end }}
{{ end }}
<li><a href="{{ $url }}">{{ .Language.Label }}</a></li>
{{ end }}
{{ end }}
</ul>
</nav>
</div>
{{ end }}
9 changes: 9 additions & 0 deletions layouts/blog/page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{ define "main" }}
{{- $date := .Date.Format "Monday, January 1, 2006" }}
{{- $allAuthors := hugo.Data.authors }}
{{- $author := .Params.author }}

{{- partial "blog/byline.html" . }}
{{ .Content }}

{{ end }}
File renamed without changes.
Loading
Loading