Today I Learned
10 May 2023
RSS in Nuxt
To create own RSS, I found tutorial to create own RSS in Nuxt with Nuxt Content. You can check my RSS
09 May 2023
08 May 2023
Sitemap in Nuxt
Sitemap is one method to increase SEO by make easier search bot to find other page. You can check all sitemap in website
06 May 2023
useContentHead()
I found a cool API, we can config <head>
by Markdown. But it need Document Driven Mode. Here example on Today I Learned Page.
---
title: "Today I Learned Page"
description: "Document what I have learn today."
head:
meta:
- name: "robots"
content: "index, follow"
- name: "keywords"
content: "today i learned, learn, learning, today, til"
- name: "og:title"
content: "Now Page"
- name: "og:description"
content: "Document what I have learn today."
---
05 May 2023
resolveComponent()
I have case on Playground Page need create dynamic component for preview of playround.
<template>
<component :is="clickable ? MyButton : 'div'" />
</template>
<script setup>
const MyButton = resolveComponent('MyButton')
</script>
22 April 2023
Resize Observer
I insipre Vercel Design Team who create show width and height of element. I search how to create it, then found a Resize Observer.
const resize = new ResizeObserver((entries, observer) => {
entries.forEach((entry) => {
console.log(`${entry.offsetWidth} x ${entry.offsetHeight}`)
});
});
resize.observe(element);
// Dont forget to disconnect/unobserver when not use
resize.disconnect();
22 March 2023
Intersection Observer
If you see my Home Page you notice the element is show when visible on screen and disappear when not visible screen. It create with Intersection Observer.
const observer = new IntersectionObserver((entries, observer) => {
entries.forEach((entry) => {
if(entry.isIntersecting) return entry.target.classList.add("intersecting")
return entry.target.classList.remove("intersecting")
})},
{ rootMargin: "0px" }
);
observer.observe(element);
// Dont forget to disconnect/unobserver when not use
observer.unobserve(element) // Single element
observer.disconnect() // All element