posativ / acrylamid

(unmaintained) static blog generator in python with incremental rendering ⛺
http://posativ.org/acrylamid/
Other
277 stars 40 forks source link

Added an "sdescription" property to return only the entry description #212

Closed geekman closed 10 years ago

geekman commented 10 years ago

The current behavior of the description property automatically extracts the first 50 characters of the source, which may contain Markdown code instead of text. This also prevents the caller from distinguishing whether a description was explicitly set in the front matter.

Instead, sdescription returns an empty string if a description was not set, and allows the summary to be performed inside the template like so:

 <meta name="description" content="{{ content.sdescription or content.entry|striptags|summarize }}">

which guarantees proper text since content.entry is already processed HTML.

For lack of a better name, sdescription was chosen for "string description" because there was already imonth, iday, etc which I believe represents "integer something".

posativ commented 10 years ago

Yes, that sounds reasonable. The original description attribute does not work that well to be honest,