Skip to content

Instantly share code, notes, and snippets.

@leandromuto
Last active April 11, 2023 10:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leandromuto/c372fbf6cf24e9b3a7a94fc44f4bbfcc to your computer and use it in GitHub Desktop.
Save leandromuto/c372fbf6cf24e9b3a7a94fc44f4bbfcc to your computer and use it in GitHub Desktop.

Here's a little CSS snippet to create a simple header to link yesterday, tomorrow, and T-1Y notes to the daily note. If you don't know what I'm talking about, you can check the @TfTHacker repo where they create a customized dashboard or @FromSergio youtube video explaining how to activate CSS customization.

Here are the steps:

  1. Copy the CSS code from the first comment below and create a new file in the ./obsidian/snippets folder. The name of the file will be the name of the snippet;
  2. In the Obsidian app, open Settings -> Appearance -> CSS Snippets and toggle the previously created snippet;
  3. Create a draft markdown file and paste the markdown from the second comment;
    1. Change the internal notes link if you want
  4. Change to Reading View en voilá!

Note: restart Obsidian if the snippet don't show up in the step #2.

@leandromuto
Copy link
Author

leandromuto commented Jan 7, 2023

.daily div p:has(a.internal-link) {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    color: #565656;
}

.daily div p:has(a.internal-link) .internal-link {
    text-decoration: none;
    flex-grow: 4;
}

.daily div p:has(a.internal-link) .internal-link:first-child {
    text-align: left;
    padding-left: 10px;
}

.daily div p:has(a.internal-link) .internal-link:nth-child(2) {
    text-align: center
}

.daily div p:has(a.internal-link) .internal-link:last-child {
    text-align: right;
    padding-right: 10px;
}

@leandromuto
Copy link
Author

Activate the snippet in Settings -> Appearance -> CSS Snippets -> Toggle daily to apply the snippet

image

@leandromuto
Copy link
Author

leandromuto commented Jan 7, 2023

In the YAML section of the desired markdown file add the cssclass property with the name of the snippet previously toggled like in the following image

image

Markdown example:

---
cssclass: daily
---

👈 [[Daily/2023-01-06|Yesterday]] | [[Daily2022-01-07|1 Year Ago]] | [[Daily/2023-01-08|Tomorrow]] 👉

---

# To-Do List

@leandromuto
Copy link
Author

This is the result using the Obsidian default theme

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment