diff --git a/_includes/head.html b/_includes/head.html index 4ca9a17eb9..e684d4f8b7 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -14,6 +14,16 @@ {%- assign c = b | split: '>' | last -%} {%- assign page_title = c | strip_html | strip | truncatewords: 10 -%} {%- endif -%} +{%- if page.description == nil and page.datafile != nil and page.datafile != '' -%} + {%- assign yaml_data = site.data[page.datafolder][page.datafile] -%} + {%- if yaml_data.long and yaml_data.long != '' -%} + {%- assign page_description = page.title | append: ': ' | append: yaml_data.long | strip_html | strip | truncatewords: 30 -%} + {%- elsif yaml_data.short and yaml_data.short != '' -%} + {%- assign page_description = page.title | append: ': ' | append: yaml_data.short | strip_html | strip | truncatewords: 30 -%} + {%- else -%} + {%- assign page_description = content | strip_html | strip | truncatewords: 30 -%} + {%- endif -%} +{%- endif -%}