Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Translate and filter not possible #181

Closed
sedrubal opened this issue Oct 11, 2020 · 6 comments
Closed

Translate and filter not possible #181

sedrubal opened this issue Oct 11, 2020 · 6 comments

Comments

@sedrubal
Copy link

For the RSS feed I need to pipe the translated string through |xml_escape. Before using jekyll-multiple-languages-plugin, I had this:

<title>{{ post.title | xml_escape }}</title>

Now I'm searching for a solution like:

<title>{% t post.title | xml_escape %}</title>

But this results in an empty string.

@shushugah
Copy link
Collaborator

would this work?

{% assign post_title = t post.title %}
<title>{% post_title | xml_escape %}</title>

@sedrubal
Copy link
Author

would this work?

{% assign post_title = t post.title %}
<title>{% post_title | xml_escape %}</title>

No this does not work, neither. It's still empty.

@shushugah
Copy link
Collaborator

My bad, it should be

{% assign post_title = t post.title %}
<title>{{ post_title | xml_escape }}</title>

and can you confirm that
{% t post.title %} is not empty in first place?

@sedrubal
Copy link
Author

This does not work neither.

I have:

<title>{%- t post.title -%}</title>

which prints the title but without xml_espace.

{% assign post_title = t post.title %}
{{ post_title }}

This does print nothing. It seems, t does not work with assign. Thus

{% assign post_title = t post.title %}
<title>{{ post_title | xml_escape }}</title>

Is empty, too.

@shushugah
Copy link
Collaborator

shushugah commented Nov 17, 2020

this for sure would work tho, and seems to be issue...with chaining liquid filters, something I admittedly don't understand very well

{% capture yolo %}{% t post.title %}{% endcapture %}
<title>{{ yolo | xml_escape }}</title>

@sedrubal
Copy link
Author

Thank you, this works for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants