regex - Remove hyphens and replace with spaces and capitalize in liquid -
Using the liquid, I am using the product tag to use the page title. I want to keep page headings free from hyphens and keep each word in the capital.
Example:
If the tag (used to generate title) is "potato-chips" I want the title of "potato chips".
If I use it:
{{current_tags.first}} One of the "potato chips" Prepares the title.
If I use it:
{{current_tags.first | It produces a title of "potato chips". If I
{{Current_tags.first | Replace: '-', '' | Capitalization}} We get the title of "potato chips".
If someone knows how I can get the title of "potato chips," it would be good.
If this is the case, some tags (used to generate title) are "words"; There are some "word-words"; There are some "word-word" words; And so on
Thank you.
You loop on each word "capital" on the tag:
{% assign word = current_tag.first | Split: '-'%} {% word in word%} {{word | Capitalization}} {% endfor%}
Comments
Post a Comment