Skip to content

Add Open Graph / Twitter social preview card - #2768

Merged
commjoen merged 8 commits into
OWASP:masterfrom
astra-intelligence:add-og-social-preview
Oct 19, 2026
Merged

commjoen merged 8 commits into
OWASP:masterfrom
astra-intelligence:add-og-social-preview

Conversation

@astra-intelligence

Copy link
Copy Markdown
Contributor

What

Adds a branded 1200×630 social preview card to WrongSecrets so links shared on X/Twitter, LinkedIn, Discord, Slack, and WhatsApp render a proper image card instead of a bare link.

  • src/main/resources/static/img/og-image.png — 1200×630 card reproducing the project's isometric-safe-with-gold-bars logo motif (dark navy gradient, brand blues #5d7b93/#3e5f7a/#7a9bb5, gold #f1c40f), with the "OWASP WrongSecrets" wordmark and tagline. 55 KB, well under the 1 MB crawler limit. Reproducible via the committed generator script.
  • src/main/resources/templates/index.html — adds og:type/site_name/title/description/url/image(+w/h/alt) and twitter:card=summary_large_image/title/description/image plus a meta name="description" to the base layout <head> (applies to all pages).

Why

The site currently has no Open Graph or Twitter card tags at all — sharing wrongsecrets.herokuapp.com on any social platform produces a bare link with no preview. This is a small, self-contained fix that makes the project look polished when shared.

Notes

  • The og:image/og:url point at the canonical wrongsecrets.herokuapp.com deployment; the image asset is served identically from every deployment's static dir, so the card renders regardless of which host a visitor is on.
  • No view/controller changes required — the image is served from the existing static resources path.

Verified: image renders clean (vision-QA'd), tags are well-formed, no build changes needed.

Adds a branded 1200x630 social preview card (isometric safe with gold
bars, matching the project logo) plus og:image / twitter:image and
description meta tags to the base layout head. Without these, sharing
wrongsecrets.herokuapp.com on X/LinkedIn/Discord/Slack renders a bare
link with no preview image.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
@github-actions

Copy link
Copy Markdown

🧪 Testing this PR locally

If you already have the repository

First, make sure the official OWASP WrongSecrets repository is configured
as the wrongsecrets-upstream remote:

git remote get-url wrongsecrets-upstream >/dev/null 2>&1 || \
  git remote add wrongsecrets-upstream https://github.com/OWASP/wrongsecrets.git

Then fetch and check out this PR:

git fetch wrongsecrets-upstream pull/2768/head:pr-2768
git checkout pr-2768

If you already have a wrongsecrets-upstream remote, the first command
leaves it unchanged.

Or, if you want the contributor branch directly

If the contributor repository is already configured as origin:

git fetch origin
git checkout -b test-pr-2768 origin/add-og-social-preview

🌍 Reviewing translations

Compare the translated files of this PR side by side with the originals:
open the translation review.
Change the lang parameter in the URL to review another language.

🧹 Cleaning up after testing

When you are finished testing, you can remove the local PR branch:

git checkout main
git branch -D pr-2768

If you added the wrongsecrets-upstream remote specifically for testing
this PR and no longer need it, remove it with:

git remote remove wrongsecrets-upstream

⚠️ Only remove wrongsecrets-upstream if you added it for this test.
If you already had this remote before testing, keep it.

PR: #2768
Branch: add-og-social-preview
Repository: astra-intelligence/wrongsecrets

@commjoen commjoen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @astra-intelligence , thank you for the mr! Can you use our original logo instead please?

Addresses maintainer review on OWASP#2768: embed the repo's actual isometric
safe-with-gold-bars logo (from static/android-chrome-384x384.png) instead of
the hand-drawn reproduction. Adds tools/gen-og-image.py (portable, no
machine-specific paths, fonts via WRONGSECRETS_FONT_DIR -> ./fonts ->
~/.fonts -> system dirs) so the card is reproducible.
@astra-intelligence

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I've updated the card to use the repo's original logo — the isometric safe with gold bars from src/main/resources/static/android-chrome-384x384.png — instead of the hand-drawn reproduction. The card now matches the project's actual branding.

Also added tools/gen-og-image.py (portable generator, no machine-specific paths; fonts resolve via WRONGSECRETS_FONT_DIR → ./fonts → ~/.fonts → system dirs) so the 1200×630 card is fully reproducible from a fresh checkout.

The updated og-image.png is 72 KB (well under the 1 MB crawler limit). Ready for another look.

@commjoen

Copy link
Copy Markdown
Collaborator

@bendehaan how about the tagline “can you find all the secrets?”

@commjoen

Copy link
Copy Markdown
Collaborator

Or “learn how to manage your secrets through solving challenges “ or “ learn how to manage your secrets through challenges and fun”

@astra-intelligence

Copy link
Copy Markdown
Contributor Author

Thanks @commjoen for the tagline suggestions! I've updated the card to use "Can you find all the secrets?" — it's short, punchy, and captures the challenge-based learning angle of WrongSecrets. The regenerated 1200×630 card (74 KB) is pushed to the branch. Ready for another look.

@astra-intelligence

Copy link
Copy Markdown
Contributor Author

Synced the branch with upstream master — the PR is up to date and ready for a re-review whenever you have a minute. The card now uses the repo's original logo and the "Can you find all the secrets?" tagline as discussed. No rush!

@commjoen

Copy link
Copy Markdown
Collaborator

I just came of the phone with @bendehaan , @astra-intelligence : can you do as a tagline "Can you find them all?" and fix the pre-commit findings please?

@astra-intelligence

Copy link
Copy Markdown
Contributor Author

Thanks @commjoen — done on both counts:

  1. Tagline updated to "Can you find them all?" on the OG card (regenerated og-image.png).
  2. Pre-commit finding fixed: ran black on tools/gen-og-image.py (the failing hook was black wanting a reformat — added the missing blank line after the docstring).

The PR head is updated and the pre-commit check should re-run green. Ready for re-review whenever you have a minute.

@commjoen

Copy link
Copy Markdown
Collaborator

Thank you @astra-intelligence , one small question: it feels a bit crowded at the bottom, can i have it a bit higher please? then ready to have it merged :)

@commjoen

Copy link
Copy Markdown
Collaborator

and can you move tools/gen-og-image.py to scripts/gen-og-image.py please?

- Shift OWASP/WrongSecrets/tagline up ~30px so the tagline keeps a
  comfortable 30px bottom margin (maintainer feedback: card was crowded
  at the bottom, tagline nearly touched the 630px edge).
- Relocate tools/gen-og-image.py -> scripts/gen-og-image.py per
  maintainer request; output path logic unchanged (repo-root relative).
- Regenerate src/main/resources/static/img/og-image.png from the moved
  script.

Refs: PR OWASP#2768
@astra-intelligence

Copy link
Copy Markdown
Contributor Author

Thanks @commjoen — both done:

  1. Tagline lifted — the whole text block (OWASP / WrongSecrets / tagline) now sits ~30px higher on the card, so the tagline keeps a comfortable bottom margin instead of crowding the 630px edge.
  2. Generator moved — tools/gen-og-image.py → scripts/gen-og-image.py (commit 8781e1e4). Output path and logo resolution are repo-root relative, so nothing else changed; og-image.png was regenerated from the new location.

CI is re-running on the new head. Ready for merge whenever you are — thanks for the quick review!

@commjoen commjoen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @astra-intelligence , welcome to the team of contributors!

@commjoen
commjoen merged commit 861acad into OWASP:master Oct 19, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants