Reputation: 789
i'm trying to use the following code to generate my meta description tag
<meta name="description" content="{{ page.content | strip_html | truncatewords: 50 }}">
but this is what's displayed
##Sending Several Documents to a Group## Using online storage accounts like [Dropbox](http://dropbox.com)
is there a way to also strip markdown tags?
Upvotes: 1
Views: 1567
Reputation: 52799
You can do a :
<meta name="description"
content="{{ page.content | markdownify | strip_html | truncatewords: 50 }}">
But it will only works with md/markdown
files, not html. And this will not render Liquid tags
.
The solution can be to set a description: foo bar
in the page/post front matter and get it in _includes/head.html
with a :
{% if page.description %}
<meta name="description" content="{{ page.description }}">
{% else %}
<meta name="description" content="{{ site.description }}">
{% endif %}
Upvotes: 10