From d69b57e0aedc3162bcaa0d919a33952c5e6526bf Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 7 Nov 2021 11:32:08 +0000 Subject: [PATCH] opengraph metadata on html profile --- webapp_post.py | 6 +++--- webapp_utils.py | 30 ++++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/webapp_post.py b/webapp_post.py index c9a3e8e95..c778aeda5 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -119,7 +119,7 @@ def _htmlPostMetadataOpenGraph(domain: str, postJsonObject: {}) -> str: "\" name=\"og:description\">\n" return metadata - # metadata for attachment + # metadata for attachment for attachJson in objJson['attachment']: if not isinstance(attachJson, dict): continue @@ -153,11 +153,11 @@ def _htmlPostMetadataOpenGraph(domain: str, postJsonObject: {}) -> str: "\" property=\"og:image:type\" />\n" if attachJson.get('width'): metadata += \ - " \n" if attachJson.get('height'): metadata += \ - " \n" metadata += \ " \n' + \ ' {\n' + \ @@ -657,6 +659,30 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str, ' "url": "' + actorJson['id'] + '"\n' + \ ' }\n' + \ ' \n' + + description = removeHtml(description) + ogMetadata = \ + " \n" + \ + " \n" + \ + " " + \ + " " + \ + " " + \ + " " + \ + " " + \ + " \n" + \ + " " + \ + " " + \ + " " + + htmlStr = \ + htmlHeaderWithExternalStyle(cssFilename, instanceTitle, + ogMetadata, lang) htmlStr = htmlStr.replace('\n', '\n' + personMarkup) return htmlStr