3
votes

In my Jekyll layout template I am creating a meta tag for keywords from the list of tags supplied in a post as follows:

<meta name="keywords" content="{{page.tags}}"/>

The post has the following YAML front matter:

---
layout: post
tags: [personal, blog]
---

The generated meta tag is as follows:

<meta name="keywords" content="personalblog"/>

What filter must I use so that the content attribute reflects personal, blog instead of personalblog.

1

1 Answers

10
votes

I found the answer. There's a filter called join (similar to the join method on JavaScript arrays) which allows you to join the elements of a list into a string.

Thus all I needed to do was:

<meta name="keywords" content="{{page.tags | join: ', '}}"/>