Skip to content

Commit

Permalink
Merge pull request #1 from thevahidal/improve-meta-tags
Browse files Browse the repository at this point in the history
Improve meta tags for social link preview
  • Loading branch information
thevahidal authored Jan 11, 2024
2 parents e69e350 + cd384b2 commit 728ac5f
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions script.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,26 @@
for section in data["sections"]
)

meta_tags = frag(
h("title")(data.get("name")),
h("meta", name="description", content=data.get("description")),
h("meta", name="keywords", content=data.get("keywords")),
h("meta", name="viewport", content="width=device-width, initial-scale=1"),
h("meta", charset="utf-8"),
# OG
h("meta", name="og:title", content=data.get("name")),
h("meta", name="og:description", content=data.get("description")),
h("meta", name="og:image", content=f"img/{data.get('image')}"),
# Twitter / X
h("meta", name="twitter:title", content=data.get("name")),
h("meta", name="twitter:description", content=data.get("description")),
h("meta", name="twitter:image", content=f"img/{data.get('image')}"),
h("meta", name="twitter:card", content="summary_large_image"),
)

head = frag(
h("head")(
h("title")(data.get("name")),
h("meta", name="description", content=data.get("description")),
h("meta", name="keywords", content=data.get("keywords")),
h("meta", name="viewport", content="width=device-width, initial-scale=1"),
h("meta", charset="utf-8"),
meta_tags,
h("link", rel="stylesheet", href="css/pico.min.css"),
h("link", rel="stylesheet", href="css/style.css"),
h("style", rel="stylesheet")(
Expand Down

0 comments on commit 728ac5f

Please sign in to comment.