Skip to content
Discussion options

You must be logged in to vote

I'd start by looking at https://www.11ty.dev/docs/config/#transforms.
Transforms run pretty late in the build pipeline when the HTML should be "complete".
Then, check whether the current file being transformed is an .html template, and if so, use something like https://cheerio.js.org/ to query the markup for your first main img tag and then append your <meta property="og:image" content="{{ something }}"/> tag into the <head> and then return the new HTML DOM which will be written to the disk.

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@Ryuno-Ki
Comment options

@werls
Comment options

@Ryuno-Ki
Comment options

@werls
Comment options

@pdehaan
Comment options

pdehaan Jun 16, 2022
Collaborator

Answer selected by werls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants