Merge pull request #16876 from netchampfaris/fix-metatags-description
fix: description metatag
This commit is contained in:
commit
ef971017c5
4 changed files with 19 additions and 1 deletions
|
|
@ -312,6 +312,11 @@ class TestWebsite(unittest.TestCase):
|
|||
self.assertIn("test.__test", content)
|
||||
self.assertNotIn("frappe.exceptions.ValidationError: Illegal template", content)
|
||||
|
||||
def test_metatags(self):
|
||||
content = get_response_content("/_test/_test_metatags")
|
||||
self.assertIn('<meta name="title" content="Test Title Metatag">', content)
|
||||
self.assertIn('<meta name="description" content="Test Description for Metatag">', content)
|
||||
|
||||
|
||||
def set_home_page_hook(key, value):
|
||||
from frappe import hooks
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class MetaTags:
|
|||
|
||||
def init_metatags_from_context(self):
|
||||
for key in METATAGS:
|
||||
if key not in self.tags and self.context.get(key):
|
||||
if not self.tags.get(key) and self.context.get(key):
|
||||
self.tags[key] = self.context[key]
|
||||
|
||||
if not self.tags.get("title"):
|
||||
|
|
|
|||
5
frappe/www/_test/_test_metatags.html
Normal file
5
frappe/www/_test/_test_metatags.html
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
base_template: frappe/templates/web.html
|
||||
---
|
||||
|
||||
<h1>Test Metatags</h1>
|
||||
8
frappe/www/_test/_test_metatags.py
Normal file
8
frappe/www/_test/_test_metatags.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# MIT License. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
def get_context():
|
||||
return {"title": "Test Title Metatag", "description": "Test Description for Metatag"}
|
||||
Loading…
Add table
Reference in a new issue