Skip to content

xavierchow/xblog

Repository files navigation

This is a blog post project built with Next.js.

Why yet another blog log with Next.js?

see: https://xavierz.dev/blog/posts/build-blog-with-nextjs

How to start

npm intall

Then run the development server:

npm run dev

How to write blog posts with live editing

Set MARKDOWN_FOLDER to the folder where you put the markdowns, and run npm run watch, you can get the live editing feature out of box.

Environment Variables

  • MARKDOWN_FOLDER: the absolute path of folder with markdown files.
  • WATCH_MARKDOWN: yes for live editing experience.
  • APP_HOST: the FQDN of your blog website, e.g. https://example.blog.com

How to Deploy

Github action

There is an exisiting github action that helps you to build the docker image and push it to the github registry.

Manual

You can also build the image manually as follows,

  • build
docker build . --platform linux/amd64 -t ghcr.io/{namespace}/xblog:latest
  • push to github registry
docker push ghcr.io/{namespace}/xblog:latest
  • run
docker run -p 3000:3000 -e MARKDOWN_FOLDER=/app/myposts/ -v /host/path/posts:/app/myposts ghcr.io/{namespace}/xblog