aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/rehypeLazyImages.ts
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-04-22 20:53:21 +0300
committerValentin Popov <valentin@popov.link>2026-04-22 20:53:21 +0300
commit933d6874b1fe1dbb113e9de39425f2d713a72408 (patch)
tree44278a4088a2144ac08fb72fd4abe86ab60a55e8 /src/plugins/rehypeLazyImages.ts
parent5e818d804d5d38beff0f3754a006333752fd5082 (diff)
downloadpopov.link-933d6874b1fe1dbb113e9de39425f2d713a72408.tar.xz
popov.link-933d6874b1fe1dbb113e9de39425f2d713a72408.zip
feat: enhance blog and SEO features with new plugins and metadata
- 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.
Diffstat (limited to 'src/plugins/rehypeLazyImages.ts')
-rw-r--r--src/plugins/rehypeLazyImages.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/rehypeLazyImages.ts b/src/plugins/rehypeLazyImages.ts
new file mode 100644
index 0000000..eb470a4
--- /dev/null
+++ b/src/plugins/rehypeLazyImages.ts
@@ -0,0 +1,13 @@
+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";
+ });
+ };
+}