New blog...

I must have done this a few times over the years but I'm starting another blog! I'm hoping to use it as a place to document what I'm learning in the world of web development, life updates and anything else that interests me.

I have used a template to get me started, though I hope to edit it as I go, partly to learn new things and partly to make it my own. Some ideas for things I want to add/update:

  • Convert it to TypeScript
  • Update it so the content comes from a CMS (maybe Sanity or Keystone). This would require moving the MDX compilation step to be done on demand on the server rather than at build time as currently happens.
  • Get the images hosted and delivered by a service like Cloudinary. I want to learn this as I think it'll be useful for a project idea I have.
  • Implement tagging on posts.

It comes with some great things out of the box though:

Code blocks with syntax highlighting

For any code snippets I want to include in posts:

const hello = 'world'

console.log('Ooo, syntax highlighting')

MDX

Also, it is using MDX, so I can write normal post content with the simplicity of markdown and also import components. For example, I can create a component like this (externally, or even inside the mdx file):

import { useState } from 'react'
import useInterval from '@/lib/useInterval'

export const ReadingFor = () => {
  let [count, setCount] = useState(0)
  useInterval(() => {
    setCount(count + 1)
  }, 1000)
  return `${count} second${count === 1 ? '' : 's'}`
}

and use it directly in my markdown like this:

You have been reading this post for <ReadingFor />.

You have been reading this post for 0.