We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[Blog] Image Meta Tags Not Generated Properly
#### Expected Behaviour
When meta tags are created for a blog, the image tags should contain link to the image.

#### Actual Behaviour
When the image meta tags are generated, it assigns "name" to it.
eg: domain.name/image instead of domain.name/filename.png

Frappé version: 
 v11.x.x-develop (ebde145) (develop)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `frappe/website/context.py`
Content:
```
1 # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
2 # MIT License. See license.txt
3 
4 from __future__ import unicode_literals
5 import frappe, os, json
6 
7 from frappe.website.doctype.website_settings.website_settings import get_website_settings
8 from frappe.website.router import get_page_context
9 from frappe.model.document import Document
10 
11 def get_context(path, args=None):
12 	if args and args.source:
13 		context = args
14 	else:
15 		context = get_page_context(path)
16 		if args:
17 			context.update(args)
18 
19 	if hasattr(frappe.local, 'request'):
20 		# for <body data-path=""> (remove leading slash)
21 		# path could be overriden in render.resolve_from_map
22 		context["path"] = frappe.local.request.path.strip('/ ')
23 	else:
24 		context["path"] = path
25 
26 	context.route = context.path
27 
28 	context = build_context(context)
29 
30 	# set using frappe.respond_as_web_page
31 	if hasattr(frappe.local, 'response') and frappe.local.response.get('context'):
32 		context.update(frappe.local.response.context)
33 
34 	return context
35 
36 def update_controller_context(context, controller):
37 	module = frappe.get_module(controller)
38 
39 	if module:
40 		# get config fields
41 		for prop in ("base_template_path", "template", "no_cache", "no_sitemap",
42 			"condition_field"):
43 			if hasattr(module, prop):
44 				context[prop] = getattr(module, prop)
45 
46 		if hasattr(module, "get_context"):
47 			try:
48 				ret = module.get_context(context)
49 				if ret:
50 					context.update(ret)
51 			except frappe.Redirect:
52 				raise
53 			except (frappe.PermissionError, frappe.DoesNotExistError):
54 				raise
55 			except:
56 				if not frappe.flags.in_migrate:
57 					frappe.errprint(frappe.utils.get_traceback())
58 
59 		if hasattr(module, "get_children"):
60 			context.children = module.get_children(context)
61 
62 
63 def build_context(context):
64 	"""get_context method of doc or module is supposed to render
65 		content templates and push it into context"""
66 	context = frappe._dict(context)
67 
68 	if not "url_prefix" in context:
69 		context.url_prefix = ""
70 
71 	if context.url_prefix and context.url_prefix[-1]!='/':
72 		context.url_prefix += '/'
73 
74 	# for backward compatibility
75 	context.docs_base_url = '/docs'
76 
77 	context.update(get_website_settings())
78 	context.update(frappe.local.conf.get("website_context") or {})
79 
80 	# provide doc
81 	if context.doc:
82 		context.update(context.doc.as_dict())
83 		context.update(context.doc.get_website_properties())
84 
85 		if not context.template:
86 			context.template = context.doc.meta.get_web_template()
87 
88 		if hasattr(context.doc, "get_context"):
89 			ret = context.doc.get_context(context)
90 
91 			if ret:
92 				context.update(ret)
93 
94 		for prop in ("no_cache", "no_sitemap"):
95 			if not prop in context:
96 				context[prop] = getattr(context.doc, prop, False)
97 
98 	elif context.controller:
99 		# controller based context
100 		update_controller_context(context, context.controller)
101 
102 		# controller context extensions
103 		context_controller_hooks = frappe.get_hooks("extend_website_page_controller_context") or {}
104 		for controller, extension in context_controller_hooks.items():
105 			if isinstance(extension, list):
106 				for ext in extension:
107 					if controller == context.controller:
108 						update_controller_context(context, ext)
109 			else:
110 				update_controller_context(context, extension)
111 
112 	add_metatags(context)
113 	add_sidebar_and_breadcrumbs(context)
114 
115 	# determine templates to be used
116 	if not context.base_template_path:
117 		app_base = frappe.get_hooks("base_template")
118 		context.base_template_path = app_base[0] if app_base else "templates/base.html"
119 
120 	if context.title_prefix and context.title and not context.title.startswith(context.title_prefix):
121 		context.title = '{0} - {1}'.format(context.title_prefix, context.title)
122 
123 	return context
124 
125 def add_sidebar_and_breadcrumbs(context):
126 	'''Add sidebar and breadcrumbs to context'''
127 	from frappe.website.router import get_page_info_from_template
128 	if context.show_sidebar:
129 		context.no_cache = 1
130 		add_sidebar_data(context)
131 	else:
132 		if context.basepath:
133 			sidebar_json_path = os.path.join(context.basepath, '_sidebar.json')
134 			if os.path.exists(sidebar_json_path):
135 				with open(sidebar_json_path, 'r') as sidebarfile:
136 					context.sidebar_items = json.loads(sidebarfile.read())
137 					context.show_sidebar = 1
138 
139 	if context.add_breadcrumbs and not context.parents:
140 		if context.basepath:
141 			parent_path = os.path.dirname(context.path).rstrip('/')
142 			page_info = get_page_info_from_template(parent_path)
143 			if page_info:
144 				context.parents = [dict(route=parent_path, title=page_info.title)]
145 
146 def add_sidebar_data(context):
147 	from frappe.utils.user import get_fullname_and_avatar
148 	import frappe.www.list
149 
150 	if context.show_sidebar and context.website_sidebar:
151 		context.sidebar_items = frappe.get_all('Website Sidebar Item',
152 			filters=dict(parent=context.website_sidebar), fields=['title', 'route', '`group`'],
153 			order_by='idx asc')
154 
155 	if not context.sidebar_items:
156 		sidebar_items = frappe.cache().hget('portal_menu_items', frappe.session.user)
157 		if sidebar_items == None:
158 			sidebar_items = []
159 			roles = frappe.get_roles()
160 			portal_settings = frappe.get_doc('Portal Settings', 'Portal Settings')
161 
162 			def add_items(sidebar_items, items):
163 				for d in items:
164 					if d.get('enabled') and ((not d.get('role')) or d.get('role') in roles):
165 						sidebar_items.append(d.as_dict() if isinstance(d, Document) else d)
166 
167 			if not portal_settings.hide_standard_menu:
168 				add_items(sidebar_items, portal_settings.get('menu'))
169 
170 			if portal_settings.custom_menu:
171 				add_items(sidebar_items, portal_settings.get('custom_menu'))
172 
173 			items_via_hooks = frappe.get_hooks('portal_menu_items')
174 			if items_via_hooks:
175 				for i in items_via_hooks: i['enabled'] = 1
176 				add_items(sidebar_items, items_via_hooks)
177 
178 			frappe.cache().hset('portal_menu_items', frappe.session.user, sidebar_items)
179 
180 		context.sidebar_items = sidebar_items
181 
182 	info = get_fullname_and_avatar(frappe.session.user)
183 	context["fullname"] = info.fullname
184 	context["user_image"] = info.avatar
185 	context["user"] = info.name
186 
187 
188 def add_metatags(context):
189 	tags = context.get("metatags")
190 	if tags:
191 		if not "twitter:card" in tags:
192 			tags["twitter:card"] = "summary_large_image"
193 		if not "og:type" in tags:
194 			tags["og:type"] = "article"
195 		if tags.get("name"):
196 			tags["og:title"] = tags["twitter:title"] = tags["name"]
197 		if tags.get("description"):
198 			tags["og:description"] = tags["twitter:description"] = tags["description"]
199 		if tags.get("image"):
200 			tags["og:image"] = tags["twitter:image:src"] = tags["image"] = frappe.utils.get_url("image")
201         
202
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/frappe/website/context.py b/frappe/website/context.py
--- a/frappe/website/context.py
+++ b/frappe/website/context.py
@@ -197,5 +197,4 @@
 		if tags.get("description"):
 			tags["og:description"] = tags["twitter:description"] = tags["description"]
 		if tags.get("image"):
-			tags["og:image"] = tags["twitter:image:src"] = tags["image"] = frappe.utils.get_url("image")
-        
+			tags["og:image"] = tags["twitter:image:src"] = tags["image"] = frappe.utils.get_url(tags.get("image"))

{"golden_diff": "diff --git a/frappe/website/context.py b/frappe/website/context.py\n--- a/frappe/website/context.py\n+++ b/frappe/website/context.py\n@@ -197,5 +197,4 @@\n \t\tif tags.get(\"description\"):\n \t\t\ttags[\"og:description\"] = tags[\"twitter:description\"] = tags[\"description\"]\n \t\tif tags.get(\"image\"):\n-\t\t\ttags[\"og:image\"] = tags[\"twitter:image:src\"] = tags[\"image\"] = frappe.utils.get_url(\"image\")\n-        \n+\t\t\ttags[\"og:image\"] = tags[\"twitter:image:src\"] = tags[\"image\"] = frappe.utils.get_url(tags.get(\"image\"))\n", "issue": "[Blog] Image Meta Tags Not Generated Properly\n#### Expected Behaviour\r\nWhen meta tags are created for a blog, the image tags should contain link to the image.\r\n\r\n#### Actual Behaviour\r\nWhen the image meta tags are generated, it assigns \"name\" to it.\r\neg: domain.name/image instead of domain.name/filename.png\r\n\r\nFrapp\u00e9 version: \r\n v11.x.x-develop (ebde145) (develop)\r\n\n", "before_files": [{"content": "# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors\n# MIT License. See license.txt\n\nfrom __future__ import unicode_literals\nimport frappe, os, json\n\nfrom frappe.website.doctype.website_settings.website_settings import get_website_settings\nfrom frappe.website.router import get_page_context\nfrom frappe.model.document import Document\n\ndef get_context(path, args=None):\n\tif args and args.source:\n\t\tcontext = args\n\telse:\n\t\tcontext = get_page_context(path)\n\t\tif args:\n\t\t\tcontext.update(args)\n\n\tif hasattr(frappe.local, 'request'):\n\t\t# for <body data-path=\"\"> (remove leading slash)\n\t\t# path could be overriden in render.resolve_from_map\n\t\tcontext[\"path\"] = frappe.local.request.path.strip('/ ')\n\telse:\n\t\tcontext[\"path\"] = path\n\n\tcontext.route = context.path\n\n\tcontext = build_context(context)\n\n\t# set using frappe.respond_as_web_page\n\tif hasattr(frappe.local, 'response') and frappe.local.response.get('context'):\n\t\tcontext.update(frappe.local.response.context)\n\n\treturn context\n\ndef update_controller_context(context, controller):\n\tmodule = frappe.get_module(controller)\n\n\tif module:\n\t\t# get config fields\n\t\tfor prop in (\"base_template_path\", \"template\", \"no_cache\", \"no_sitemap\",\n\t\t\t\"condition_field\"):\n\t\t\tif hasattr(module, prop):\n\t\t\t\tcontext[prop] = getattr(module, prop)\n\n\t\tif hasattr(module, \"get_context\"):\n\t\t\ttry:\n\t\t\t\tret = module.get_context(context)\n\t\t\t\tif ret:\n\t\t\t\t\tcontext.update(ret)\n\t\t\texcept frappe.Redirect:\n\t\t\t\traise\n\t\t\texcept (frappe.PermissionError, frappe.DoesNotExistError):\n\t\t\t\traise\n\t\t\texcept:\n\t\t\t\tif not frappe.flags.in_migrate:\n\t\t\t\t\tfrappe.errprint(frappe.utils.get_traceback())\n\n\t\tif hasattr(module, \"get_children\"):\n\t\t\tcontext.children = module.get_children(context)\n\n\ndef build_context(context):\n\t\"\"\"get_context method of doc or module is supposed to render\n\t\tcontent templates and push it into context\"\"\"\n\tcontext = frappe._dict(context)\n\n\tif not \"url_prefix\" in context:\n\t\tcontext.url_prefix = \"\"\n\n\tif context.url_prefix and context.url_prefix[-1]!='/':\n\t\tcontext.url_prefix += '/'\n\n\t# for backward compatibility\n\tcontext.docs_base_url = '/docs'\n\n\tcontext.update(get_website_settings())\n\tcontext.update(frappe.local.conf.get(\"website_context\") or {})\n\n\t# provide doc\n\tif context.doc:\n\t\tcontext.update(context.doc.as_dict())\n\t\tcontext.update(context.doc.get_website_properties())\n\n\t\tif not context.template:\n\t\t\tcontext.template = context.doc.meta.get_web_template()\n\n\t\tif hasattr(context.doc, \"get_context\"):\n\t\t\tret = context.doc.get_context(context)\n\n\t\t\tif ret:\n\t\t\t\tcontext.update(ret)\n\n\t\tfor prop in (\"no_cache\", \"no_sitemap\"):\n\t\t\tif not prop in context:\n\t\t\t\tcontext[prop] = getattr(context.doc, prop, False)\n\n\telif context.controller:\n\t\t# controller based context\n\t\tupdate_controller_context(context, context.controller)\n\n\t\t# controller context extensions\n\t\tcontext_controller_hooks = frappe.get_hooks(\"extend_website_page_controller_context\") or {}\n\t\tfor controller, extension in context_controller_hooks.items():\n\t\t\tif isinstance(extension, list):\n\t\t\t\tfor ext in extension:\n\t\t\t\t\tif controller == context.controller:\n\t\t\t\t\t\tupdate_controller_context(context, ext)\n\t\t\telse:\n\t\t\t\tupdate_controller_context(context, extension)\n\n\tadd_metatags(context)\n\tadd_sidebar_and_breadcrumbs(context)\n\n\t# determine templates to be used\n\tif not context.base_template_path:\n\t\tapp_base = frappe.get_hooks(\"base_template\")\n\t\tcontext.base_template_path = app_base[0] if app_base else \"templates/base.html\"\n\n\tif context.title_prefix and context.title and not context.title.startswith(context.title_prefix):\n\t\tcontext.title = '{0} - {1}'.format(context.title_prefix, context.title)\n\n\treturn context\n\ndef add_sidebar_and_breadcrumbs(context):\n\t'''Add sidebar and breadcrumbs to context'''\n\tfrom frappe.website.router import get_page_info_from_template\n\tif context.show_sidebar:\n\t\tcontext.no_cache = 1\n\t\tadd_sidebar_data(context)\n\telse:\n\t\tif context.basepath:\n\t\t\tsidebar_json_path = os.path.join(context.basepath, '_sidebar.json')\n\t\t\tif os.path.exists(sidebar_json_path):\n\t\t\t\twith open(sidebar_json_path, 'r') as sidebarfile:\n\t\t\t\t\tcontext.sidebar_items = json.loads(sidebarfile.read())\n\t\t\t\t\tcontext.show_sidebar = 1\n\n\tif context.add_breadcrumbs and not context.parents:\n\t\tif context.basepath:\n\t\t\tparent_path = os.path.dirname(context.path).rstrip('/')\n\t\t\tpage_info = get_page_info_from_template(parent_path)\n\t\t\tif page_info:\n\t\t\t\tcontext.parents = [dict(route=parent_path, title=page_info.title)]\n\ndef add_sidebar_data(context):\n\tfrom frappe.utils.user import get_fullname_and_avatar\n\timport frappe.www.list\n\n\tif context.show_sidebar and context.website_sidebar:\n\t\tcontext.sidebar_items = frappe.get_all('Website Sidebar Item',\n\t\t\tfilters=dict(parent=context.website_sidebar), fields=['title', 'route', '`group`'],\n\t\t\torder_by='idx asc')\n\n\tif not context.sidebar_items:\n\t\tsidebar_items = frappe.cache().hget('portal_menu_items', frappe.session.user)\n\t\tif sidebar_items == None:\n\t\t\tsidebar_items = []\n\t\t\troles = frappe.get_roles()\n\t\t\tportal_settings = frappe.get_doc('Portal Settings', 'Portal Settings')\n\n\t\t\tdef add_items(sidebar_items, items):\n\t\t\t\tfor d in items:\n\t\t\t\t\tif d.get('enabled') and ((not d.get('role')) or d.get('role') in roles):\n\t\t\t\t\t\tsidebar_items.append(d.as_dict() if isinstance(d, Document) else d)\n\n\t\t\tif not portal_settings.hide_standard_menu:\n\t\t\t\tadd_items(sidebar_items, portal_settings.get('menu'))\n\n\t\t\tif portal_settings.custom_menu:\n\t\t\t\tadd_items(sidebar_items, portal_settings.get('custom_menu'))\n\n\t\t\titems_via_hooks = frappe.get_hooks('portal_menu_items')\n\t\t\tif items_via_hooks:\n\t\t\t\tfor i in items_via_hooks: i['enabled'] = 1\n\t\t\t\tadd_items(sidebar_items, items_via_hooks)\n\n\t\t\tfrappe.cache().hset('portal_menu_items', frappe.session.user, sidebar_items)\n\n\t\tcontext.sidebar_items = sidebar_items\n\n\tinfo = get_fullname_and_avatar(frappe.session.user)\n\tcontext[\"fullname\"] = info.fullname\n\tcontext[\"user_image\"] = info.avatar\n\tcontext[\"user\"] = info.name\n\n\ndef add_metatags(context):\n\ttags = context.get(\"metatags\")\n\tif tags:\n\t\tif not \"twitter:card\" in tags:\n\t\t\ttags[\"twitter:card\"] = \"summary_large_image\"\n\t\tif not \"og:type\" in tags:\n\t\t\ttags[\"og:type\"] = \"article\"\n\t\tif tags.get(\"name\"):\n\t\t\ttags[\"og:title\"] = tags[\"twitter:title\"] = tags[\"name\"]\n\t\tif tags.get(\"description\"):\n\t\t\ttags[\"og:description\"] = tags[\"twitter:description\"] = tags[\"description\"]\n\t\tif tags.get(\"image\"):\n\t\t\ttags[\"og:image\"] = tags[\"twitter:image:src\"] = tags[\"image\"] = frappe.utils.get_url(\"image\")\n        \n", "path": "frappe/website/context.py"}], "after_files": [{"content": "# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors\n# MIT License. See license.txt\n\nfrom __future__ import unicode_literals\nimport frappe, os, json\n\nfrom frappe.website.doctype.website_settings.website_settings import get_website_settings\nfrom frappe.website.router import get_page_context\nfrom frappe.model.document import Document\n\ndef get_context(path, args=None):\n\tif args and args.source:\n\t\tcontext = args\n\telse:\n\t\tcontext = get_page_context(path)\n\t\tif args:\n\t\t\tcontext.update(args)\n\n\tif hasattr(frappe.local, 'request'):\n\t\t# for <body data-path=\"\"> (remove leading slash)\n\t\t# path could be overriden in render.resolve_from_map\n\t\tcontext[\"path\"] = frappe.local.request.path.strip('/ ')\n\telse:\n\t\tcontext[\"path\"] = path\n\n\tcontext.route = context.path\n\n\tcontext = build_context(context)\n\n\t# set using frappe.respond_as_web_page\n\tif hasattr(frappe.local, 'response') and frappe.local.response.get('context'):\n\t\tcontext.update(frappe.local.response.context)\n\n\treturn context\n\ndef update_controller_context(context, controller):\n\tmodule = frappe.get_module(controller)\n\n\tif module:\n\t\t# get config fields\n\t\tfor prop in (\"base_template_path\", \"template\", \"no_cache\", \"no_sitemap\",\n\t\t\t\"condition_field\"):\n\t\t\tif hasattr(module, prop):\n\t\t\t\tcontext[prop] = getattr(module, prop)\n\n\t\tif hasattr(module, \"get_context\"):\n\t\t\ttry:\n\t\t\t\tret = module.get_context(context)\n\t\t\t\tif ret:\n\t\t\t\t\tcontext.update(ret)\n\t\t\texcept frappe.Redirect:\n\t\t\t\traise\n\t\t\texcept (frappe.PermissionError, frappe.DoesNotExistError):\n\t\t\t\traise\n\t\t\texcept:\n\t\t\t\tif not frappe.flags.in_migrate:\n\t\t\t\t\tfrappe.errprint(frappe.utils.get_traceback())\n\n\t\tif hasattr(module, \"get_children\"):\n\t\t\tcontext.children = module.get_children(context)\n\n\ndef build_context(context):\n\t\"\"\"get_context method of doc or module is supposed to render\n\t\tcontent templates and push it into context\"\"\"\n\tcontext = frappe._dict(context)\n\n\tif not \"url_prefix\" in context:\n\t\tcontext.url_prefix = \"\"\n\n\tif context.url_prefix and context.url_prefix[-1]!='/':\n\t\tcontext.url_prefix += '/'\n\n\t# for backward compatibility\n\tcontext.docs_base_url = '/docs'\n\n\tcontext.update(get_website_settings())\n\tcontext.update(frappe.local.conf.get(\"website_context\") or {})\n\n\t# provide doc\n\tif context.doc:\n\t\tcontext.update(context.doc.as_dict())\n\t\tcontext.update(context.doc.get_website_properties())\n\n\t\tif not context.template:\n\t\t\tcontext.template = context.doc.meta.get_web_template()\n\n\t\tif hasattr(context.doc, \"get_context\"):\n\t\t\tret = context.doc.get_context(context)\n\n\t\t\tif ret:\n\t\t\t\tcontext.update(ret)\n\n\t\tfor prop in (\"no_cache\", \"no_sitemap\"):\n\t\t\tif not prop in context:\n\t\t\t\tcontext[prop] = getattr(context.doc, prop, False)\n\n\telif context.controller:\n\t\t# controller based context\n\t\tupdate_controller_context(context, context.controller)\n\n\t\t# controller context extensions\n\t\tcontext_controller_hooks = frappe.get_hooks(\"extend_website_page_controller_context\") or {}\n\t\tfor controller, extension in context_controller_hooks.items():\n\t\t\tif isinstance(extension, list):\n\t\t\t\tfor ext in extension:\n\t\t\t\t\tif controller == context.controller:\n\t\t\t\t\t\tupdate_controller_context(context, ext)\n\t\t\telse:\n\t\t\t\tupdate_controller_context(context, extension)\n\n\tadd_metatags(context)\n\tadd_sidebar_and_breadcrumbs(context)\n\n\t# determine templates to be used\n\tif not context.base_template_path:\n\t\tapp_base = frappe.get_hooks(\"base_template\")\n\t\tcontext.base_template_path = app_base[0] if app_base else \"templates/base.html\"\n\n\tif context.title_prefix and context.title and not context.title.startswith(context.title_prefix):\n\t\tcontext.title = '{0} - {1}'.format(context.title_prefix, context.title)\n\n\treturn context\n\ndef add_sidebar_and_breadcrumbs(context):\n\t'''Add sidebar and breadcrumbs to context'''\n\tfrom frappe.website.router import get_page_info_from_template\n\tif context.show_sidebar:\n\t\tcontext.no_cache = 1\n\t\tadd_sidebar_data(context)\n\telse:\n\t\tif context.basepath:\n\t\t\tsidebar_json_path = os.path.join(context.basepath, '_sidebar.json')\n\t\t\tif os.path.exists(sidebar_json_path):\n\t\t\t\twith open(sidebar_json_path, 'r') as sidebarfile:\n\t\t\t\t\tcontext.sidebar_items = json.loads(sidebarfile.read())\n\t\t\t\t\tcontext.show_sidebar = 1\n\n\tif context.add_breadcrumbs and not context.parents:\n\t\tif context.basepath:\n\t\t\tparent_path = os.path.dirname(context.path).rstrip('/')\n\t\t\tpage_info = get_page_info_from_template(parent_path)\n\t\t\tif page_info:\n\t\t\t\tcontext.parents = [dict(route=parent_path, title=page_info.title)]\n\ndef add_sidebar_data(context):\n\tfrom frappe.utils.user import get_fullname_and_avatar\n\timport frappe.www.list\n\n\tif context.show_sidebar and context.website_sidebar:\n\t\tcontext.sidebar_items = frappe.get_all('Website Sidebar Item',\n\t\t\tfilters=dict(parent=context.website_sidebar), fields=['title', 'route', '`group`'],\n\t\t\torder_by='idx asc')\n\n\tif not context.sidebar_items:\n\t\tsidebar_items = frappe.cache().hget('portal_menu_items', frappe.session.user)\n\t\tif sidebar_items == None:\n\t\t\tsidebar_items = []\n\t\t\troles = frappe.get_roles()\n\t\t\tportal_settings = frappe.get_doc('Portal Settings', 'Portal Settings')\n\n\t\t\tdef add_items(sidebar_items, items):\n\t\t\t\tfor d in items:\n\t\t\t\t\tif d.get('enabled') and ((not d.get('role')) or d.get('role') in roles):\n\t\t\t\t\t\tsidebar_items.append(d.as_dict() if isinstance(d, Document) else d)\n\n\t\t\tif not portal_settings.hide_standard_menu:\n\t\t\t\tadd_items(sidebar_items, portal_settings.get('menu'))\n\n\t\t\tif portal_settings.custom_menu:\n\t\t\t\tadd_items(sidebar_items, portal_settings.get('custom_menu'))\n\n\t\t\titems_via_hooks = frappe.get_hooks('portal_menu_items')\n\t\t\tif items_via_hooks:\n\t\t\t\tfor i in items_via_hooks: i['enabled'] = 1\n\t\t\t\tadd_items(sidebar_items, items_via_hooks)\n\n\t\t\tfrappe.cache().hset('portal_menu_items', frappe.session.user, sidebar_items)\n\n\t\tcontext.sidebar_items = sidebar_items\n\n\tinfo = get_fullname_and_avatar(frappe.session.user)\n\tcontext[\"fullname\"] = info.fullname\n\tcontext[\"user_image\"] = info.avatar\n\tcontext[\"user\"] = info.name\n\n\ndef add_metatags(context):\n\ttags = context.get(\"metatags\")\n\tif tags:\n\t\tif not \"twitter:card\" in tags:\n\t\t\ttags[\"twitter:card\"] = \"summary_large_image\"\n\t\tif not \"og:type\" in tags:\n\t\t\ttags[\"og:type\"] = \"article\"\n\t\tif tags.get(\"name\"):\n\t\t\ttags[\"og:title\"] = tags[\"twitter:title\"] = tags[\"name\"]\n\t\tif tags.get(\"description\"):\n\t\t\ttags[\"og:description\"] = tags[\"twitter:description\"] = tags[\"description\"]\n\t\tif tags.get(\"image\"):\n\t\t\ttags[\"og:image\"] = tags[\"twitter:image:src\"] = tags[\"image\"] = frappe.utils.get_url(tags.get(\"image\"))\n", "path": "frappe/website/context.py"}]}