mirror of https://gitlab.com/bashrc2/epicyon
opengraph metadata on html profile
parent
996a9f2c6b
commit
d69b57e0ae
|
@ -153,11 +153,11 @@ def _htmlPostMetadataOpenGraph(domain: str, postJsonObject: {}) -> str:
|
||||||
"\" property=\"og:image:type\" />\n"
|
"\" property=\"og:image:type\" />\n"
|
||||||
if attachJson.get('width'):
|
if attachJson.get('width'):
|
||||||
metadata += \
|
metadata += \
|
||||||
" <meta content=\"" + attachJson['width'] + \
|
" <meta content=\"" + str(attachJson['width']) + \
|
||||||
"\" property=\"og:image:width\" />\n"
|
"\" property=\"og:image:width\" />\n"
|
||||||
if attachJson.get('height'):
|
if attachJson.get('height'):
|
||||||
metadata += \
|
metadata += \
|
||||||
" <meta content=\"" + attachJson['height'] + \
|
" <meta content=\"" + str(attachJson['height']) + \
|
||||||
"\" property=\"og:image:height\" />\n"
|
"\" property=\"og:image:height\" />\n"
|
||||||
metadata += \
|
metadata += \
|
||||||
" <meta content=\"" + attachJson['name'] + \
|
" <meta content=\"" + attachJson['name'] + \
|
||||||
|
|
|
@ -549,9 +549,9 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str,
|
||||||
"""html header which includes person markup
|
"""html header which includes person markup
|
||||||
https://schema.org/Person
|
https://schema.org/Person
|
||||||
"""
|
"""
|
||||||
htmlStr = \
|
|
||||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None, lang)
|
|
||||||
if not actorJson:
|
if not actorJson:
|
||||||
|
htmlStr = \
|
||||||
|
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None, lang)
|
||||||
return htmlStr
|
return htmlStr
|
||||||
|
|
||||||
cityMarkup = ''
|
cityMarkup = ''
|
||||||
|
@ -645,6 +645,8 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str,
|
||||||
|
|
||||||
description = removeHtml(actorJson['summary'])
|
description = removeHtml(actorJson['summary'])
|
||||||
nameStr = removeHtml(actorJson['name'])
|
nameStr = removeHtml(actorJson['name'])
|
||||||
|
domainFull = actorJson['id'].split('://')[1].split('/')[0]
|
||||||
|
handle = actorJson['preferredUsername'] + '@' + domainFull
|
||||||
personMarkup = \
|
personMarkup = \
|
||||||
' <script type="application/ld+json">\n' + \
|
' <script type="application/ld+json">\n' + \
|
||||||
' {\n' + \
|
' {\n' + \
|
||||||
|
@ -657,6 +659,30 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str,
|
||||||
' "url": "' + actorJson['id'] + '"\n' + \
|
' "url": "' + actorJson['id'] + '"\n' + \
|
||||||
' }\n' + \
|
' }\n' + \
|
||||||
' </script>\n'
|
' </script>\n'
|
||||||
|
|
||||||
|
description = removeHtml(description)
|
||||||
|
ogMetadata = \
|
||||||
|
" <meta content=\"profile\" property=\"og:type\" />\n" + \
|
||||||
|
" <meta content=\"" + description + \
|
||||||
|
"\" name='description'>\n" + \
|
||||||
|
" <meta content=\"" + actorJson['url'] + \
|
||||||
|
"\" property=\"og:url\" />" + \
|
||||||
|
" <meta content=\"" + domainFull + \
|
||||||
|
"\" property=\"og:site_name\" />" + \
|
||||||
|
" <meta content=\"" + nameStr + " (@" + handle + \
|
||||||
|
")\" property=\"og:title\" />" + \
|
||||||
|
" <meta content=\"" + description + \
|
||||||
|
"\" property=\"og:description\" />" + \
|
||||||
|
" <meta content=\"" + actorJson['icon']['url'] + \
|
||||||
|
"\" property=\"og:image\" />" + \
|
||||||
|
" <meta content=\"400\" property=\"og:image:width\" />\n" + \
|
||||||
|
" <meta content=\"400\" property=\"og:image:height\" />" + \
|
||||||
|
" <meta content=\"summary\" property=\"twitter:card\" />" + \
|
||||||
|
" <meta content=\"" + handle + "\" property=\"profile:username\" />"
|
||||||
|
|
||||||
|
htmlStr = \
|
||||||
|
htmlHeaderWithExternalStyle(cssFilename, instanceTitle,
|
||||||
|
ogMetadata, lang)
|
||||||
htmlStr = htmlStr.replace('<head>\n', '<head>\n' + personMarkup)
|
htmlStr = htmlStr.replace('<head>\n', '<head>\n' + personMarkup)
|
||||||
return htmlStr
|
return htmlStr
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue