Closed toobulkeh closed 8 years ago
I ended up with this code in my layouts (HAML):
- set_meta_tags keywords: "#{meta_tags[:keywords] + ", " if meta_tags[:keywords]}#{t('keywords').join(", ")}"
= display_meta_tags
with this (the list of keywords on every page) in my en.yml
:
en:
keywords:
- word1
- word2
- word3
If anyone else has a cleaner way to do this (or if this is supported by this gem) please let me know!
You may shorten it to something like
- set_meta_tags keywords: ((meta_tags[:keywords] || []) + t('keywords')).join(', ')
= display_meta_tags
And you may close the issue, since I think is an acceptable way of merging keywords :)
Is there a preferred way to merge meta tags?
For example we have a list of 20+ keywords we want included on every page, but each page also has a few specific ones added to it (dynamic, based on the content).
Thanks!