← Corpus / lost-in-public / exploration

Using Obsidian To Manage Markdown Based Content Collections For Static Site Generation Frameworks

Path
explorations/Using Obsidian to manage Markdown-based Content Collections for Static-Site Generation Frameworks.md
Augmented with
Windsurf Cascade on Claude Sonnet 4
Tags
Content-Generation · Content-Management · JAM-Stack

|>update_start::2025-05-26T12:33:46.108Z

Resolving Paths at Build Time across Deployments

Updated the build script in package.json to use shell: true in the execSync options. This ensures that file paths with spaces are properly handled by the shell.

"build": "node -e \"require('dotenv').config({ path: '.env' }); require('child_process').execSync('astro build --remote', { stdio: 'inherit', shell: true });\""

Created a vercel.json configuration file with optimized settings for Astro and Vercel, including proper caching headers and build configurations that should handle file paths more reliably.

{
  "buildCommand": "npm run build",
  "outputDirectory": "dist",
  "framework": "astro",
  "installCommand": "npm install",
  "devCommand": "npm run dev",
  "build": {
    "env": {
      "NODE_OPTIONS": "--dns-result-order=ipv4first"
    }
  },
  "routes": [
    {
      "src": "/(.*)",
      "dest": "/index.html"
    }
  ],
  "cleanUrls": true,
  "trailingSlash": false,
  "headers": [
    {
      "source": "/(.*)",
      "headers": [
        {
          "key": "Cache-Control",
          "value": "public, max-age=0, must-revalidate"
        }
      ]
    },
    {
      "source": "/_astro/(.*)",
      "headers": [
        {
          "key": "Cache-Control",
          "value": "public, max-age=31536000, immutable"
        }
      ]
    }
  ]
}

|>update_start::2025-03-19T19:25:22.108Z

[[Backlinks]] default to only including the file name. Obsidian’s app has a really smooth, fast way of keeping an index of the location of files, so Obsidian is self-aware, clearly has some kind of observer.

This poses a problem for using [[Backlinks]] as tool to create a kind of [[Wiki]] feature of your own website and its content. When rendering a Markdown file as web content, any link to internal content will need to have the relative path from the root of the site directory (or some alias that can be set up).

Unfortunately, I’ve been using Obsidian for about five months and I only figured out that [[Tooling/Productivity/Advanced Documents/Obsidian|Obsidian]] has an option in their Core Plugins/Backlinks that allows you to default to writing the the absolute path from the vault route in the backlink.

However, apparently there is not a built in way to then automatically convert pre-created backlinks into

|>update_end::2025-03-19T19:25:22.108Z

Stealing Flavoured Syntax from anywhere

Embeds with Emoji class selectors

Callouts are very nearly equivalent to standard Markdown block quotes in their syntax, other than some specific requirements on their content: To be considered a “callout”, a block quote must start with an initial emoji. This is used to determine the callout’s theme. Here’s an example of how you might write a success callout.

> 🎅 Success 
>  
> Vitae reprehenderit at aliquid error voluptates eum dignissimos.
.markdown-body .callout[theme='🎅'] {
	--background: #c54245; 
	--border: #ffffff6b; 
	--text: #f5fffa; }

Embeds

Embeds from Readme

Simple embedded content is written as a Markdown link, with a title of “@embed”, like so:

[Embed Title](https://youtu.be/8bh238ekw3 "@embed")

More robust embedded content is written as a JSX component:

<Embed
  html={false}
  url="https://github.com/readmeio/api-explorer/pull/671"
  title="RDMD CSS theming and style adjustments. by rafegoldberg · Pull Request #671 · readmeio/api-explorer"
  favicon="https://github.com/favicon.ico"
  image="https://avatars2.githubusercontent.com/u/6878153?s=400&v=4"
/>

Tabbed Code Blocks

[[Tooling/Software Development/DevOps/Documentation Engines/Readme]]‘s Tabbed Code Blocks

```javascript I'm A tab
console.log('Code Tab A');
```
```javascript I'm tab B
console.log('Code Tab B');
```

CSS Colors for Code Blocks

.markdown-body {
  --md-code-background: #e3dcef;
  --md-code-text: #4a2b7b;
  --md-code-tabs: #c6b8dd;
  --md-code-radius: 4px;
}

Using YAML Frontmatter

Mapped to [[projects/Emergent-Innovation/Standards/YAML]], [[projects/Emergent-Innovation/Standards/Markdown|Markdown]]

Property
url
reddit_forum_url

Tidying with Scripts

Convert one yaml property Check for duplicate filenames Audit backlinks

Using Obsidian Git Plugin for Submodule Management

Based on my review of the obsidian-git plugin source code, here’s a comprehensive analysis of its submodule support and how it fits your use case.

✅ Submodule Support Analysis

What the Plugin Supports:

  • Automatic Submodule Detection: The plugin can automatically detect when a file is within a submodule using Git’s rev-parse --show-superproject-working-tree command
  • Per-Submodule Operations: When you perform Git operations (commit, pull, push) on files, the plugin automatically determines which submodule the file belongs to and executes the command in the correct repository context
  • Submodule-Aware Commands: All major Git operations work within submodules:
    • Staging/unstaging files
    • Committing changes
    • Pulling/pushing
    • Viewing diffs and history
    • Opening files in GitHub
  • Configuration Options:
    • updateSubmodules: Enable/disable submodule support (disabled by default)
    • submoduleRecurseCheckout: Automatically checkout matching branches in submodules

How It Works:

The plugin uses Git’s native submodule detection to:

  • Identify which submodule a file belongs to
  • Execute Git commands with the correct working directory (-C <submodule-path>)
  • Handle relative file paths within each submodule context

Perfect Match for Your Use Case:

YES! This plugin appears to be exactly what you need:

  • Multiple Repository Management: You can have projects/Augment-It connected to one repo and changelog--code connected to another repo
  • Selective Commits: You can choose which submodule to commit to - the plugin automatically detects the correct repository based on the file you’re working with
  • Independent Operations: Each submodule operates independently - you can commit to one without affecting others

Setup Requirements:

  1. Enable Submodule Support: In Obsidian Git settings, turn on “Update submodules”
  2. Proper Git Structure: Your vault needs to be structured as a Git repository with proper submodules
  3. Tracking Branches: Each submodule needs to have a tracking branch set up

Limitations to Consider:

  • Desktop Only: Submodule support is explicitly desktop-only (not available on mobile)
  • Opt-in Feature: Disabled by default, must be manually enabled
  • Some Missing Features: The documentation mentions “Missing features: Conflicted files, count of pulled/pushed/committed files” for submodules
  • Tracking Branch Requirement: Each submodule needs proper tracking branch configuration

Recommendation:

This plugin should work perfectly for your monorepo structure where different directories are separate Git repositories. The automatic submodule detection means you can work naturally in Obsidian, and the plugin will handle routing your Git operations to the correct repository automatically.

The key is setting up your vault as a proper Git repository with submodules, then enabling the “Update submodules” setting in the plugin configuration.