Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement thumbnails for multidimensional data pages #4475

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rakyi
Copy link
Contributor

@rakyi rakyi commented Jan 22, 2025

We can't use a dynamic thumbnail for social media previews, because the meta tags are generated during baking. We could switch to dynamic thumbnails if/when we move the Grapher pages to dynamic rendering, i.e Cloudflare functions.

Resolves #4456

@rakyi rakyi requested a review from ikesau January 22, 2025 15:19
@rakyi rakyi marked this pull request as draft January 22, 2025 15:28
@owidbot
Copy link
Contributor

owidbot commented Jan 22, 2025

Quick links (staging server):

Site Dev Site Preview Admin Wizard Docs

Login: ssh owid@staging-site-mdim-thumbnails

SVG tester:

Number of differences (default views): 770 (7fc922) ❌
Number of differences (all views): 352 (8bcf3b) ❌

Edited: 2025-01-24 11:01:36 UTC
Execution time: 1.31 seconds

@rakyi rakyi marked this pull request as ready for review January 22, 2025 15:46
We can't use a dynamic thumbnail, because the meta tags are generated
during baking. We could switch to dynamic thumbnails if/when we move the
Grapher pages to dynamic rendering, i.e Cloudflare functions.
}
// Due to thumbnails not taking into account URL parameters, they are often inaccurate on
// social media. We decided to remove them and use a single thumbnail for all charts.
// See https://github.com/owid/owid-grapher/issues/1086
Copy link
Member

Choose a reason for hiding this comment

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

Huh? We do show chart previews based on query params

See rewriteMetaTags

image image

So at least one of us must be confused 😅

Copy link
Member

@ikesau ikesau Jan 23, 2025

Choose a reason for hiding this comment

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

Once we've resolved this, I'll actually test the PR 👍

(Though, I might need a refresher on how to get MDD's running locally 🙂)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, that's pretty cool that we do that. I copy-pasted the existing code from the data page, so I'll remove those comments in both places then. And, it works the same for mdims out of the box:

http://staging-site-mdim-thumbnails/grapher/mdd-demo-poverty?povertyLine=30&metric=share

Copy link
Contributor Author

@rakyi rakyi Jan 24, 2025

Choose a reason for hiding this comment

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

Testing mdims locally is quite complicated. You need a relatively fresh copy of the DB. The previews are available at an admin sub-path, e.g. http://localhost:3030/admin/grapher/mdd-demo-poverty (even if the mdim is not published). Let me know if you'll need help with it.

@rakyi rakyi requested a review from ikesau January 24, 2025 10:34
We now rewrite the image meta tags dynamically in Cloudflare functions
to take query params into consideration.
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.

Dynamic thumbnails for multidimensional data page views
3 participants