qri-io/frontend

[SSR] Add Link Unfurling

Closed this issue · 0 comments

We added react helmet in #603, but the og and other meta tags don't come through correctly in SSR.

In SSR, we are already injecting jsonLD into index.html here:

frontend/server/index.js

Lines 97 to 104 in 7bf4732

try {
const headData = composeHeadData(dataset)
const jld = composeJSONLD(dataset)
indexHTML = indexHTML.replace('<head>', headData+jld)
} catch (e) {
console.log(`error composing dataset ${username/name} data into html tags: ${e}`)
return res.sendFile(indexPath)
}

We can use the same call to the preview to populate og tags and whatever else is necessary for link unfurling.