Conditional properties or similar

What I’m trying to do

I want to create functionalities similar to Wikipedia.

For example: Let’s say I want to mark a document within a personal encyclopedia as “unwritten”. So, I write the concept within a document as regular text, let’s say the concept is “data model”. Then, I select these words and click on a button or something similar to indicate that the document is unwritten. After this, a new document is created in the encyclopedia, and I would also like the selected text to change its color to red so that I know it has not yet been written when I come back to review the page.

I know it sounds a bit complicated; I hope I have been clear. I clarify that I am currently deciding which note-taking application to use, with the goal of choosing one that supports actions like the one I just described. Do you think it’s possible to do this in Obsidian? And if so, how can I do it?

Not exactly the solution, but here’s how I do it in my personal wiki:
I create templates with some status and other properties. Then I use the Supercharged Links plugin (coupled with the Style Settings plugin) to mark the file with a green square emoji (I’m now officially an emoji user, I guess) when it is ready to be published or has been published actually. I don’t do red squares.
I have icons on the mobile toolbar and key combos on desktop to change the properties, again with Templater. As soon as the property value has been altered, the green square shows (I put it before the filename, not after). So I don’t use any additional CSS snippets, I let these plugins handle the job.

There’s been quite a few threads where app.fileManager.processFrontMatter is employed for said purpose.

1 Like

Thank you very much for taking the time to give me such valuable information, it’s very useful to me and I will look into what you’ve told me.
Have a good day :).

1 Like

Obsidian doesn’t have a ‘works-for-everyone’s-use-case-out-of-the-box-but-we-set-limitations’ approach. There are no limits but you need to build your own Obsidian eco-system up. This can be daunting or fun, but as with all things in life, one needs to put in the time.

One needs to stay on top of updates and third-party plugin releases/updates and according to one’s (evolving) note taking experience, make the adjustments necessary, which can be simple things such as adding an icon on the Editing Toolbar (another third-party plugin), find new ways to search (with regular expressions, for instance), etc.

Queries are important. So for example, what happens if one of my notes is ‘greener than green’?
If there’s been updates on it and has not been re-published? Obviously you need the properties set up (date modified and some other property with valid date format; I myself recently switched to a date-time format) and perform a query on those.

Enter Dataview (the most popular amongst help seekers on the forum too).
On a Dashboard canvas I have various DV queries. Among them, one checks if there’s been any files with updates I need to pu(bli)sh:

```dataviewjs
(async () => {
  const { metadataCache, plugins } = this.app;

  const pages = await Promise.all(
    dv.pages("")
      .map(async (page) => {
        try {
          const fileCache = metadataCache.getFileCache(page.file);
          const dateModified = fileCache.frontmatter["date modified"];
          const dgUpdated = fileCache.frontmatter["dg-updated"];

          if (dateModified && dgUpdated) {
            const dateModifiedDate = new Date(dateModified);
            const dgUpdatedDate = new Date(dgUpdated);

            if (dateModifiedDate > dgUpdatedDate) {
              return {
                link: page.file.link,
                dateModified,
                dgUpdated,
              };
            }
          }
        } catch (error) {
          console.error(`Error processing file: ${page.file.path}`, error);
        }

        return null;
      })
  );

  // Remove null entries and render the result table
  const filteredPages = pages.filter((p) => p !== null);
  if (filteredPages.length > 0) {
    dv.table(
      ["File", "Date Mod.", "DG Updated"],
      filteredPages.map((p) => [p.link, p.dateModified, p.dgUpdated])
    );
  } else {
    console.log("No files meet the criteria.");
  }
})();
```
  • Again, it goes without saying that you will have properties named differently and that you need to keep the date modified property updated (with the Linter or other plugin that updates the frontmatter) at all times when editing your notes. It should be automatically done.
  • The metadata-specific and other snippets of code around which the rest of the queries are built need to be picked up on the forum and from plugin documentation. The same goes for Templater.

Here is a sample document which tackles both the cases you wrote:

---
tags:
  - status/unwritten
---
Some useful stuff about the data model.

[concept:: data model]

When displayed this could show up as:

But there are two vital concepts introduced in this rather simple document:

  • The tag #status/unwritten which you can use to search for or group together documents which belong to that category. One could also imagine stuff like #status/review or similar to denote other types of work
  • An inline field of concept with the value of data model. This can be picked up the Dataview plugin, and made into a list so that you could see which concepts you need to describe, and based on your mood you could select which topic you want to focus on.

The latter query could look something like:

```dataview
TABLE c as "Concept"
WHERE concept
FLATTEN concept as c
SORT c
```

This would scan your entire vault for files having concept defined, and split them up into single concepts and present then in a nice tabular format with a link to the file it originated from. All sorted according to the concept value.

Yes, it’s possible, and the approach would meet your currently described requirements. It’s not using a button as such, but just pure text. The inline fields can also be styled to display however you’d like them to show using CSS snippets.