Urgent.News

What's breaking now, across thousands of outlets.

Tech

Slug Generator: Cleaning Apostrophes, Ampersands and Trailing Hyphens Out of My Blog URLs

Slug Generator: Cleaning Apostrophes, Ampersands and Trailing Hyphens Out of My Blog URLs Last month I moved 312 posts from an old WordPress site to Eleventy. The CMS export gave me titles exactly as the editors typed them: "We're Open — 20% Off This Week & Next", "Don't Panic: A Developer's Guide to Production". My one-liner title.lower().replace(" ", "-") deployed without a single error and…

Moving 312 blog posts from an old WordPress site to Eleventy required cleaning up URLs that contained apostrophes, ampersands, trailing hyphens, and other characters. Last month, the CMS export provided titles exactly as they were typed by editors, which sometimes contained special characters such as —, & and !. To address these issues, the author experimented with three different methods to generate clean slugs for the blog posts.

Method 1: Python used the python-slugify library (version 8.0.0) to generate slugs by normalizing the text using NFKD encoding, removing non-ASCII characters, and replacing unwanted characters with hyphens. This approach handled collisions by appending the post ID to the slug. The resulting slugs were clean, with no curly apostrophes, em dashes, or other special characters. The author discovered that stripping trailing hyphens and using the lower() method contributed to generating a robust set of slugs.

Method 2: Node.js implemented the slugify package (version 1.6.6) to generate slugs from the exported CSV file. The strict flag was enabled to prevent the inclusion of percent-encoded characters like %, &, and @ in the final URLs. This method yielded identical slugs to the Python approach, confirming the reliability of the chosen slugification method.

Method 3: For quick fixes in the browser, the author utilized an online slug generator to generate URLs for one-off titles. This method flagged issues such as double hyphens and allowed for manual adjustments before publishing. However, the author highlighted three potential pitfalls: handling duplicate apostrophes, trailing hyphens, and ensuring that slugs did not contain any characters that might be percent-encoded, as this would result in multiple URLs for the same content.

By employing strict slugification and careful punctuation removal, the author was able to maintain a consistent and clean URL structure across all blog posts.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Wabi's Home-Screen Widgets: Your Mini-Apps, One Glance Away

Disclosure: I run Wabi Wiki, an unofficial guide to the Wabi AI assistant — not affiliated with Wabi. Most AI assistants live inside an app you have to open.

  • Wabi AI assistant introduces home-screen widgets for mini-apps.
  • Widgets provide quick access to trip countdowns, habit trackers, and daily priorities.
  • Widgets update based on the mini-app's information, ensuring privacy.

Online Learning Search: Chunk Boundaries for Grounded Tutor Answers

Short answer Short answer: use structure-aware, overlapping chunks, then rerank with section and lesson metadata before an answer is generated.

  • Use structure-aware, overlapping chunks for online course tutors.
  • Maintain three boundaries: source document span, instructional unit, and retrieval text.
  • Test policy against real questions before tuning boundary sizes.

Apache Zeppelin: Notebook Exposure Starts With the Wrong Assumption

Apache Zeppelin: Notebook Exposure Starts With the Wrong Assumption Apache Zeppelin is often described by what users see: a notebook interface for interactive data work.

  • Apache Zeppelin often perceived as simple notebook app
  • 25,613 assets labeled as Apache Zeppelin, 0 exact title matches
  • Defenders should assess authentication, storage, interpreters, policies

title: Python Day 1 – Why Python, and What Even Is It?

So I started a Python course, and I'm going to write down what I learn each day here. Mostly for me, but maybe it helps someone else too. What is Python?

  • Python is a high-level, general-purpose programming language
  • Created in 1991, Python 3 released in 2008
  • Python used in data science, web development, and automation

PDF Invoice Template Recovery: 3 Audit Records Across Layout Changes

Choose the layout owner before designing recovery: keep invoice HTML in the repository when engineers change it, and choose a stored template when finance needs to edit it without a deploy.

  • Store original scan, OCR result, and final PDF as separate artifacts
  • Associate each invoice with exact layout revision used
  • Utilize Infrai REST API for storage-to-document processing

More from Saturday 14 November →