Elkazi
Elkazi

Reputation: 177

How to use Liquid to filter on text

I have a metafile that contains text like:

[Title] 
body text

I want to use filter to show only text between the brackets as title and the same metefied for body text only, please help~

{{ details | filters }}

Upvotes: 1

Views: 321

Answers (1)

Elkazi
Elkazi

Reputation: 177

I find this solution but I don't know if it's the best one

To show only text between brackets []

{{ details_01 | remove: '['| split: "]" | slice: 0, 1 }}

To show the body text.

{{ details_01 | remove: '['| split: "]" | slice: 1, 1 }}

Upvotes: 1

Related Questions