You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Installing OINK into an existing Hugo site takes three commands:
30
30
31
31
```sh
@@ -43,7 +43,7 @@ The current release is {{</* param version */>}}.
43
43
The result is what you would get by writing it here: the code block has its copy
44
44
button and the callout is a callout.
45
45
46
-
{{< include file="parts/install-oink.en.md" >}}
46
+
{{< include file="parts/install-oink.md" >}}
47
47
48
48
The file that gets included is not a page of its own: it is absent from the
49
49
sidebar, it takes no part in translation pairing, and it has no URL.
@@ -56,19 +56,19 @@ sidebar, it takes no part in translation pairing, and it has no URL.
56
56
| --- | --- | --- |
57
57
| 1 | A page resource — a file in this page's bundle |`file="config.yaml"`|
58
58
| 2 | A global resource under `assets/`|`file="snippets/dsn.txt"`|
59
-
| 3 | A file under `content/`: a leading `/` is the content root, otherwise relative to the page's directory |`file="parts/install-oink.en.md"`, `file="/shared/notice.md"`|
59
+
| 3 | A file under `content/`: a leading `/` is the content root, otherwise relative to the page's directory |`file="notes/caveat.md"`, `file="/shared/notice.md"`|
60
60
61
61
Missing in all three, the build fails; nothing is emitted as a placeholder. A
62
62
`..` in the path fails the build too: include reads from `content/` and
63
63
`assets/` and nowhere else.
64
64
65
-
For a Markdown fragment, write the file's real name on disk, language suffix
66
-
included — `parts/install-oink.en.md`, `parts/install-oink.zh.md`. A bare
67
-
`parts/install-oink.md`also builds, but it matches step 1: Hugo attaches a
68
-
language-suffixed resource under its stripped name, so `include` receives
69
-
already-rendered HTML instead of the source, and `<div class="td-code">` turns
70
-
up in the Markdown output. Non-Markdown files (`.yaml`, `.sh`, `.txt`) do not
71
-
have this distinction — both paths read the same bytes.
65
+
A Markdown fragment is read as source, so write the file's real name on disk.
66
+
One trap belongs to step 1 alone: Hugo attaches a language-suffixed page
67
+
resource such as `notice.zh.md`under its stripped name, so asking a bundle for
68
+
`notice.md` hands `include` already-rendered HTML instead of the source, and
69
+
`<div class="td-code">` turns up in the Markdown output. Under `assets/` and
70
+
`content/`the name you write is the file you get. Non-Markdown files
71
+
(`.yaml`, `.sh`, `.txt`) never have this distinction.
72
72
73
73
## Including code files {#code}
74
74
@@ -225,8 +225,9 @@ Any other parameter name fails the build, with the file and line in the error.
225
225
`collapse`). For per-platform variants, write two fragments and use
226
226
[tabs](/docs/tabs/).
227
227
- Fragment languages are yours to maintain: `include` does no language
228
-
fallback. A Chinese page includes a Chinese fragment, an English page an
229
-
English one, and the two files sit side by side.
228
+
fallback and takes the exact path you write. Share one fragment across
229
+
languages — this page's Chinese translation includes the same English file —
230
+
or write one per language and point each page at its own.
230
231
-`param` prints scalars only: structured data — version matrices, download
231
232
lists — belongs in `data/` and is rendered by the matching component.
232
233
-`comment` is not "unpublish for now": the content is discarded on every build.
0 commit comments