Carlos Collazo

A clickable date for notes

I've finally made the date and time stamp of my notes clickable thanks to help from Claude. In the past I used a clickable emoji (→)as a workaround, but never loved that.

Sylvia has had a solution for this for a long time now, but didn't recommend it because it was "very hacky."

The key to make this happen is changing my embedded note CSS from a flex to a grid display and then targeting the date and applying a hidden link that matches its length.

It seems to be working exactly as I hoped. Here's my updated Note CSS if you want to see for yourself or apply this to your own notes feed:

Embedded Notes CSS
/* ================================
   Notes Embed Section
   ================================ */

/* Each note: text on top, date (the permalink) underneath */
.notes ul.embedded.blog-posts {
  padding: unset;
}

.notes ul.embedded.blog-posts li {
  display: grid;
  grid-template-columns: max-content 1fr;
  row-gap: 0em;
  align-items: baseline;
  padding: 0.9em;
  margin-top: 0.9em;
  background-color: var(--code-background-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

/* Note text spans the full width, in the top row */
.notes ul.embedded.blog-posts > li > div {
  grid-column: 1 / -1;
  grid-row: 1;
  min-width: 0;
}

.notes ul.embedded.blog-posts > li div p:first-child {
  margin-top: 0;
}

/* Date sits in the bottom row, first column */
.notes ul.embedded.blog-posts > li > span {
  grid-column: 1;
  grid-row: 2;
}

.notes ul.embedded.blog-posts li span {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
}

/* The date looks like a link... */
.notes ul.embedded.blog-posts li time {
  color: var(--muted-color);
  text-decoration: underline;
  text-decoration-color: var(--border-color);
  text-underline-offset: 3px;
}

.notes ul.embedded.blog-posts li:has(> a:hover) time {
  text-decoration-color: var(--text-color);
}

/* ...because the post link is stretched invisibly over it */
.notes ul.embedded.blog-posts > li > a {
  grid-column: 1;
  grid-row: 2;
  z-index: 1;
  align-self: stretch;
  font-size: 0;
}

.notes ul.embedded.blog-posts > li > a:focus-visible {
  outline: 2px solid var(--text-color);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Content inside notes */
.notes img {
  max-width: 350px;
  width: 100%;
  height: auto;
  display: block;
  margin: 0.1em 0;
}

.notes ul.embedded.blog-posts li details pre {
  overflow-x: auto;
  max-width: 100%;
}

/* Safety net: lists inside note content render normally */
.notes ul.embedded.blog-posts > li > div ul,
.notes ul.embedded.blog-posts > li > div ol {
  padding-left: 1.5em;
  margin: 0.5em 0;
}

.notes ul.embedded.blog-posts > li > div ul {
  list-style: disc;
}

.notes ul.embedded.blog-posts > li > div ol {
  list-style: decimal;
}

.notes ul.embedded.blog-posts > li > div li {
  display: list-item;
  padding: 0;
  margin: 0;
  background: none;
  border: 0;
  border-radius: 0;
}

.notes .pagination-row {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  margin-top: 1rem;
  font-size: .95em;
}

#meta #notes