Is your feature request related to a problem? Please describe.
This may just be a documentation request, but I was hoping to set a default card image for posts without an explicit image set. I have been testing the new registerCardImage hooks with the code below, but cannot work out how to locally serve an alternative image from within VSCodium.
import { registerCardImage, enableDevelopmentMode } from "https://cdn.jsdelivr.net/npm/@frontmatter/extensibility/+esm";
enableDevelopmentMode();
/**
* @param {string} filePath - The path of the file
* @param {object} data - The metadata of the file
* @returns {string} - The HTML to be rendered in the card footer
*/
registerCardImage(async (filePath, metadata) => {
const image = metadata.fmPreviewImage ? metadata.fmPreviewImage : '/path/to/fallback.jpg';
return `<img src="${image}" alt="${metadata.title}" style="object-fit: cover;" class="h-36" />`;
});
The default images seem to be prefixed with a local / CDN URL which is probably what I need to do here as well.
Describe the solution you'd like
Some documentation or an example of how to reference images from within these hooks.
Describe alternatives you've considered
Possibly just using an inline SVG as a temporary solution.
Is your feature request related to a problem? Please describe.
This may just be a documentation request, but I was hoping to set a default card image for posts without an explicit image set. I have been testing the new
registerCardImagehooks with the code below, but cannot work out how to locally serve an alternative image from within VSCodium.The default images seem to be prefixed with a local / CDN URL which is probably what I need to do here as well.
Describe the solution you'd like
Some documentation or an example of how to reference images from within these hooks.
Describe alternatives you've considered
Possibly just using an inline SVG as a temporary solution.