An ATproto social media client -- with an independent Appview.

Merge pull request #8924 from internet-development/elijaharita/google-structured-data

feat: google structured data for profiles and posts

authored by

jim and committed by
GitHub
6114b33c 66526a8e

+70
+35
bskyweb/templates/post.html
··· 56 56 <meta property="article:published_time" content="{{ postView.IndexedAt }}"> 57 57 <link rel="alternate" type="application/json+oembed" href="https://embed.bsky.app/oembed?format=json&url={{ postView.Uri | urlencode }}" /> 58 58 <link rel="alternate" href="{{ postView.Uri }}" /> 59 + <script type="application/ld+json"> 60 + { 61 + "@context": "https://schema.org", 62 + "@type": "DiscussionForumPosting", 63 + "author": { 64 + "@type": "Person", 65 + "name": "{{ postView.Author.DisplayName }}", 66 + "url": "https://bsky.app/profile/{{ postView.Author.Handle }}" 67 + }, 68 + {%- if postText %} 69 + "text": "{{ postText }}", 70 + {% endif %} 71 + {%- if imageThumbUrls %} 72 + "image": "{{ imageThumbUrls[0] }}", 73 + {% endif %} 74 + "datePublished": "{{ postView.IndexedAt }}", 75 + "interactionStatistic": [ 76 + { 77 + "@type": "InteractionCounter", 78 + "interactionType": "https://schema.org/LikeAction", 79 + "userInteractionCount": {{ postView.LikeCount }} 80 + }, 81 + { 82 + "@type": "InteractionCounter", 83 + "interactionType": "https://schema.org/CommentAction", 84 + "userInteractionCount": {{ postView.ReplyCount }} 85 + }, 86 + { 87 + "@type": "InteractionCounter", 88 + "interactionType": "https://schema.org/ShareAction", 89 + "userInteractionCount": {{ postView.RepostCount + postView.QuoteCount }} 90 + } 91 + ] 92 + } 93 + </script> 59 94 {%- elif requiresAuth and profileHandle -%} 60 95 <meta property="og:type" content="article"> 61 96 <meta property="profile:username" content="{{ profileHandle }}">
+35
bskyweb/templates/profile.html
··· 51 51 <meta property="og:description" content="This profile requires authentication to view."> 52 52 <meta property="twitter:description" content="This profile requires authentication to view."> 53 53 {% endif %} 54 + 55 + <script type="application/ld+json"> 56 + { 57 + "@context": "https://schema.org", 58 + "@type": "ProfilePage", 59 + "dateCreated": "{{ profileView.CreatedAt }}", 60 + "mainEntity": { 61 + "@type": "Person", 62 + "name": "{{ profileView.DisplayName }}", 63 + "alternateName": "@{{ profileView.Handle }}", 64 + "identifier": "{{ profileView.Did }}", 65 + "description": "{{ profileView.Description }}", 66 + "image": "{{ profileView.Avatar }}", 67 + "interactionStatistic": [ 68 + { 69 + "@type": "InteractionCounter", 70 + "interactionType": "https://schema.org/FollowAction", 71 + "userInteractionCount": {{ profileView.FollowersCount }} 72 + } 73 + ], 74 + "agentInteractionStatistic": [ 75 + { 76 + "@type": "InteractionCounter", 77 + "interactionType": "https://schema.org/FollowAction", 78 + "userInteractionCount": {{ profileView.FollowsCount }} 79 + }, 80 + { 81 + "@type": "InteractionCounter", 82 + "interactionType": "https://schema.org/WriteAction", 83 + "userInteractionCount": {{ profileView.PostsCount }} 84 + } 85 + ] 86 + } 87 + } 88 + </script> 54 89 {% endif -%} 55 90 {%- endblock %} 56 91