Skip to content

Commit 7c45ed3

Browse files
kenyonjCopilot
andcommitted
Split aliases/related on comma and strip whitespace
Make the Liquid template tolerant of both 'a, b' and 'a,b' formats by splitting on bare comma and stripping whitespace from each element. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0e58cb5 commit 7c45ed3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

feed.json.liquid

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ permalink: feed.json
3232
],
3333
"topics": [
3434
{% for topic in topics %}
35-
{% assign related = topic.related | split: ', ' %}
36-
{% assign aliases = topic.aliases | split: ', ' %}
35+
{% assign related = topic.related | split: ',' %}
36+
{% assign aliases = topic.aliases | split: ',' %}
3737
{
3838
"topic_name": {{ topic.topic | jsonify }},
3939
"created_by": {{ topic.created_by | jsonify }},
@@ -50,12 +50,12 @@ permalink: feed.json
5050
"wikipedia_url": {{ topic.wikipedia_url | jsonify }},
5151
"related": [
5252
{% for related_topic in related %}
53-
"{{ related_topic }}"{% unless forloop.last == true %},{% endunless %}
53+
"{{ related_topic | strip }}"{% unless forloop.last == true %},{% endunless %}
5454
{% endfor %}
5555
],
5656
"aliases": [
5757
{% for alias in aliases %}
58-
"{{ alias }}"{% unless forloop.last == true %},{% endunless %}
58+
"{{ alias | strip }}"{% unless forloop.last == true %},{% endunless %}
5959
{% endfor %}
6060
],
6161
"content": {{ topic.content | jsonify }}

0 commit comments

Comments
 (0)