diff --git a/webapp_profile.py b/webapp_profile.py index e02201a46..25a92cfc1 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -45,6 +45,7 @@ from webapp_utils import htmlHideFromScreenReader from webapp_utils import scheduledPostsExist from webapp_utils import getPersonAvatarUrl from webapp_utils import htmlHeaderWithExternalStyle +from webapp_utils import htmlHeaderWithPersonMarkup from webapp_utils import htmlFooter from webapp_utils import addEmojiToDisplayName from webapp_utils import getBannerFile @@ -888,7 +889,7 @@ def htmlProfile(rssIconAtTop: bool, instanceTitle = \ getConfigParam(baseDir, 'instanceTitle') profileStr = \ - htmlHeaderWithExternalStyle(cssFilename, instanceTitle) + \ + htmlHeaderWithPersonMarkup(cssFilename, instanceTitle, profileJson) + \ profileStr + htmlFooter() return profileStr diff --git a/webapp_utils.py b/webapp_utils.py index 6a9666a77..f6c6c6e7e 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -710,6 +710,45 @@ def htmlHeaderWithExternalStyle(cssFilename: str, instanceTitle: str, return htmlStr +def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str, + actorJson: {}, lang='en') -> str: + """html header which includes person markup + https://schema.org/Person + """ + htmlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, lang) + if not actorJson: + return htmlStr + + skillsMarkup = '' + if actorJson.get('skills'): + skillsStr = '' + for skillName, skillValue in actorJson['skills'].items(): + if skillsStr: + skillsStr += ', ' + skillName + else: + skillsStr += skillName + if skillsStr: + skillsMarkup = \ + ' "hasOccupation": {\n' + \ + ' "skills": "' + skillsStr + '"\n' + \ + ' "},\n' + + personMarkup = \ + ' \n' + htmlStr = htmlStr.replace('\n', '\n' + personMarkup) + return htmlStr + + def htmlFooter() -> str: htmlStr = ' \n' htmlStr += '\n'