test grid & farm page link and img fixes on gh pages

This commit is contained in:
timurgordon
2022-07-29 13:21:39 +02:00
parent 1a7402e2dc
commit 780f54a3cd
2 changed files with 26 additions and 9 deletions

View File

@@ -9,17 +9,34 @@ Parameters:
- bgPath: if bgPath is passed, the row has a full width background
-->
<!-- This fixes link paths in prod -->
{% if page %}
{% if "![" in body %}
{% set url_prefix = "](" ~ page.permalink %}
{% set test = get_url(path="/farm")%}
{% set body = body | replace(from="](", to=url_prefix) %}
{% set body = body | replace(from=url_prefix ~ "http", to="](http") %}
{{test}}
{% if "](" in body %}
{% set body_arr = body | split(pat="](") %}
{% set body = body_arr[0] %}
{% for i in body_arr %}
{% set prev_index = loop.index0 - 1 %}
{% if not loop.first %}
{% if "![" in body_arr[prev_index] %}
{% set_global body = body ~ '](' ~ page.permalink ~ i %}
{% else %}
{% if i is not starting_with("http") %}
{% set base_url = get_url(path="") %}
{% set_global body = body ~ '](' ~ base_url ~ i %}
{% else %}
{% set_global body = body ~ '](' ~ i %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
<!-- This fixes image paths in local -->
{% set columns = body | safe | markdown | split(pat="|||") %}
{% set row_class = "relative pt-6 p-4 flex flex-col sm:grid sm:grid-cols-2 sm:gap-10 xl:flex xl:flex-row"%}
@@ -110,7 +127,7 @@ Parameters:
{% set mermaid_content = mermaid_section[1] | striptags | replace(from="", to="--")%}
<div class="mermaid">
{{mermaid_content | safe }}
</div>
</div>
{% else %}
{{ column | safe }}
{% endif %}