Obsidian Digital Garden

repository·main·Indexed 25 days ago

https://github.com/oleeskild/obsidian-digital-garden

A plugin for publishing Obsidian vaults as searchable, navigable websites. It features a privacy-first model using 'dg-publish' YAML frontmatter for selective publishing. Supports deployment via GitHub and Vercel, a managed setup via Forestry.md, and local export for self-hosting. Includes capabilities for custom CSS styling, Nunjucks components, and advanced frontmatter link resolution.

Tokens
8.6K
Snippets
21
Records
58
Agent score
82%

What's inside obsidian-digital-garden

  1. How header links are handled during publication

    main

    The Digital Garden publishing process preserves header link information. This includes:

    • Standard links to headers in other files: [[Filename#Header]].
    • Embeds (transclusions) of headers: ![[Filename#Header]].
    • Links to headers containing special characters (e.g., colons).
    • Internal links to headers within the same file: [[#Header]].
    • Internal links with custom display text: [[#Header|custom text]].
    [[000 Home#Welcome]]
    ![[02 Header with special character#A header With a colon]]
    [[#Some Header]]
    [[#Some Header|custom display]]
  2. Excalidraw file structure and parsing

    main

    Excalidraw files in this ecosystem are Markdown files that contain a frontmatter block with excalidraw-plugin: parsed and a JSON block representing the drawing data. The JSON block contains elements (rectangles, text, arrows, lines, etc.) and appState (theme, background color, current tool settings).

    {
    	"type": "excalidraw",
    	"version": 2,
    	"elements": [
    		{
    			"id": "CZsgDfedEqsrXkSK9gQJH",
    			"type": "rectangle",
    			"x": -231.33984375,
    			"y": -252.75,
    			"width": 222,
    			"height": 93.296875,
    			"strokeColor": "#1e1e1e",
    			"backgroundColor": "transparent",
    			"fillStyle": "hachure"
    		}
    	],
    	"appState": {
    		"theme": "light",
    		"viewBackgroundColor": "#ffffff"
    	}
    }
  3. Publish notes selectively with dg-publish

    main
    The plugin follows a 'privacy-first' model. Only notes explicitly marked with dg-publish: true in their YAML frontmatter will be published to your website. Notes without this setting remain private in your Obsidian vault. Linked notes are not automatically published; you must explicitly mark linked notes with dg-publish: true if you want them to be accessible on the web.
  4. Configure card images in Base views

    main

    When using the cards view type in a .base file, you can specify which property to use for the card's cover image using the image key. The plugin supports three primary ways to reference images:

    1. Obsidian Syntax (note.property): Used when you want to pull an image from a specific property of the linked note (e.g., image: note.cover). This is the standard format generated by the Obsidian UI.
    2. Bare Property Name (property): Used to reference a property directly on the file being viewed (e.g., image: cover).
    3. External/Hotlinked: Images can also be provided via external URLs within the property value.

    Note: For wikilink covers to work, ensure the property contains a valid wikilink to an image file.

    views:
      - type: cards
        name: Covers obsidian syntax
        image: note.cover
  5. Export the garden to a local folder

    main

    If you want to preview your garden locally or self-host it, you can export your published notes to a local directory:

    1. In the plugin settings, locate Local Export and set the path to your local digitalgarden folder.
    2. Open the Command Palette and run Export Garden to Local Folder.
    3. Navigate to your digitalgarden folder in a terminal and run npm run dev to start a local development server.

    Note: Local export performs a full export each time and does not support publish status tracking or diffing.

    npm run dev
  6. Set up local development for the plugin

    main

    To develop the plugin locally using the provided testing vault (src/dg-testVault), follow these steps:

    1. Clone the repository.
    2. Use a node version manager to ensure compatibility: nvm install && nvm use.
    3. Install dependencies: npm install.
    4. Run the development environment: npm run dev.
    5. Open the vault located at src/dg-testVault in Obsidian.

    If you wish to develop using a different vault, move the plugin into that vault's .obsidian/plugins folder.

    To use the test vault with GitHub, create a .env file with the following keys:

    GITHUB_REPO=
    GITHUB_TOKEN=
    GITHUB_USERNAME=
    
    # Forestry.md settings (if you're using Forestry.md)
    FORESTRY_BASE_URL=https://api.forestry.md/app
    FORESTRY_PAGE_NAME=
    FORESTRY_API_KEY=
    
    # Local export (for development or self-hosting)
    LOCAL_GARDEN_PATH=../digitalgarden