Login

Tag "shauninman"

Snippet List

Avoid widows using a template filter

**Support good typography! Avoid widows! ** "Widows" are single words that end up on their own line, thanks to automatic line-breaks. This is an no-no in graphic design, and is especially unsightly in headers and other short bursts of text. This filter automatically replaces the space before the last word of the passed value with a non-breaking space, ensuring there is always at least two words on any given line. Usage is like so: {{ blog.entry.headline|widont }} It's a simple tag, but good typography is one of the hallmarks of a well-designed site that separates it from amateurish counterparts. Note: The idea and name "widont" is copped directly from [Shaun Inman](http://shauninman.com), who wrote a [similar feature for WordPress](http://www.shauninman.com/archive/2006/08/22/widont_wordpress_plugin).

  • filter
  • widows
  • templatetag
  • typography
  • shauninman
  • widont
Read More

1 snippet posted so far.