I’m a somewhat frequent poster in this forum, and most of my answers are related to Dataview or something related to that. This kind of resembles your use case, so I’m going to present how I do that, in the hope it could prove useful for your work ahead. After that I’m going to mention a few tidbits on the general are of code snippets and technical notes.
My setup for forum posts
Most forum posts have some initial code (or query) that either needs to be rebuilt or reworked, or just handled in a different matter. They also usually need some context in the sort of notes and related metadata structure. Therefore I started out with a single folder,
ForumStuff, and added one folder for each post. I did from the start separate out all of these posts into a test vault of mine, so that it’s separated from my main personal vault.
I soon realised I needed to add another level, so now a folder for answering this question (if I made one) would be
ForumStuff/f57/f57673 and the main note would be something like
f57673 Code snippets and technical notes. The
f57673 reflects on the numeric id of this post, and a short but full link to this post are: Using Obsidian for code snippets and technical notes
So whenever I reply to a post needing code snippets, I hit a hotkey to trigger a template where it asks for the title, e.g.
f57673 Code snippets and technical notes. Then the template creates the needed folders, and the main note with some basic tags and text, like the forum url.
From there on the forum post dictates the rest of the note, but it’s typical a iterative sequence of queries where I start with the original query from the post, and refine or rebuild it into something which works.
Here one could/should probably be a little more methodical and report both the use case and the issue one is trying to solve, and possibly add some tags to show this is the initial issue. And similarly, one could/should possibly add tags or structure related to the solution, and what the key learning/aspect of it are. (I’ve not done that, so far… )
Another thing I’ve been thinking about doing, is to tag each forum post with the current topics. Like I could do something like:
topic: dvjs, table, flatten, group_by to denote it’s a table query using Dataviewjs where it’s needed to both use
GROUP BY. This would allow future me to do a search on relevant terms, and get all my previous posts related to those terms. Alas, this is also something I’ve not done so far.
The key point though, is to build a structure which will survive growing to a decent size, keep references to the where or how the issue arose, and ideally some categorisation to help you look into it on a later stage.
Some various tidbits on this subject
- I’ve already mentioned it, but keeping a link to the origin of the issue I think is vital. Similarly, also link to sources or references which helps you illustrate or understand the issue
- If you’re using a few given sites, like stackoverflow.com, github.com, forum.obsidian.md, or similar, I’d consider doing a folder structure for each
- Categorise or tag everything from the start, so that you’re able to re-use your information later on
- Allow the iteration’s to build up on your notes. They can provide to be useful at a later stage, as they could cover interesting variants of the issue
- Try keeping positive and informative titles (like the other link suggested)
- Even though one folder per issue/subject might seem a little overkill, I still think I would do it, as that would allow for related files to kept together in a nice unit. (This might be especially useful if you’re working on something related to Obsidian and queries, or similar use cases… )
Another thought I had when thinking about this, is that for me the use case of doing non-obsidian code snippets within Obsidian could become a little troublesome. This I think because code snippets usually require so much context before the code can be executed in a meaningful way, and just nice looking code isn’t that useful. However, there are (at least) two plugins, Execute Code and Code Emitter, which boasts they’re able to execute code snippets within a note, which might be worth taking a look at.
Then again, if you’re doing one folder per issue/subject, one can imagine allowing your code environment to access that folder. So you could use Visual Studio Code (VS Code) to do other stuff in that folder, whilst still using Obsidian for the bulk of the documentation. And VS Code does also have great markdown support through some plugins.
So not sure if this is helpful, but it gives a sketch of how I approach forum posts, and some thoughts related to what I’m missing and would value even more related to my code snippets (if only I got around to doing it)