Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
e9b28a9
Added script to process references in the markdown files
aleksandrychev May 21, 2025
f7912fb
Added pre-processor script to fix issues when Hugo uses CFEngine must…
aleksandrychev May 21, 2025
8aba91c
Removed printable processor we do not use
aleksandrychev May 21, 2025
2021948
Adjusted metadata alias to follow directory structure
aleksandrychev May 22, 2025
8c45cde
Removed category metadata
aleksandrychev May 22, 2025
8748f6d
Moved section files into directories and renamed to _index.markdown
aleksandrychev May 23, 2025
62c2b59
Moved documentation conent into conent directory
aleksandrychev Apr 21, 2026
ed8009c
Added preprocessor script to fix image paths
aleksandrychev May 26, 2025
315d5f7
Adjusted the links from html to path-based on the Home page
aleksandrychev Jun 18, 2025
b956529
Replaced Jekyll comments with HTML comments supported by Hugo
aleksandrychev Jun 18, 2025
80fdd95
Added search and versions pages
aleksandrychev Jun 18, 2025
e345df8
Removed unsuported {%raw%}
aleksandrychev Jun 18, 2025
f29d4f9
Adjusted pre-process and run scirpts
aleksandrychev Jun 18, 2025
24cacc5
Removed unnessesary files from generator
aleksandrychev Jun 6, 2025
bd4a5ad
Removed Jekyl dependencies
aleksandrychev Jun 18, 2025
fb1c1fa
Removed webpack and dependencies
aleksandrychev Jun 13, 2025
471b979
Show versions list on the Versions page
aleksandrychev Jun 13, 2025
b7abcb1
Moved hugo install bits into shared scripts
aleksandrychev Jun 13, 2025
3397635
Added bump hugo version action
aleksandrychev Jun 13, 2025
1fa9644
Added hugo config, layouts and static files
aleksandrychev May 29, 2025
bc05756
Added branch placeholder to the Hugo config and script that replaces it
aleksandrychev Jun 17, 2025
f3f4854
Removed unsupported published frontmatter
aleksandrychev Apr 21, 2026
984e651
Get rid of try/except blocks from cfdoc preprocess
aleksandrychev Jun 18, 2025
ed8804e
Get rid of generator/pages directory as we use hugo/content
aleksandrychev Jun 18, 2025
dd0c000
Updated README.md
aleksandrychev Jun 18, 2025
e67b984
Removed codeblock resolver pre-process script
aleksandrychev Apr 21, 2026
ec5aa70
Removed included markdowns to prevent them from being rendered
aleksandrychev Jun 20, 2025
9edd949
Fixed whitespaces
aleksandrychev Jun 23, 2025
10b20de
Removed versions and search old markdowns
aleksandrychev Jun 24, 2025
2769df7
Copy redirects.conf to _site
aleksandrychev Jun 24, 2025
81acada
Copied search index into proper location
aleksandrychev Jun 25, 2025
d109fe3
Added searchUrlPrefix config
aleksandrychev Jun 25, 2025
67b3abb
Fixed versions links
aleksandrychev Jun 26, 2025
e9f917a
Added aliases to support redirects from the previous docs structure
aleksandrychev Apr 21, 2026
5397350
Fixed verification of hugo sha256 sum
nickanderson Jul 23, 2025
40b9ef8
Added missing reference to Functions#collecting functions
aleksandrychev Jul 24, 2025
3c70590
Fixed cfdoc_references_resolver.py processed functions twice
aleksandrychev Jul 31, 2025
4803783
Reformatted python code with black
olehermanse Aug 4, 2025
94a2fda
Stop docs generation if npm build:all script failed
aleksandrychev Aug 27, 2025
1e6a029
Added codeblock pre-processor that adds value to one-word flags
aleksandrychev Aug 28, 2025
885aad3
Do not add lts to the title and use in branch actual LTS version
aleksandrychev Nov 17, 2025
ae7929c
Fixed search index documents copying
aleksandrychev Nov 17, 2025
0d571e7
Added Latest LTS versions entry if current branch is lts
aleksandrychev Nov 11, 2025
58c5556
Fixed fdoc_sourcelinks: Error opening issues
aleksandrychev Nov 25, 2025
85056f0
Fixed - wrong number of tokens issues
aleksandrychev Nov 25, 2025
486423f
Silence fetch_file download statistics in logs
aleksandrychev Nov 25, 2025
ff2d8b7
Fixed case-sensitive reference lookup causing unresolved references
aleksandrychev Nov 25, 2025
f7730f8
fix: make the container image to build docs clear on which platform w…
craigcomstock Apr 10, 2026
f27b9a4
Added missing params to the config.toml
aleksandrychev Oct 7, 2025
6161825
Use params shortcode to access global parameters from content
aleksandrychev Oct 7, 2025
95dc9df
Override menu layout to include versions
aleksandrychev Oct 8, 2025
40b3e3f
Use only footer links partial layout
aleksandrychev Oct 9, 2025
81f33ba
cfdoc_macros.py: Switch to new hugo-like syntax for CFEngine_ macros
olehermanse Aug 4, 2025
4f45e30
Find and replace for new cfdoc macro syntax
aleksandrychev Apr 21, 2026
9045f29
Manual edits for new macro syntax
olehermanse Aug 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
42 changes: 42 additions & 0 deletions .github/workflows/bump-hugo-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Hugo version update

on:
schedule:
- cron: "0 0 * * 0" #perform every sunday's night
workflow_dispatch:

jobs:
update_hugo_version:
if: github.repository_owner == 'cfengine' || github.repository_owner == 'mendersoftware' || github.repository_owner == 'NorthernTechHQ'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Fetch latest Hugo release info
id: fetch_hugo_version
run: |
release_info=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest)
version=$(echo "$release_info" | jq -r '.tag_name' | sed 's/v//')
# download checksums and find checksum of hugo_${version}_Linux-64bit.tar.gz
checksum=$( curl -sSL https://github.com/gohugoio/hugo/releases/download/v${version}/hugo_${version}_checksums.txt | grep hugo_${version}_Linux-64bit.tar.gz | grep -oE "[a-z0-9]{64}")
echo "version=$version" >> $GITHUB_OUTPUT
echo "checksum=$checksum" >> $GITHUB_OUTPUT

- name: Update install_hugo.sh
run: |
sed -i "s|https://github.com/gohugoio/hugo/releases/download/v.*_Linux-64bit.tar.gz|https://github.com/gohugoio/hugo/releases/download/v${{ steps.fetch_hugo_version.outputs.version }}/hugo_${{ steps.fetch_hugo_version.outputs.version }}_Linux-64bit.tar.gz|" generator/build/install_hugo.sh
sed -i "s/.*sha256sum.*/RUN echo \"${{ steps.fetch_hugo_version.outputs.checksum }} hugo.tar.gz\" | sha256sum -c/" generator/build/install_hugo.sh
- name: Create Pull Request
uses: cfengine/create-pull-request@v7
with:
commit-message: Upgraded Hugo version to ${{ steps.fetch_hugo_version.outputs.version }}
title: Upgraded Hugo version to ${{ steps.fetch_hugo_version.outputs.version }}
body: |
This PR updates the version of Hugo used in the generator/build/install_hugo.sh to ${{ steps.fetch_hugo_version.outputs.version }}.
reviewers: |
aleksandrychev

branch: hugo-version-update-${{ steps.fetch_hugo_version.outputs.version }}
sign-commits: true
54 changes: 25 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,18 +223,14 @@ Note: Do not use markdown files prefixed with `.`. They are not picked up by the

Additional META tags you should set are:

layout: default

Leave this as `default`.

title: "The Title"

The title of the page. Quoting is only necessary if the title contains YAML
keywords (like "on").

published: true|false
hidden: true

Pages that set this tag to `false` will not be part of the navigation structure.
Pages that set this tag to `true` will not be part of the navigation structure.
The HTML content will however be generated.

tags: [list, of, tags with space, all lowercase]
Expand Down Expand Up @@ -326,10 +322,10 @@ With single backticks, this would link to the documentation of the `meta` attrib
### Custom macros

The documentation generator will pre-process the markdown content
before passing it to Jekyll for the rendering. The pre-processor
before passing it to Hugo for the rendering. The pre-processor
understands and replaces the macros. Macros all have the form

`[%CFEngine_MACRO(parameters)%]`
`{{< CFEngine_MACRO(parameters) >}}`

and need to be used as a separate line, as the entire line will be
replaced by the pre-processor.
Expand All @@ -350,11 +346,11 @@ are skipped.
The generator searches for `filename` in the `core/examples`
subdirectory of WKRDIR.

- `[%CFEngine_include_example(filename)%]`
- `{{< CFEngine_include_example(filename) >}}`

Injects the code from `filename`.

- `[%CFEngine_include_snippet(filename, begin_rx, end_rx [optional])%]`
- `{{< CFEngine_include_snippet(filename, begin_rx, end_rx [optional]) >}}`

Searches `filename` for the first line that matches the regular
expression `begin_rx`, and injects all lines as a code block from
Expand All @@ -364,7 +360,7 @@ omitted, all lines until the end of the file will be injected.
If the line that matches the regular expression is a comment, then
it is excluded from the quote, otherwise it is included.

- `[%CFEngine_include_markdown(filename, begin_rx, end_rx [optional])%]`
- `{{< CFEngine_include_markdown(filename, begin_rx, end_rx [optional]) >}}`

Searches `filename` for the first line that matches the regular
expression `begin_rx`, and injects all lines **verbatim** from there
Expand All @@ -373,7 +369,7 @@ all lines until the end of the file will be injected.

#### Documenting policy libraries

- `[%CFEngine_library_include(filename)%]`
- `{{< CFEngine_library_include(filename) >}}`

Parses the JSON version of the CFEngine policy in `filename` and generates
documentation from it.
Expand Down Expand Up @@ -415,7 +411,7 @@ The following macros require the syntax map to be generated
via `cf-promises -s` into a file `syntax_map.json` within the
`_generated` subdirectory of the documentation generator.

- `[%CFEngine_function_prototype(arg1, arg2, ...)%]`
- `{{< CFEngine_function_prototype(arg1, arg2, ...) >}}`

Renders the prototype of the function that has the same name as the
title of the current page. Parameters `arg1` etc are used for the names
Expand All @@ -430,7 +426,7 @@ of the parameters:
Use this before a `**Description:**` section in which the behavior of the
function as well as the individual parameters are then explained.

- `[%CFEngine_function_attributes(arg1, arg2, ...)%]`
- `{{< CFEngine_function_attributes(arg1, arg2, ...) >}}`

Renders a list of attributes for the function that has the same name as the
title of the current page. `arg1` etc are used for the parameter names:
Expand All @@ -450,7 +446,7 @@ Document the individual parameters either directly in the `**Description:**`
section, or as a block after using this macro. You cannot use the macro if
individual options of option-type parameters need detailed explanation.

- `[%CFEngine_promise_attribute(default)%]`
- `{{< CFEngine_promise_attribute(default) >}}`

Renders the syntax description of the current promise attribute. The current
markdown needs to comply with the following:
Expand All @@ -471,15 +467,15 @@ level 4 header is interpreted to be the body attribute.

### attribute1

[%CFEngine_promise_attribute(default)%]
{{< CFEngine_promise_attribute(default) >}}

This will document "attribute1" of "promise_type"

### body

#### attribute1

[%CFEngine_promise_attribute(default)%]
{{< CFEngine_promise_attribute(default) >}}

This will document "attribute1" of "body"
```
Expand All @@ -498,17 +494,17 @@ The generated markdown is:
If a `default` parameter is provided, then a `**Default value:**` statement
is created.

- `[%CFEngine_function_table()%]`
- `{{< CFEngine_function_table() >}}`

Renders a table of built-in functions, grouped by function category.

- `[%CFEngine_syntax_map(subtree)%]`
- `{{< CFEngine_syntax_map(subtree) >}}`

Renders a nested tree of CFEngine words, starting at `subtree`.

#### Other macros

- `[%CFEngine_redirect(target)]`
- `{{< CFEngine_redirect(target) >}}`

Injects javascript that redirects the current page to the HTML page for `target`,
which needs to be a title or title#section combination as in regular `[text][title#section]`
Expand All @@ -518,11 +514,11 @@ links.

- follow the [Policy style guide](guide/writing-and-serving-policy/policy-style.markdown)
in examples and code snippets
- use the appropriate lexer for syntax highlighting via Pygments
- use the appropriate lexer for syntax highlighting via Chroma

Most important are the `cf3` lexer, as well as `bash`, `console`,
`diff`, `shell-session` and `sql`. But Jekyll supports
[many more lexers](https://pygments.org/docs/lexers/)
`diff`, `shell-session` and `sql`. But Hugo supports
[many more lexers](https://gohugo.io/content-management/syntax-highlighting/#languages)

- avoid custom color schemes and hand-coded HTML
- document the example after the example code
Expand All @@ -549,7 +545,7 @@ requires a body template, then see next section).
Longer explanation on what it does and why it is useful,
over multiple paragraphs if necessary.

[%CFEngine_promise_attribute(default value)%]
{{< CFEngine_promise_attribute(default value) >}}

More information about special input values.

Expand Down Expand Up @@ -585,7 +581,7 @@ body type, with the most relevant attributes set to self-explanatory values.
Longer explanation on what this body template is used for,
over multiple paragraphs if necessary.

[%CFEngine_promise_attribute()%]
{{< CFEngine_promise_attribute() >}}

**Example:**

Expand All @@ -607,7 +603,7 @@ runnable code.
No header necessary - there is one function per page, and the page's
title is the name of the function.

[%CFEngine_function_prototype(parameter1, parameters2, ...)%]
{{< CFEngine_function_prototype(parameter1, parameters2, ...) >}}

**Description:** Returns something based on `parameter1` and `parameter2`.

Expand All @@ -618,7 +614,7 @@ title is the name of the function.

Over multiple paragraphs if necessary.

[%CFEngine_function_attributes(parameter1, parameter2)%]
{{< CFEngine_function_attributes(parameter1, parameter2) >}}

Explain important attribute values, correlations and limitations.

Expand Down Expand Up @@ -668,9 +664,9 @@ Special variables are documented within the page of their context.

## Publishing

Jekyll is used to generate the HTML pages. The toolchain is available at
Hugo is used to generate the HTML pages. The toolchain is available at
https://github.com/cfengine/documentation/tree/master/generator. After you compile pages,
Jekyll will place all files into the \_site folder, without subdirectories.
Hugo will place all files into the \_site folder.

Commits in this repository trigger the documentation generator to run, which
then updates the contents of https://docs.cfengine.com/docs/
Expand Down
21 changes: 10 additions & 11 deletions cheatsheet.markdown
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
layout: printable
title: Markdown cheatsheet
published: true
sorting: 1
alias: markdown-cheatsheet.html
---
Expand Down Expand Up @@ -502,16 +501,16 @@ Examples from cfengine/core can be rendered using the `CFEngine_include_example`
`[\%CFEngine_include_example(class-automatic-canonificiation.cf)\%]`

{% raw %}
[%CFEngine_include_example(class-automatic-canonificiation.cf)%]
{{< CFEngine_include_example(class-automatic-canonificiation.cf) >}}
{% endraw %}

### Include snippet of text from a file

Sometimes it's nice to include a snippet from another file. For example, we dynamically generate the `--help` output for each component on each doc build and that output is included on each component page.

`[%CFEngine_include_snippet(cf-promises.help, [\s]*--[a-z], ^$)%]`
`{{< CFEngine_include_snippet(cf-promises.help, [\s]*--[a-z], ^$) >}}`

[%CFEngine_include_snippet(cf-promises.help, [\s]*--[a-z], ^$)%]
{{< CFEngine_include_snippet(cf-promises.help, [\s]*--[a-z], ^$) >}}

---

Expand All @@ -520,7 +519,7 @@ Sometimes it's nice to include a snippet from another file. For example, we dyna
Sometimes it's nice to include an external file

<pre>
[%CFEngine_include_markdown(masterfiles/CHANGELOG.md)%]
{{< CFEngine_include_markdown(masterfiles/CHANGELOG.md) >}}
</pre>

#### Including chunks of policy from the MPF
Expand Down Expand Up @@ -571,21 +570,21 @@ If you are referring to something within UI / screenshots / buttons etc use bold

### symlink example

[%CFEngine_include_snippet(masterfiles/lib/files.cf, ^body\slink_from\sln_s.*, ^##)%]
{{< CFEngine_include_snippet(masterfiles/lib/files.cf, ^body\slink_from\sln_s.*, ^##) >}}

### Self documenting policy

#### For the stdlib:

[%CFEngine_library_include(lib/commands)%]
{{< CFEngine_library_include(lib/commands) >}}

#### For update.cf?

[%CFEngine_library_include(update)%]
{{< CFEngine_library_include(update) >}}

#### for promises.cf?

[%CFEngine_library_include(promises)%]
{{< CFEngine_library_include(promises) >}}

## Variables

Expand All @@ -597,7 +596,7 @@ three dashes at the top) or in
[\_config.yaml](https://github.com/cfengine/documentation/blob/master/generator/_config.yml)
can be used directly within markdown.

For example this is the '{{site.CFE_manuals_version}}' version of the
For example this is the '{{< params "CFE_manuals_version" >}}' version of the
documentation. That variable comes from \_config.yaml.

Since liquid variables look a lot like mustache variables any time you want to
Expand Down Expand Up @@ -627,7 +626,7 @@ site.CFE_manuals_version {{ site.CFE_manuals_version }}
"sort":"Host name",
"filter":{
"CFEngine version":{
"not_match":"{{site.cfengine.branch}}.0"
"not_match":"{{< params "cfengine.branch" >}}.0"
}
},
"select":[
Expand Down
Loading
Loading