Skip to content

Commit 31a100b

Browse files
committed
Use absolute urls for released-documentation links
* links that are already absolute are not modified * links starting with '/' are converted to absolute * other links are assumed to be relative to the per-release data, we construct and absolute link for them. Signed-off-by: Robert Young <[email protected]>
1 parent 140983e commit 31a100b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

_layouts/released-documentation.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,17 @@ <h1 id="page-title" class="fs-3">{{ version }} Documentation</h1>
4141
{%- assign first1 = doc.path | slice: 0, 1 -%}
4242
{%- assign first7 = doc.path | slice: 0, 7 -%}
4343
{%- assign first8 = doc.path | slice: 0, 8 -%}
44-
{%- if first7 == 'http://' or first8 == 'https://' or first1 == '/' -%}
45-
{%- assign pathPrefix = "" -%}
44+
{%- if first7 == 'http://' or first8 == 'https://' -%}
45+
{%- assign linkTemplate = doc.path -%}
46+
{%- elsif first1 == '/' -%}
47+
{%- assign linkTemplate = doc.path | absolute_url -%}
4648
{%- else -%}
47-
{%- assign pathPrefix = "/documentation/" | append: version | append: "/" -%}
49+
{%- assign linkTemplate = "/documentation/" | append: version | append: "/" | append: doc.path | absolute_url -%}
4850
{%- endif -%}
4951
<div class="col">
5052
<div class="card shadow mb-2 h-100 mx-2 {%- for tag in doc.tags %} doctag-{{tag}}{%- endfor -%}">
5153
<div class="card-header">
52-
<h2 class="card-title fs-4"><a href='{{ pathPrefix }}{{ doc.path | replace: "$(VERSION)", version}}'>{{ doc.title }}</a></h2>
54+
<h2 class="card-title fs-4"><a href='{{ linkTemplate | replace: "$(VERSION)", version}}'>{{ doc.title }}</a></h2>
5355
</div>
5456
<div class="card-body mx-3 my-2">
5557
{{ doc.description }}

0 commit comments

Comments
 (0)