Break: Migrate to Hugo#3609
Merged
Merged
Conversation
Deploying with
|
| Latest commit: |
ce64f4d
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://3907b79b.cloudflare-docs-7ou.pages.dev |
Contributor
|
Hey there, I saw this pull request linked in the Cloudflare Developers Discord server. It's really cool to see how much of a difference moving to Hugo makes. I noticed that it looks almost the same, except for the sidebar. |
eidam
approved these changes
Feb 25, 2022
kristianfreeman
approved these changes
Feb 25, 2022
Contributor
|
👏 👏 👏 👏 👏 👏 👏 👏 |
jkup
approved these changes
Feb 25, 2022
deadlypants1973
approved these changes
Feb 25, 2022
kristianfreeman
added a commit
that referenced
this pull request
Feb 25, 2022
Update README with new instructions post-merge of #3609
Merged
lukeed
added a commit
that referenced
this pull request
Feb 25, 2022
* Update README.md Update README with new instructions post-merge of #3609 * update hugo versions Co-authored-by: Luke Edwards <luke.edwards05@gmail.com>
soheiokamoto
added a commit
to soheiokamoto/cloudflare-docs
that referenced
this pull request
Mar 1, 2022
This fixes `Log fields` pages. Some issues started after the migration: cloudflare#3609 - Removed `<directory-listing>` in `logs/reference/log-fields/_index.md`, since `path` was removed during the migration, and is not working any more. - Table was broken due to unescaped `|`. - `Bot Tags` link is changed to absolute links, as this pages are generated by the template that is shared with Logpush API / UI, and it needs to have them. - Extra whitespaces are removed, due to markdown page generation. Also, this adds the following to all generated markdown pages: ``` pcx-content-type: configuration weight: 21 ```
soheiokamoto
added a commit
that referenced
this pull request
Mar 2, 2022
This fixes `Log fields` pages. Some issues started after the migration: #3609 - Removed `<directory-listing>` in `logs/reference/log-fields/_index.md`, since `path` was removed during the migration, and is not working any more. - Table was broken due to unescaped `|`. - `Bot Tags` link is changed to absolute links, as this pages are generated by the template that is shared with Logpush API / UI, and it needs to have them. - Extra whitespaces are removed, due to markdown page generation. Also, this adds the following to all generated markdown pages: ``` pcx-content-type: configuration weight: 21 ``` Co-authored-by: Sohei Okamoto <sohei@cloudflare.com>
soheiokamoto
added a commit
to soheiokamoto/cloudflare-docs
that referenced
this pull request
Mar 2, 2022
This updates `CODEOWNERS` to change path from `products` to `content` to match the change from major migration: cloudflare#3609
Merged
lukeed
pushed a commit
that referenced
this pull request
Mar 2, 2022
This updates `CODEOWNERS` to change path from `products` to `content` to match the change from major migration: #3609 Co-authored-by: Sohei Okamoto <sohei@cloudflare.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
High-level Changes for Content Contributors & PCX
The
/products/top-level directory has been renamed to/content/– required by HugoEach markdown file (
*.md) needs to have atitle:defined in its frontmatter. This was previously optional, but is now required (by Hugo) as this frontmatter-defined title determines how the page is displayed in all sidebars, tables, and content lists. The title within the page (eg,# Hello World) is the page's content and may be different than thetitle:frontmatter value.The
orderfrontmatter key has been renamed toweight. It still affects list sorting/ordering.A
weightof0signifies that the item/page should not appear in a sorted list. This is equivalent an emptyorder:in the previous engine. Previously, anorder: 0meant that the item would be first, but that should now beweight: 1(New) There's now a
metablock that can be defined within a page's frontmatter. It has thetitleanddescriptionkeys, each of which can be optionally defined to custom the pages' relevant meta tags for SEO purposes. Changing ameta.title, for example, does not change the page's content title nor its title when displayed in the sidebar, lists, and tables.For example, the following page will have a meta title of "Hello Crawlers", a "Hello Lists" for sidebars/etc, and read "Hello World" in the actual page content:
Hugo does not accept JSX/MDX anymore. Instead, markdown content needs to use Hugo shortcodes. Nearly all the previous components have an equivalent shortcode. The shortcode syntax is as follows:
Our most common "shortcode" (previously "component"), was the
Aside. Here are some before/after examples:There's also a special
{{<render file="...">}}shortcode. This is a way to inject reusable markdown partials into a page. This feature was already in use with the old engine, but now takes a new form:The way this works is that every product section (eg,
content/workersvscontent/pages) can have its own_partialssubdirectory. When you use therenderpartial, itsfileargument references a filepath from the current product's_partialsdirectory. This allows you to safely construct paths to partials from anywhere deep within the file tree.You will notice that the files within the
_partialsdirectory have some funky-looking frontmatter. This is just a way to prevent Hugo from rendering the_partials/**as standalone HTML pages.(Important) Constructing links to other pages is now more intuitive and aligned with expectations. Every link must be an absolute path, starting with the product's name. This also means that you can cross-link to other products without requiring the full
https://developers.cloudflare.com/...prefix to escape the link-rewriting that took place.(Local) Development
With this move to Hugo, the entire dev docs are built and deployed as a single application!
This means that you build and develop the entire website easily – not just 1/47th of the website at once. This also makes it easier to ensure that cross-content links to other pages actually work :)
Instructions for getting started locally are included in the updated
README.mdfile, but the cliff notes are:0.92.xis required14.xis required but16.xis recommendednpm install(or equivalent, thru another package manager)Local Development
You can run
npm run dev(or equivalent; egyarn dev) to start a live-reload development server onhttp://localhost:1313. Any changes you make to the repository should instantly recompile & automatically reload any browser tabs open to thelocalhostaddress.Production Build
You can run
npm run build(or equivalent; egyarn build) to build the project for production. Apublictop-level directory will be created, containing all the minified assets. This is the directory that Pages will deploy.Building for production will run a few extra scripts that don't run during development. This includes:
npm run format– which formats all markdown files (including code blocks) for consistent code stylenpm run highlight– which will apply the previous engine's syntax highlighting rules to the code snippetsPlease do reach out with any questions or concerns.
We will be freezing / limiting other PR merges until Friday so that the deploy preview (here) remains up-to-date with the latest content.
Thanks! 🙇 👋