{escape(head.title)}
{escape(head.meta["description"])}
- Social title
- {escape(head.meta["og:title"])}
- Canonical
- {escape(head.canonical)}
# Create an OG and SEO review page from actual built metadata.
from html.parser import HTMLParser
from html import escape
from pathlib import Path
from urllib.parse import urlsplit
import json
import sys
root = Path(sys.argv[1] if len(sys.argv) > 1 else '.vercel/output/static')
class Head(HTMLParser):
def __init__(self):
super().__init__(); self.meta = {}; self.title = ''; self.in_title = False; self.canonical = ''; self.images = []
def handle_starttag(self, tag, attrs):
attrs = dict(attrs)
if tag == 'title': self.in_title = True
if tag == 'meta': self.meta[attrs.get('property', attrs.get('name', ''))] = attrs.get('content', '')
if tag == 'link' and attrs.get('rel') == 'canonical': self.canonical = attrs.get('href', '')
if tag == 'img' and attrs.get('src'): self.images.append(attrs['src'])
def handle_endtag(self, tag):
if tag == 'title': self.in_title = False
def handle_data(self, data):
if self.in_title: self.title += data
rows = []
home = None
for file in sorted(root.rglob('index.html')):
head = Head(); head.feed(file.read_text())
route = urlsplit(head.canonical).path
if route == '/': home = head
rows.append(f' {escape(head.meta["description"])}{escape(head.title)}
PulseCanvas Studio · Production review
Review the new social image and metadata for all 11 pages. The new OG image, metadata, and SEO fixes are now deployed to production.
''' html += f'{escape(home.meta["og:description"])}
Illustrative social preview. Platforms may crop images and shorten text.
{escape(home.meta["description"])}
Illustrative search snippet. Search engines choose the final title and description.
The app has no published ratings or reviews, so it currently lacks the rating/review required for Google's software-app rich result. No ratings were invented. Passing technical checks does not guarantee indexing or rankings.