933d6874b1
- Introduced rehypeLazyImages plugin for lazy loading images in blog posts. - Updated sitemap integration to include last modified dates for blog posts. - Enhanced Head and BaseLayout components to support additional Open Graph metadata. - Improved RSS feed generation with sanitized content and author information. - Updated manifest.json for a darker theme and standalone display mode. - Added support for language-specific attributes in various components. - Refactored blog post handling to include modified and published timestamps.
14 lines
367 B
TypeScript
14 lines
367 B
TypeScript
import type { Element, Root } from "hast";
|
|
import { visit } from "unist-util-visit";
|
|
|
|
export default function rehypeLazyImages() {
|
|
return (tree: Root): void => {
|
|
visit(tree, "element", (node: Element) => {
|
|
if (node.tagName !== "img") return;
|
|
node.properties ??= {};
|
|
node.properties.loading ??= "lazy";
|
|
node.properties.decoding ??= "async";
|
|
});
|
|
};
|
|
}
|