# Managing my recipes with Dendron 2022-04-04 00:00 > This post is day 10 of me taking part in the > #100DaysToOffload challenge. => https://100daystooffload.com/ #100DaysToOffload I like to cook at home, but for a long time I never wrote down or saved any of my recipes. Because of that I would occasionally completely forget how to make something. My mom, and my grandmom write down their recipes in notebooks, but I want something more powerful and resilient than some pen and paper. At first I tried writing down my recipes in Google Keep, but found it a bit tedious. That's where Dendron came in. Dendron is a knowledge management and note taking tool. It comes with a features that enhance the writing experience, but more importantly it has a lot of features that enhance the discoverability of what you wrote. For reference, I have the repository for the recipes available publicly. => https://gitea.bgenc.net/kaan/recipes repository for the recipes ## Setup Dendron is an extension for Visual Studio Code, so you'll need to install both. There's a great tutorial to go through, but I'm already experienced with it so I went ahead and created a new workspace that I called "recipes". => https://marketplace.visualstudio.com/items?itemName=dendron.dendron Dendron Next, I created a template and a schema to help me write new recipes. The template is just a regular Dendron note, which I named `templates.recipe`. ```md * Servings: * Calories: * Protein: * Fiber: ## Ingredients ## Instructions ## Notes ``` This template immediately gives me the basic structure of a recipe. I have the ingredients and instructions, and then I have a place to put any additional notes about the recipe (for example, things I want to change next time I cook it, or how to serve it best). I also have a section at the top to fill out some nutritional information. I use the mobile app Cronometer to calculate that, although most of the time I don't bother because it's just a nice-to-have that I don't really need. Next, here's my schema. ```yml version: 1 imports: [] schemas: - id: recipes title: recipes parent: root children: - id: bowls title: bowls namespace: true template: templates.recipe - id: baked title: baked namespace: true template: templates.recipe - id: dessert title: dessert namespace: true template: templates.recipe - id: misc title: misc namespace: true template: templates.recipe - id: soup title: soup namespace: true template: templates.recipe ``` The schema helps me keep my recipes organized (and also automatically applies the template note). You can see that I have my recipes organized under `bowls` for stuff like rice and pasta dishes, `baked` for bread, pies and anything else where you bake everything, `dessert` and `soup` which are self descriptive, and `misc` which holds anything else like salad toppings. ## Publishing I publish my recipes online, which makes it very easy to pull up a recipe when I'm cooking or at the grocery store. => https://bgenc.net/recipes/ recipes online I use a self-hosted setup, so all I have to do is just run the Dendron CLI to build the site. To automate this process, I set up some VSCode tasks to build and publish the site. ```json { // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "label": "build site", "type": "shell", "command": "dendron publish export", "options": { "cwd": "${workspaceFolder}" } }, { "label": "publish site", "type": "shell", "command": "rsync -av .next/out/ /var/www/recipes/", "options": { "cwd": "${workspaceFolder}" }, "dependsOn": ["build site"], "problemMatcher": [] }, ] } ``` I think before running these commands, you first have to run `dendron publish init && dendron publish build` first. The first task builds the site using Dendron, and then the second task copies the generated static website to where I have it published. I'm running a web server on my desktop so this is just a folder, but `rsync` can also copy things over SSH if you host your site on a different machine. There are also tutorials for things like Github pages or Netlify. => https://wiki.dendron.so/notes/x0geoUlKJzmIs4vlmwLn3/ tutorials Because I'm publishing under a subfolder (`.../recipes`), I also had to set `assetsPrefix` in my `dendron.yml` configuration file. ```yml publishing: assetsPrefix: "/recipes" ... ``` ## Bonus: What do I cook this week? My wife and I go shopping once a week, so every week we need to decide what we're going to eat this week. Sometimes it can be hard to pick something to eat though! Luckily, Dendron comes with a command `Dendron: Random Note` which shows you a random note. You can even configure it to only show some notes, which I used so it will only show me recipes. ```yml commands: randomNote: include: - "recipes" ``` Now when I'm having trouble picking, I can just use this command and get something to cook!