30
loading...
This website collects cookies to deliver better user experience
postImageSource
where users can specify which domains they want to render as an image when the template comes across a link with this domain.// site.config.js
postImageSource: [
'images.unsplash.com',
'res.cloudinary.com',
'dl.dropboxusercontent.com',
],
postImageSource
work backwards, meaning that people can disable rendering text links that include domains from postImageSource
. Ultimately they can update all their posts and remove the postImageSource
permanently.const postImageSource = [
'images.unsplash.com',
'res.cloudinary.com',
'dl.dropboxusercontent.com',
];
const postImageSource = [
'images.unsplash.com',
'res.cloudinary.com',
'dl.dropboxusercontent.com',
];
if (text.link) {
....
}
const postImageSource = [
'images.unsplash.com',
'res.cloudinary.com',
'dl.dropboxusercontent.com',
];
if (text.link) {
const linkUrl = text.link.url;
if (postImageSource.some((u) => linkUrl.includes(u))) {
return <img src={linkUrl} alt="insert alt" />;
}
// If the domain is not specified in the postImageSource, render a text link.
return <a href={linkUrl} target="_blank" rel="noopener noreferrer">{text.content}</a>;
}