0
votes

I am working on multiple websites and am trying to template as much of them as I can so that I have a single version / source of truth, that when updated, will flow through to my websites upon rebuild. I have a plugin which allows me to pull through content from an external site / source similar to the standard Liquid Include method.

Example: I would like to have the the Meta Tags in my websites pulled through from my external source but reference the website its pulled to using liquid variables.

So this would mean pulling through the below content from my external (assets website) source...

<title>{{ page.title }} | {{ site.title }}</title>
<meta name="url" content="{{ site.url }}{% if page.url <> '/' %}{{ page.url }}{% endif %}"/>

... using the a liquid include in my layout (via a plugin that allows pulls content from external sources) like so...

{% include_remote https://asset-source/meta-tags.html %}

... and ideally the liquid variables in the included source then be interpreted (reference my website's site and page data).

I really hope this makes sense, I am relatively new to Jekyll and Liquid so maybe I am asking the impossible but would really appreciate anyone's time in explaining how or why not this is possible.

1

1 Answers

0
votes

After much much much much much searching of many different phrasing of my problem... I finally happened upon this Jekyll Plugin / Gem (https://github.com/vividh/liquify) that uses a filter to parse the contents of Liquid Tag. In my example above this means using Capture to assign the external include to a variable, then call in the variable with the liquify filter that parses the included content again and process the liquid tags it contains.

Following the example I gave above I would update the remote include in my layout to:

{% capture meta-tags %}
    {% remote_include https://asset-source/meta-tags.html %}
{% endcapture %}


{{ meta-tags | liquify }}