Skip to content

"Automatic" blog post or newsletter with obsidian

Published: at 06:30 PM

I have been using Obsidian Web Clipper for a while. This allows me to save articles I want to read into my obsidian vault, so I can read them later, and have a system for what I’ve read. They also show up in my obsidian graph, which is neat. Sometimes I add some notes to them as well.

Recently Dave Rupert blogged on How to make a Link Aggregator in Obsidian, and I adopted this system and expanded upon it a bit. I have my clipping template set up with a read-date that I use to mark saved articles as read, so I can use this to create a reading list for every week of the year. Then I can post those easily as blog posts.

I use dataview in the same way as Dave Rupert, but I use some “fancy” js to make it a bit more advanced.

Put the below into a dataviewjs tag in obsidian. This renders a list of every article I read with the summary, for every week of 2025. You can see an example in the Reading list week 20

const year = 2025;
const totalWeeks = 52; // Could be 53 some years

function getWeekRange(y, w) {
  const simple = new Date(y, 0, 1 + (w - 1) * 7);
  const dow = simple.getDay();
  const ISOweekStart = new Date(simple);
  if (dow <= 4) ISOweekStart.setDate(simple.getDate() - simple.getDay() + 1);
  else ISOweekStart.setDate(simple.getDate() + 8 - simple.getDay());
  const ISOweekEnd = new Date(ISOweekStart);
  ISOweekEnd.setDate(ISOweekStart.getDate() + 6);
  return [ISOweekStart, ISOweekEnd];
}

for (let week = 1; week <= totalWeeks; week++) {
  const [start, end] = getWeekRange(year, week);

  // Format dates
  const startStr = start.toISOString().slice(0, 10);
  const endStr = end.toISOString().slice(0, 10);

  const pages = dv
    .pages('"Cards/Clippings"')
    .where(
      p =>
        p["read-date"] &&
        new Date(p["read-date"]) >= start &&
        new Date(p["read-date"]) <= end &&
        p.summary
    );

  if (pages.length > 0) {
    dv.header(3, `Week ${week}: ${startStr} to ${endStr}`);
    for (let page of pages.sort(p => p["read-date"], "desc")) {
      const link = `[${page.file.name}](${page.source})`;
      dv.paragraph(`${link}`);
      dv.paragraph(`${page.summary}`);
    }
  }
}