Skip to content

Commit

Permalink
Fix cpinstall tag for kong-mesh
Browse files Browse the repository at this point in the history
There's a slight difference between Kuma and Kong Mesh in terms of the
base segment of the docs' url.
For Kuma, all the docs live under `/docs/`. Unfortunately, that's not
the case for Kong Mesh. Kong docs renders multiple products, so we
namespace the docs with the corresponding product name, i.e. they live
under `/mesh/`.

This commit updates the tag's code so that it uses the base path in which the
page is generated as the first url segment. That way we can re-use the
code in both platforms.

It also modifies the link that is rendered, so that it uses `page.release`
instead of `page.version` so that it also works for both docs sites.

Signed-off-by: Fabian Rodriguez <[email protected]>
  • Loading branch information
fabianrbz committed Nov 22, 2023
1 parent b3eeb1b commit 9d09be2
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def render(context)
content = super
return "" unless content != ""
site_data = context.registers[:site].config
page = context.environments.first['page']

opts = content.strip.split("\n").map do |x|
x = site_data['set_flag_values_prefix'] + x if @prefixed
Expand All @@ -39,7 +40,7 @@ def render(context)
```
{% endtab %}
{% tab #{@tabs_name} helm %}
Before using {{site.mesh_product_name}} with helm, please follow [these steps](/docs/{{ page.version }}/production/cp-deployment/kubernetes/#helm) to configure your local helm repo.
Before using {{site.mesh_product_name}} with helm, please follow [these steps](/#{product_url_segment(page)}/{{ page.release }}/production/cp-deployment/kubernetes/#helm) to configure your local helm repo.
```shell
helm install --create-namespace --namespace {{site.mesh_namespace}} \\
#{res} \\
Expand All @@ -49,6 +50,10 @@ def render(context)
{% endtabs %}"
::Liquid::Template.parse(htmlContent).render(context)
end

def product_url_segment(page)
page['dir'].split('/')[1]
end
end
end
end
Expand Down

0 comments on commit 9d09be2

Please sign in to comment.