Publishing Quickstart

Summary

This guide walks you through publishing with Next.js.

Prerequisites

  1. Install the latest version of the dendron-cli
  2. Make sure you have git installed

Steps

Setup

Run the following commands at the root of your Dendron workspace (the folder where dendron.yml is in)

Run the following command to setup publishing for your vault. This will pull in the nextjs-template which will be used to generated a static website from your notes.

NOTE: if you are having trouble doing this using powershell, we recommend following these steps using WSL instead

npx dendron publish init

# you should see the following output
🌱 checking if .next directory exists.
🌱 .next directory does not exist
🌱 Initializing NextJS template.
🌱 Successfully cloned.
🌱 All dependencies installed.

Preview

Preview Notes

Run the following to see a local preview of what your site will look like. By default, Dendron will publish all the notes in your given vault.

  • This command launches a development server which previews how your published website will look like. Visit http://localhost:3000 to access your site.
  • Enter CTRL-C on the terminal to exit the preview
npx dendron publish dev

NOTE: if you only want to publish a particular vault, see the guide here. If you want to publish specific hierarchies, you can do so by modifying siteHierarchies.

Export

Run this command inside the root of your workspace. This command builds the static HTML which you'll upload to actually publish your site, and adds the static website to the .next/out/ directory.

npx dendron publish export

# generated html files are inside of `.next/out`

Congrats, you did it! At this point, you have a folder of static HTML which you can host and deploy anywhere. You can checkout our cookbook for examples of deploying to popular destinations like GitHub Pages.


Backlinks