Skip to content

Commit 0fffff2

Browse files
authoredApr 23, 2020
Merge pull request docker#10549 from thaJeztah/remove_base_href
Template: remove "base href" and fix javascript link-fixing
2 parents 4b1b682 + 342660f commit 0fffff2

9 files changed

+352
-359
lines changed
 

‎_includes/cli.md

+71-27
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{% capture tabChar %} {% endcapture %}<!-- Make sure atom is using hard tabs -->
2-
{% if include.datafolder and include.datafile %}
3-
42
{% assign controller_data = site.data[include.datafolder][include.datafile] %}
3+
{% assign parentPath = page.path | prepend: "/" | remove: page.name %}
54

65
## Description
76

@@ -19,7 +18,7 @@ your client and daemon API versions.
1918

2019
{% if controller_data.deprecated %}
2120

22-
> This command is [deprecated](/engine/deprecated.md){: target="_blank" class="_"}.
21+
> This command is [deprecated](/engine/deprecated/){: target="_blank" class="_"}.
2322
>
2423
> It may be removed in a future Docker version.
2524
{: .warning }
@@ -42,7 +41,7 @@ your client and daemon API versions.
4241
> This command is experimental on the Docker daemon. It should not be used in
4342
> production environments.
4443
> To enable experimental features on the Docker daemon, edit the
45-
> [daemon.json](/engine/reference/commandline/dockerd.md#daemon-configuration-file)
44+
> [daemon.json](/engine/reference/commandline/dockerd/#daemon-configuration-file)
4645
> and set `experimental` to `true`.
4746
>
4847
> {% include experimental.md %}
@@ -56,7 +55,7 @@ your client and daemon API versions.
5655
> **It should not be used in production environments.**
5756
>
5857
> To enable experimental features in the Docker CLI, edit the
59-
> [config.json](/engine/reference/commandline/cli.md#configuration-files)
58+
> [config.json](/engine/reference/commandline/cli/#configuration-files)
6059
> and set `experimental` to `enabled`. You can go [here](https://docs.docker.com/engine/reference/commandline/cli/#experimental-features)
6160
> for more information.
6261
{: .important }
@@ -81,8 +80,8 @@ your client and daemon API versions.
8180

8281
## Usage
8382

84-
```none
85-
{{ controller_data.usage | replace: tabChar,"" | strip }}{% if controller_data.cname %} COMMAND{% endif %}
83+
```console
84+
{{ controller_data.usage | replace: tabChar, "" | strip }}{% if controller_data.cname %} COMMAND{% endif %}
8685
```
8786

8887
{% endif %}
@@ -116,27 +115,22 @@ For example uses of this command, refer to the [examples section](#examples) bel
116115
</thead>
117116
<tbody>
118117
{% for option in alloptions %}
119-
120-
{% capture deprecated-badge %}{% if option.deprecated %}<a href="/engine/deprecated.md" target="_blank" class="_"><span class="badge badge-danger" data-toggle="tooltip" title="Read the deprecation reference (in a new window).">deprecated</span></a>{% endif %}{% endcapture %}
121-
{% capture experimental-daemon-badge %}{% if option.experimental %}<a href="/engine/reference/commandline/dockerd.md#daemon-configuration-file" target="_blank" class="_"><span class="badge badge-warning" data-toggle="tooltip" title="Read about experimental daemon options (in a new window).">experimental (daemon)</span></a>{% endif %}{% endcapture %}
122-
{% capture experimental-cli-badge %}{% if option.experimentalcli %}<a href="/engine/reference/commandline/cli.md#configuration-files" target="_blank" class="_"><span class="badge badge-warning" data-toggle="tooltip" title="Read about experimental CLI options (in a new window).">experimental (CLI)</span></a>{% endif %}{% endcapture %}
118+
{% capture deprecated-badge %}{% if option.deprecated %}<a href="/engine/deprecated/" target="_blank" class="_"><span class="badge badge-danger" data-toggle="tooltip" title="Read the deprecation reference (in a new window).">deprecated</span></a>{% endif %}{% endcapture %}
119+
{% capture experimental-daemon-badge %}{% if option.experimental %}<a href="/engine/reference/commandline/dockerd/#daemon-configuration-file" target="_blank" class="_"><span class="badge badge-warning" data-toggle="tooltip" title="Read about experimental daemon options (in a new window).">experimental (daemon)</span></a>{% endif %}{% endcapture %}
120+
{% capture experimental-cli-badge %}{% if option.experimentalcli %}<a href="/engine/reference/commandline/cli/#configuration-files" target="_blank" class="_"><span class="badge badge-warning" data-toggle="tooltip" title="Read about experimental CLI options (in a new window).">experimental (CLI)</span></a>{% endif %}{% endcapture %}
123121
{% capture min-api %}{% if option.min_api_version %}<a href="/engine/api/v{{ option.min_api_version }}/" target="_blank" class="_"><span class="badge badge-info" data-toggle="tooltip" ttitle="Open the {{ controller_data.min_api_version }} API reference (in a new window)">API {{ option.min_api_version }}+</span></a>{% endif %}{%endcapture%}
124122
{% capture flag-orchestrator %}{% if option.swarm %}<span class="badge badge-info" data-toggle="tooltip" title="This option works for the Swarm orchestrator.">Swarm</span>{% endif %}{% if option.kubernetes %}<span class="badge badge-info" data-toggle="tooltip" title="This option works for the Kubernetes orchestrator.">Kubernetes</span>{% endif %}{% endcapture %}
125-
126123
{% capture all-badges %}{{ deprecated-badge }}{{ experimental-daemon-badge }}{{ experimental-cli-badge }}{{ min-api }}{{ flag-orchestrator }}{% endcapture %}
127-
128124
{% assign defaults-to-skip = "[],map[],false,0,0s,default,'',\"\"" | split: ',' %}
129125
{% capture option-default %}{% if option.default_value %}{% unless defaults-to-skip contains option.default_value or defaults-to-skip == blank %}`{{ option.default_value }}`{% endunless %}{% endif %}{% endcapture %}
130126
<tr>
131127
<td markdown="span">`--{{ option.option }}{% if option.shorthand %} , -{{ option.shorthand }}{% endif %}`</td>
132128
<td markdown="span">{{ option-default }}</td>
133129
<td markdown="span">{% if all-badges != '' %}{{ all-badges | strip }}<br />{% endif %}{{ option.description | strip }}</td>
134130
</tr>
135-
136131
{% endfor %} <!-- end for option -->
137132
</tbody>
138133
</table>
139-
140134
{% endif %} <!-- end if options -->
141135

142136
{% if controller_data.examples %}
@@ -145,25 +139,20 @@ For example uses of this command, refer to the [examples section](#examples) bel
145139

146140
{{ controller_data.examples }}
147141

148-
{% endif %}
149-
{% else %}
150-
151-
The include.datafolder or include.datafile was not set.
152-
153142
{% endif %}
154143

155144
{% if controller_data.pname %}
156145
{% unless controller_data.pname == include.datafile %}
157146

158147
## Parent command
159148

160-
{% capture parentfile %}{{ controller_data.plink | replace: ".yaml", "" | replace: "docker_","" }}{% endcapture %}
161-
{% capture parentdatafile %}{{ controller_data.plink | replace: ".yaml", "" }}{% endcapture %}
149+
{% capture parentfile %}{{ controller_data.plink | remove_first: ".yaml" | remove_first: "docker_" }}{% endcapture %}
150+
{% capture parentdatafile %}{{ controller_data.plink | remove_first: ".yaml" }}{% endcapture %}
162151
{% capture parentDesc %}{{ site.data[include.datafolder][parentdatafile].short }}{% endcapture %}
163152

164153
| Command | Description |
165154
| ------- | ----------- |
166-
| [{{ controller_data.pname }}]({{ parentfile }}) | {{ parentDesc }}|
155+
| [{{ controller_data.pname }}]({{parentPath}}{{ parentfile }}/) | {{ parentDesc }}|
167156

168157
{% endunless %}
169158
{% endif %}
@@ -181,9 +170,9 @@ The include.datafolder or include.datafile was not set.
181170
</thead>
182171
<tbody>
183172
{% for command in controller_data.cname %}
184-
{% capture dataFileName %}{{ command | strip | replace: " ","_" }}{% endcapture %}
173+
{% capture dataFileName %}{{ command | strip | replace: " ", "_" }}{% endcapture %}
185174
<tr>
186-
<td markdown="span">[{{ command }}]({{ dataFileName | replace: "docker_","" }}/)</td>
175+
<td markdown="span">[{{ command }}]({{ parentPath }}{{ dataFileName | remove_first: "docker_" }}/)</td>
187176
<td markdown="span">{{ site.data[include.datafolder][dataFileName].short }}</td>
188177
</tr>
189178
{% endfor %}
@@ -204,13 +193,68 @@ The include.datafolder or include.datafile was not set.
204193
</thead>
205194
<tbody>
206195
{% for command in site.data[include.datafolder][parentdatafile].cname %}
207-
{% capture dataFileName %}{{ command | strip | replace: " ","_" }}{% endcapture %}
196+
{% capture dataFileName %}{{ command | strip | replace: " ", "_" }}{% endcapture %}
208197
<tr>
209-
<td markdown="span">[{{ command }}]({{ dataFileName | replace: "docker_","" }}/)</td>
198+
<td markdown="span">[{{ command }}]({{ parentPath }}{{ dataFileName | remove_first: "docker_" }}/)</td>
210199
<td markdown="span">{{ site.data[include.datafolder][dataFileName].short }}</td>
211200
</tr>
212201
{% endfor %}
213202
</tbody>
214203
</table>
215204

216205
{% endunless %}
206+
207+
<script>
208+
// This is a horrible hack, and cute little kittens are sacrificed every time it's run, so we
209+
// need to remove it as soon as possible.
210+
//
211+
// Fix up links to markdown pages that weren't resolved by Jekyll (or the "jekyll-relative-links"
212+
// plugin). This is a horrible hack, and should not rely on JavaScript (perhaps be re-implemented
213+
// using Liquid). We need this hack to work around two bugs in the "jekyll-relative-links" plugin;
214+
// 1. As reported in https://github.com/benbalter/jekyll-relative-links/issues/54, (relative) links
215+
// to markdown pages in includes are not processed by Jekyll. This means that (for example) our
216+
// reference pages (which use includes) contain broken links. We can work around this by modifying
217+
// the markdown for those pages to use "absolute" "html" links (/link/to/other/page/#some-anchor),
218+
// but doing so would render the links broken when viewed on GitHub. Instead, we're fixing them up
219+
// here, hoping the bug will be fixed, and it's only temporarily.
220+
// 2. As reported in https://github.com/benbalter/jekyll-relative-links/issues/61, (relative) links
221+
// to markdown pages are not resolved if the link's caption/title is wrapped.
222+
//
223+
Array.prototype.forEach.call(document.querySelectorAll("section.section a:not(.nomunge)"), function (el) {
224+
let href = el.getAttribute("href");
225+
if (href.startsWith("/") || href.startsWith("#") || href.includes("://") || !href.includes('.md')) {
226+
// Don't modify anchor links, absolute links, links to external websites,
227+
// or links not pointing to a .md file; we assume those were
228+
// resolved successfully by Jekyll.
229+
return
230+
}
231+
if (href.startsWith("./")) {
232+
href = href.substr(2)
233+
}
234+
if ("{{ page.name }}" !== "index.md") {
235+
// For non-index pages, things are a bit hairy. For example, for /foo/bar/mypage.md, Jekyll
236+
// will generate a page named /foo/bar/mypage/index.html. This means that all links relative
237+
// to mypage.md expect those links to be relative to the /foo/bar/ directory, but end up
238+
// being relative to /foo/bar/mypage/.
239+
//
240+
// For files "next to", or "below" this file, such as "file.md" or "nested/dir/file.md" we
241+
// prepend the "parent-dir" to the URL.
242+
//
243+
// For links to files "up" the directory tree, we prepend
244+
// "../" to the URL and have the browser handle this. For example, "../file.md" and "../../file.md"
245+
// become "../../file.md" and "../../../file.md".
246+
if (href.startsWith("../")) {
247+
href = "../" + href
248+
} else {
249+
// Generate "parentPath" with Liquid, which is used below. Liquid's page.path (and page.dir)
250+
// are relative to the _generated_ HTML page, not the source page, so we have to remove the
251+
// last part of the path:
252+
// {% raw %}{% assign parentPath = page.path | prepend: "/" | remove: page.name %}{% endraw %}
253+
// {% assign parentPath = page.path | prepend: "/" | remove: page.name %}
254+
href = "{{ parentPath}}" + href
255+
}
256+
}
257+
// finally, we replace the .md extension for a slash, and update the link's href
258+
el.setAttribute("href", href.replace(".md", "/"))
259+
});
260+
</script>

‎_includes/content/compose-var-sub.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ string. In the example above, if `POSTGRES_VERSION` is not set, the value for
1818
the `image` option is `postgres:`.
1919

2020
You can set default values for environment variables using a
21-
[`.env` file](../env-file.md), which Compose automatically looks for. Values
21+
[`.env` file](/compose/env-file/), which Compose automatically looks for. Values
2222
set in the shell environment override those set in the `.env` file.
2323

2424
> Note when using docker stack deploy
@@ -28,7 +28,7 @@ set in the shell environment override those set in the `.env` file.
2828
{: .important }
2929

3030
Both `$VARIABLE` and `${VARIABLE}` syntax are supported. Additionally when using
31-
the [2.1 file format](compose-versioning.md#version-21), it is possible to
31+
the [2.1 file format](/compose/compose-file/compose-versioning/#version-21), it is possible to
3232
provide inline default values using typical shell syntax:
3333

3434
- `${VARIABLE:-default}` evaluates to `default` if `VARIABLE` is unset or

‎_includes/content/ssh/ssh-overview.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[SSH](/glossary.md#SSH) is a secure protocol for accessing remote machines and applications. It
1+
[SSH](/glossary/#SSH) is a secure protocol for accessing remote machines and applications. It
22
provides authentication and encrypts data communication over insecure networks.
33

44
These topics describe how to find existing SSH keys or generate new ones, and

‎_includes/docker_ee.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
| Capabilities | Docker Engine - Enterprise | Docker Enterprise |
44
|:---------------------------------------------------------------------|:-------------------------:|:----------------------------:|
55
| Container engine and built in orchestration, networking, security | {{green-check}} | {{green-check}} |
6-
| [Certified infrastructure, plugins and ISV containers](../ee/supported-platforms/#docker-enterprise) | {{green-check}} | {{green-check}} |
7-
| [Image management with Docker Trusted Registry security scanning](../ee/dtr/user/manage-images/scan-images-for-vulnerabilities/) | | {{green-check}} |
8-
| [Container app management with Universal Control Plane](../ee/ucp/) | | {{green-check}} |
9-
| [Developer solutions with Docker Desktop Enterprise](../ee/desktop/) | | {{green-check}} |
6+
| [Certified infrastructure, plugins and ISV containers](/ee/supported-platforms/#docker-enterprise) | {{green-check}} | {{green-check}} |
7+
| [Image management with Docker Trusted Registry security scanning](/ee/dtr/user/manage-images/scan-images-for-vulnerabilities/) | | {{green-check}} |
8+
| [Container app management with Universal Control Plane](/ee/ucp/) | | {{green-check}} |
9+
| [Developer solutions with Docker Desktop Enterprise](/desktop/enterprise/) | | {{green-check}} |

‎_includes/ee-linux-install-reuse.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on {{ linux-dist-long }}:
2323
Docker Engine - Community is _not_ supported on {{ linux-dist-long }}.
2424
{% endif %}
2525
{% if linux-dist == "centos" %}
26-
For Docker Community Edition on {{ linux-dist-cap }}, see [Get Docker Engine - Community for CentOS](/engine/install/centos.md).
26+
For Docker Community Edition on {{ linux-dist-cap }}, see [Get Docker Engine - Community for CentOS](/engine/install/centos/).
2727
{% endif %}
2828

2929
{% elsif section == "find-ee-repo-url" %}
@@ -280,7 +280,7 @@ You only need to set up the repository once, after which you can install Docker
280280
```
281281

282282
Docker Engine - Enterprise is installed and running. Use `sudo` to run Docker commands. See
283-
[Linux postinstall](/engine/install/linux-postinstall.md){: target="_blank" class="_" } to allow
283+
[Linux postinstall](/engine/install/linux-postinstall/){: target="_blank" class="_" } to allow
284284
non-privileged users to run Docker commands.
285285

286286

@@ -351,7 +351,7 @@ To manually install Docker Enterprise, download the `.{{ package-format | downca
351351
```
352352

353353
Docker Engine - Enterprise is installed and running. Use `sudo` to run Docker commands. See
354-
[Linux postinstall](/engine/install/linux-postinstall.md){: target="_blank" class="_" } to allow
354+
[Linux postinstall](/engine/install/linux-postinstall/){: target="_blank" class="_" } to allow
355355
non-privileged users to run Docker commands.
356356

357357
</div>
@@ -394,7 +394,7 @@ To manually install Docker Enterprise, download the `.{{ package-format | downca
394394
```
395395

396396
Docker Engine - Enterprise is installed and running. Use `sudo` to run Docker commands. See
397-
[Linux postinstall](/engine/install/linux-postinstall.md){: target="_blank" class="_" } to allow
397+
[Linux postinstall](/engine/install/linux-postinstall/){: target="_blank" class="_" } to allow
398398
non-privileged users to run Docker commands.
399399

400400
</div>
@@ -444,7 +444,7 @@ To manually install Docker Enterprise, download the `.{{ package-format | downca
444444
```
445445

446446
Docker Engine - Enterprise is installed and running. Use `sudo` to run Docker commands. See
447-
[Linux postinstall](/engine/install/linux-postinstall.md){: target="_blank" class="_" } to allow
447+
[Linux postinstall](/engine/install/linux-postinstall/){: target="_blank" class="_" } to allow
448448
non-privileged users to run Docker commands.
449449
{% endif %}
450450

@@ -485,7 +485,7 @@ You must delete any edited configuration files manually.
485485

486486
{% elsif section == "linux-install-nextsteps" %}
487487

488-
- Continue to [Post-installation steps for Linux](/engine/install/linux-postinstall.md){: target="_blank" class="_" }
488+
- Continue to [Post-installation steps for Linux](/engine/install/linux-postinstall/){: target="_blank" class="_" }
489489

490490
- Continue with user guides on [Universal Control Plane (UCP)](/ee/ucp/){: target="_blank" class="_" } and [Docker Trusted Registry (DTR)](/ee/dtr/){: target="_blank" class="_" }
491491

‎_includes/install-script.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ run Docker commands by default.
6969
> **Note**:
7070
>
7171
> To install Docker without root privileges, see
72-
> [Run the Docker daemon as a non-root user (Rootless mode)](/engine/security/rootless.md).
72+
> [Run the Docker daemon as a non-root user (Rootless mode)](/engine/security/rootless/).
7373
>
7474
> Rootless mode is currently available as an experimental feature.
7575

‎_includes/kubernetes-mac-win.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ your workloads, in parallel, on Kubernetes, Swarm, and as standalone containers.
5555
Enabling or disabling the Kubernetes server does not affect your other
5656
workloads.
5757

58-
See [{{ product }} > Getting started](/docker-for-{{ platform }}/index.md#kubernetes) to
58+
See [{{ product }} > Getting started](/docker-for-{{ platform }}/#kubernetes) to
5959
enable Kubernetes and begin testing the deployment of your workloads on
6060
Kubernetes.
6161

0 commit comments

Comments
 (0)