pagefind_dcd{"url":"/blog/links-page-reborn.html","content":"tinyapps.org / blog. Links page reborn. The Links page, fallow since 2006, has been resurrected as a stream of periodic headlines. Not enough to justify an RSS feed, but an occasional scroll may surface something of interest. This Python script makes posting fairly frictionless while allowing for editing of existing entries (updated to include permalinks and handle HTML entities): import os import html from datetime import datetime FILENAME = os.path.join('..', 'website', 'links.html.html') BEGIN_MARKER = \"\" END_MARKER = \"\" def get_today_anchor(): return datetime.now().strftime(\"%Y%m%d\") def get_today_date_display(): return datetime.now().strftime(\"%b %-d, %Y\") def get_today_header(): date_display = get_today_date_display() anchor = get_today_anchor() return f'
{date_display} #
' def prompt_for_link(): title = input(\"Title: \").strip() url = input(\"Link: \").strip() return title, url def format_link_li(title, url): escaped_title = html.escape(title) escaped_url = html.escape(url, quote=True) return f' {escaped_title}\\n' def update_links_section(existing_section, title, url): today_header = get_today_header() link_line = format_link_li(title, url).rstrip() lines = existing_section.strip().splitlines() new_lines = [] i = 0 inserted = False while i < len(lines): line = lines[i] if line.strip() == today_header: new_lines.append(line) i += 1 if i < len(lines) and lines[i].strip() == \"\": new_lines.append(\"\") new_lines.append(link_line) i += 1 while i < len(lines) and lines[i].strip() != \"
\": new_lines.append(lines[i].rstrip()) i += 1 new_lines.append(\"
\") if i < len(lines): i += 1 # Skip inserted = True break else: new_lines.append(line.rstrip()) i += 1 if not inserted: # Prepend a new section new_section = [ today_header, \"\" ] new_lines = new_section + new_lines # Add back any remaining unprocessed lines new_lines += [line.rstrip() for line in lines[i:]] return \"\\n\".join(new_lines) def insert_link(title, url): if not os.path.exists(FILENAME): print(f\"{FILENAME} not found. Please create it and include the markers:\\n{BEGIN_MARKER} ... {END_MARKER}\") return with open(FILENAME, 'r') as f: html_content = f.read() if BEGIN_MARKER not in html_content or END_MARKER not in html_content: print(f\"Error: markers '{BEGIN_MARKER}' and '{END_MARKER}' must be in {FILENAME}\") return # Extract everything between and around the markers pre, middle = html_content.split(BEGIN_MARKER, 1) content, post = middle.split(END_MARKER, 1) updated_links_html = update_links_section(content, title, url) new_html = ( f\"{pre}{BEGIN_MARKER}\\n\" f\"{updated_links_html.strip()}\\n\" f\"{END_MARKER}{post}\" ) with open(FILENAME, 'w') as f: f.write(new_html) print(f\"Link added to {FILENAME}\") # --- Run the script --- if __name__ == \"__main__\": title, url = prompt_for_link() insert_link(title, url) Updates. Links will be moved to a monthly digest blog post for RSS subscribers. To avoid link rot, the Links page will once again be mothballed, with even brief links added directly to the blog. ❧ 2025-07-30.","word_count":394,"filters":{},"meta":{"title":"Links page reborn"},"anchors":[]}