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

static Datawrapper embed code #1611

Merged
merged 3 commits into from
Aug 27, 2024
Merged

static Datawrapper embed code #1611

merged 3 commits into from
Aug 27, 2024

Conversation

mbostock
Copy link
Member

This…

  • Adopts Datawrapper’s recommended embed script code for simplicity
  • Favors static rendering of the embed script for better performance
  • Uses data-dark="auto" likewise for performance and simplicity

@mbostock mbostock requested a review from Fil August 27, 2024 14:49
@Fil
Copy link
Contributor

Fil commented Aug 27, 2024

redeployed

https://observablehq.observablehq.cloud/framework-example-datawrapper-api/

@Fil Fil merged commit 52453ed into main Aug 27, 2024
4 checks passed
@Fil Fil deleted the mbostock/datawrapper-script branch August 27, 2024 15:59
</div>

The above data loader lives in `data/chart.txt.py`, and creates the `data/chart.txt` file attachment, which contains the identifier. We read this file’s contents and pass it to the helper:
The above data loader lives in `data/chart.txt.py`, and creates the `data/chart.txt` file attachment, which contains the identifier. Since the identifier is dynamically constructed by the data loader, we can’t hard-code the identifier in HTML; instead, we’ll use a JavaScript helper function to create the embed script.
Copy link
Contributor

Choose a reason for hiding this comment

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

this will be possible with page loaders 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, great point! Nice.

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