Skip to content

Conversation

@robobario
Copy link
Member

I want to include a link in some video content that will not rot. This link should always contain a list of the quickstarts for the latest version of the proxy.

Screenshot From 2025-12-17 14-32-32

@robobario robobario requested a review from a team as a code owner December 17, 2025 01:33
I want to include a link in some video content that will not rot. This
link should always contain a list of the quickstarts for the latest
version of the proxy.

Signed-off-by: Robert Young <robertyoungnz@gmail.com>
Copy link
Member

@gracegrimwood gracegrimwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some tweaks and nits.

Also, I think we should add this to the navbar too. Maybe before "Documentation" but after "Download"?

Comment on lines +13 to +22
{%- assign first1 = doc.path | slice: 0, 1 -%}
{%- assign first7 = doc.path | slice: 0, 7 -%}
{%- assign first8 = doc.path | slice: 0, 8 -%}
{%- if first7 == 'http://' or first8 == 'https://' -%}
{%- assign linkTemplate = doc.path -%}
{%- elsif first1 == '/' -%}
{%- assign linkTemplate = doc.path | absolute_url -%}
{%- else -%}
{%- assign linkTemplate = "/documentation/" | append: version | append: "/" | append: doc.path | absolute_url -%}
{%- endif -%}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole section is a little confusing to follow, I think we can simplify it a little (tested this locally and it looks like it works fine).

Suggested change
{%- assign first1 = doc.path | slice: 0, 1 -%}
{%- assign first7 = doc.path | slice: 0, 7 -%}
{%- assign first8 = doc.path | slice: 0, 8 -%}
{%- if first7 == 'http://' or first8 == 'https://' -%}
{%- assign linkTemplate = doc.path -%}
{%- elsif first1 == '/' -%}
{%- assign linkTemplate = doc.path | absolute_url -%}
{%- else -%}
{%- assign linkTemplate = "/documentation/" | append: version | append: "/" | append: doc.path | absolute_url -%}
{%- endif -%}
{%- assign isFullURL = doc.path | split:'http' | first -%}
{%- assign hasSlashPrefix = doc.path | split:'/' | first -%}
{%- if isFullURL == empty -%}
{%- assign linkTemplate = doc.path -%}
{%- elsif hasSlashPrefix == empty -%}
{%- assign linkTemplate = doc.path | absolute_url -%}
{%- else -%}
{%- assign linkTemplate = "/documentation/" | append: version | append: "/" | append: doc.path | absolute_url -%}
{%- endif -%}

Unfortunately Liquid doesn't let us assign boolean values to variables from expressions, but we can get the same behaviour by splitting on the value we want to check if the string starts with, and then seeing if the first item in the resulting array (i.e. any characters that preceded the split) is an empty string. If the string just contained the value we were looking for but didn't start with it, then the first index won't be an empty string.

Could also be worth adding some comments to indicate what's going on here:

Suggested change
{%- assign first1 = doc.path | slice: 0, 1 -%}
{%- assign first7 = doc.path | slice: 0, 7 -%}
{%- assign first8 = doc.path | slice: 0, 8 -%}
{%- if first7 == 'http://' or first8 == 'https://' -%}
{%- assign linkTemplate = doc.path -%}
{%- elsif first1 == '/' -%}
{%- assign linkTemplate = doc.path | absolute_url -%}
{%- else -%}
{%- assign linkTemplate = "/documentation/" | append: version | append: "/" | append: doc.path | absolute_url -%}
{%- endif -%}
<!-- check if doc.path is full URL (i.e. starts with 'http') -->
{%- assign isFullURL = doc.path | split:'http' | first -%}
<!-- check if doc.path is a partial URI with a slash prefix (i.e. starts with a '/') -->
{%- assign hasSlashPrefix = doc.path | split:'/' | first -%}
<!-- begin conditional assign -->
{%- if isFullURL == empty -%}
<!-- is full URL -->
{%- assign linkTemplate = doc.path -%}
{%- elsif hasSlashPrefix == empty -%}
<!-- partial URI with slash prefix -->
{%- assign linkTemplate = doc.path | absolute_url -%}
{%- else -%}
<!-- is other partial URI not beginning with '/' -->
{%- assign linkTemplate = "/documentation/" | append: version | append: "/" | append: doc.path | absolute_url -%}
{%- endif -%}
<!-- end conditional assign -->

@@ -0,0 +1,3 @@
---
layout: latest-quickstarts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I see that we've still got that old _layouts/quickstart.html layout file from the old quickstarts hanging around and that's likely to cause some confusion here. The old file is only being used for the proxy and developer quickstarts for docs versions 0.13.0 and below, so maybe we could change that layout file to be called something like legacy-docs-quickstart.html and then this could just be quickstart.html.

related nit: I don't like calling it quickstarts with an 's', I think if the aim is to have a quick link then it makes a little more sense to just call it quickstart (which is actually what I thought it was at first, and got a little confused when it gave me a 404 back).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants