Browse Source

Strip HTML tags and escape special characters in <meta>. Fixes frappe/erpnext_com#53

version-14
Anand Doshi 10 years ago
parent
commit
89e95cd6b1
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      frappe/templates/includes/meta_block.html
  2. +1
    -1
      frappe/website/doctype/web_page/web_page.py

+ 1
- 1
frappe/templates/includes/meta_block.html View File

@@ -1,5 +1,5 @@
{%- if metatags -%}
{%- for name in metatags %}
<meta name="{{ name }}" content="{{ metatags[name]|striptags }}" data-html-block="meta_block">
<meta name="{{ name }}" content="{{ metatags[name]|striptags|escape }}" data-html-block="meta_block">
{%- endfor -%}
{%- endif -%}

+ 1
- 1
frappe/website/doctype/web_page/web_page.py View File

@@ -146,7 +146,7 @@ class WebPage(WebsiteGenerator):
def set_metatags(self, context):
context.metatags = {
"name": context.title,
"description": context.description or strip_html((context.main_section or "").replace("\n", " "))[:500]
"description": (context.description or context.main_section or "").replace("\n", " ")[:500]
}

image = find_first_image(context.main_section or "")


Loading…
Cancel
Save