-
Notifications
You must be signed in to change notification settings - Fork 292
Hugo docs: Support newer Hugo and Hugo Relearn versions; update README #6264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
bernhardkaindl
wants to merge
1
commit into
xapi-project:master
from
xenserver-next:Hugo-docs-updates-to-Relearn-6.4.0-an-newer-Hugo
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,32 @@ | ||
# Quick start guide: | ||
# Quick start guide | ||
|
||
- Visit https://xapi-project.github.io/new-docs/ to view the current documentation. | ||
- Visit <https://xapi-project.github.io/new-docs/> to view the current documentation. | ||
|
||
## Required software | ||
|
||
The docs use Hugo and the [Hugo Relearn theme](https://mcshelby.github.io/hugo-theme-relearn), | ||
an enhanced fork of the popular Hugo Learn theme. | ||
|
||
### Compatible versions | ||
### Supported versions of Hugo and the Hugo Relearn theme | ||
|
||
Due to a number of gradual changes in Hugo and Relearn, | ||
the docs are currently only compatible with specific older versions of Hugo and Relearn. | ||
Hugo Relearn 6.4.0 is currently used (defined by a git tag in `doc/go.mod`). | ||
|
||
Hugo v0.121.0 to ~v0.127.0 (the current version of the Ubuntu `snap` is too recent) | ||
- Fixes to support newer versions are forthcoming. | ||
|
||
Hugo Relearn 5.24.0 (defined by a git tag in doc/go.mod) | ||
- Note: Hugo Relearn >= 5.25 currently trigger additional warnings due to deprecations. | ||
- Further updates fix this situation are forthcoming step by step. | ||
|
||
Hugo Relearn >= 5.24.0 and < 6.x are expected to work: | ||
- https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/index.html#5-24-0 | ||
- Breaking changes in Relearn 6.0.0: | ||
https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/6/#6-0-0 | ||
- The minimum Hugo version required by the Relearn theme is 0.126.0. | ||
- The current Ubuntu `snap` (which provides 0.142.0) also works. | ||
|
||
## Installation | ||
|
||
- Install Hugo; follow the guidance on https://gohugo.io/getting-started/installing. | ||
You'll need to install Go as well: see https://go.dev/ | ||
- Hugo installation is described at https://gohugo.io/installation | ||
- On Ubuntu 24.04, the version installed by `apt` works. | ||
- On Ubuntu 22.04 and older: | ||
- `apt-get install hugo` would install a version that is too old. | ||
- `sudo snap install hugo` installs a too recent version | ||
- Install Hugo 0.126 or newer (required by the Hugo Relearn theme) | ||
follow the guidance on <https://gohugo.io/installing>. | ||
You'll need to install Go as well: see <https://go.dev/> | ||
- On Ubuntu, use the `snap` package: | ||
- `sudo snap install hugo` installs the current version | ||
`apt-get install hugo` would install a version that is too old, | ||
(this applies up to Ubuntu 24.04) | ||
|
||
- To install Hugo from source, you need a recent `golang-1.2x` compiler: | ||
- On Ubuntu 22.04, this can be done with: | ||
|
||
```bash | ||
sudo apt install golang-1.23-go | ||
# Add it to your path, assuming your .local/bin/ is early in your PATH: | ||
|
@@ -47,13 +38,65 @@ Hugo Relearn >= 5.24.0 and < 6.x are expected to work: | |
## Development | ||
|
||
- Run a local server: `hugo server` | ||
- Open a browser at http://127.0.0.1:1313/new-docs/ | ||
- Open a browser at <http://127.0.0.1:1313/new-docs/> | ||
- Add content to `doc/content/`: | ||
- Documents are written in Markdown. | ||
- Please wrap lines in paragraphs to make review and diffs easier to read. | ||
- The menu hierarchy comes mostly from the directory structure in `content/`. | ||
- Please wrap lines in paragraphs to make reviews more manageable. | ||
- The menu hierarchy comes mainly from the directory structure in `content/`. | ||
- A file called `_index.md` is needed in a directory to define a new level in the menu. | ||
- To set the page title which is also used for the main menu, | ||
- To set the page title, | ||
[use the front matter](https://gohugo.io/content-management/front-matter/). | ||
- For a page that has images or other stuff included, it is best to create a new directory. Put the contents in a `index.md` file (no `_`) and the related files next to it. See https://gohugo.io/content-management/organization/ for more information. | ||
- Look at https://mcshelby.github.io/hugo-theme-relearn/ for more information about what the Relearn theme offers, including some handy "shortcodes". | ||
- For a page that has images or other stuff included, it is best to create a new directory: | ||
Put the contents in an `index.md` file (no `_`) and the related files next to it. | ||
See <https://gohugo.io/content-management/organization/> for more information. | ||
|
||
See <https://mcshelby.github.io/hugo-theme-relearn/> for more information about | ||
the features of the Relearn theme, including handy "shortcodes". | ||
|
||
Note: When switching versions, before re-generating the documentation using | ||
`hugo server`, delete the previously generated static site using `rm -r docs/public`. | ||
|
||
### Notes for supporting current versions of Hugo and the Relearn theme | ||
|
||
Backported fixes to support newer Hugo versions: | ||
|
||
- `layouts/partials/header.html`, it fixes: | ||
```js | ||
ERROR deprecated: .Sites.First was deprecated in Hugo v0.127.0 and will be removed in Hugo 0.143.0. Use .Sites.Default instead. | ||
``` | ||
- `layouts/partials/menu.html`, it fixes: | ||
```js | ||
ERROR deprecated: .Site.IsMultiLingual was deprecated in Hugo v0.124.0 and will be removed in Hugo 0.143.0. Use hugo.IsMultilingual instead. | ||
``` | ||
|
||
The fixes for those issues were backported from the Hugo Relearn v7.x.x theme. | ||
When updating to Hugo Relearn 7.x.x, please remove them (if possible). | ||
|
||
#### Upgrading to the Hugo Relearn 7.x.x theme versions | ||
|
||
The partials in `layouts/partials` contain code for rendering the XenAPI releases | ||
and class reference: | ||
|
||
These custom partials need updates to support the breaking changes of Hugo Relearn | ||
7.0.0. Otherwise, the Relearn theme menu sidebar on those pages would be missing. | ||
These are the pages to verify for correct menu rendering when updating to 7.x.x: | ||
|
||
- XenAPI Reference: <https://xapi-project.github.io/new-docs/xen-api/classes> | ||
- XenAPI Releases: <https://xapi-project.github.io/new-docs/xen-api/releases> | ||
|
||
Hint: For upgrading the Hugo Relearn theme, you can use: | ||
|
||
```bash | ||
cd doc; hugo mod get -u github.com/McShelby/[email protected] | ||
``` | ||
|
||
#### Summary | ||
|
||
Hugo Relearn >= 5.23 and Relearn 6.x.x work now, 7.x.x is work in progress. | ||
|
||
#### References | ||
|
||
- Changes with Relearn 6.x: | ||
<https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/6/#6-0-0> | ||
- Breaking changes with Relearn 7.x (to be supported): | ||
<https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
+++ | ||
title = "Design Documents" | ||
menuTitle = "Designs" | ||
linkTitle = "Designs" | ||
+++ | ||
|
||
{{< design_docs_list >}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: The XAPI Toolstack | ||
menuTitle: The Toolstack | ||
linkTitle: The Toolstack | ||
weight: 10 | ||
--- | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
+++ | ||
title = "XE CLI architecture" | ||
menuTitle = "CLI" | ||
linkTitle = "CLI" | ||
+++ | ||
|
||
{{% notice info %}} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
+++ | ||
title = "XAPI's Storage Layers" | ||
menuTitle = "Storage" | ||
linkTitle = "Storage" | ||
+++ | ||
|
||
{{% notice info %}} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It is only an intermediate step in making progress with a small PR.
We could go to Relearn 7 directly on one hop, but then the PR would be far more extensive.
In this case, this intermediate line would not show up in the final change, it would
be reverted to the official Relearn 7 repo in the second part of that future PR.
However, that cumulative PR would be more significant than two smaller step-by-step PRs.
A fuller explanation
This is only a good intermediary step before the next update which then could upgrade the Relearn theme to the current version of Relearn.
I asked Sören Weber (https://github.com/McShelby, the author of Relearn) if he could help. He responded, "The file structure of your repo is uncommon." and linked to one hint. This also suggests that some changes to the structure of the partials might be needed for Relearn 7.
I meanwhile researched the compatibility with upstream Relearn 7 further
According to this, the final update to the current Relearn 7 will need a small structural change as Relearn 7 does not support the architecture of how XenAPI classes and releases are typed, and it suggests that content-generating code should be moved to the content.html partial as documented in the Relearn documentation at https://mcshelby.github.io/hugo-theme-relearn/configuration/customization/partials/index.html
Using this guidance, I've found a working solution for those issues, which, instead of special types for XenAPI classes and releases, which need to be maintained and can no longer include the
header.html
andfooter.html
(those don't exist in Relearn 7).Instead, the code in the classes and releases partials should be merged into a
content.html
template to generate that content. I have a proof-of-concept: It updates the nearly emptyclass
andrelease
files (140 files) and merged the content generation into a newcontent.html
partial according to the Hugo documentation.But let's return to this PR, which is just a relatively small second intermediary step:
I solved the issues taken initially during the review by changing the URL of the Relearn module to a fork of Relearn that we can use without having to copy partials from Relearn (like I initially had):
Here are the details
For the details of the issue fixed in the PR and the full update to Relearn 7,
I asked Sören Weber (the author of Relearn) in McShelby/hugo-theme-relearn#1004 if he has some guidance on how to resolve the issue at hand.
He linked to https://mcshelby.github.io/hugo-theme-relearn/configuration/customization/designs/index.html#migration-to-relearn-7-or-higher.
Here is his answer: McShelby/hugo-theme-relearn#1004 (comment)
This solution goes in this direction: It compromises between ease of use (in this case, support for using the Ubuntu snap package and any new build of Hugo in general) and using a moderately new version (or, in this case, fork) of Relearn with the needed fixes.
Conclusion
After solving the compatibility issue and updating Relearn 7.x as described in the README.md, the upstream version will again be used. This is only an intermediate deviation from upstream to facilitate the upgrade.
Alternative
Not making this change would require installing a specific older version (possibly from the source) to generate the docs. This small change is more manageable than installing a special older version of Hugo for development and maintenance until all upgrade problems are fully solved.