←TIL

is this thing on?

July 24, 2024

NICE!!!

For the site, I wanted an easier way to push content up. While I write all code in editors configured for just that, I still enjoy writing in Obsidian.

So, how does this work?

TL;DR: Create symlinks, use Astro’s content directory, push code, be happy.

Full credit to Lazar Nikolov.

Astro has this new “Content collection” concept added in astro@2.0.0 that allows you to create dynamic routes using a separate content directory, providing more logical separation between content and code.

So the Astro project essentially looks something like this:

.
├── content
│   └── til
│       └── is-this-thing-on
│           └── index.md
└── pages
    └── til
        ├── [...slug].astro
        └── index.astro

This means for the page til/is-this-thing-on, we can load up the slug and use that slug to get the content from the content directory! Pretty cool!

Now that we have a way to render dynamically, I used Quick Add to run a simple macro that can just create a new folder in my vault. The vault then connects to my content directory via symlinks, and voila! I have a super easy workflow ready with a writing setup for this site!

After pushing to Git, my workflow runs and deploys the site for me, no problem!!

However, the Git pushes are still manual, and I need to find a way around this.

TODO:


astro,test