Create filter hooks on post save and publish that provide access to the entire post array
|Reported by:||Justinsomnia||Owned by:||markjaquith|
Title-less blog posts are common in linklogs (aka asides). Currently WordPress does not generate titles for these types of posts, which has two implications:
- nonexistent titles appear in feeds, which break some aggregators that rely on the existence of a title to link back to the post
- post_names (aka slugs) get generated based on the post ID, creating human-unreadable permalinks, e.g. http://example.org/2007/02/4201/
- Blogger uses the first 32ish characters of the post for the post_title and post_name, without breaking a word in half
- Jason Kottke generates a post_title based on the first 70ish characters of his post, without breaking words, adding ellipsis to titles that were based on truncated content. Note: the generated title is only visible in his feed.
- I'm not sure what MT does
I propose that WordPress generate a title for title-less posts, at the moment the post is published (similar to how a post_name is generated) based on the first 100 characters of the post_content (excepting html tags).
This generated title would then be the basis for the post_name. In the event that 100 characters falls in the middle of a word, that word would not be included in the generated title. For all titles generated from content greater than 100 characters in length, 3 periods (...) will be added to the end of the title (aka an ellipsis) which wptexturize will later translate into a ellipsis entity.
I've implemented this as a function called generate_title_from_content(), see attached patch.
Change History (27)
- Owner changed from anonymous to markjaquith
- Status changed from new to assigned
- Summary changed from Generate post_title based on post_content to Create filter hooks on post save and publish that provide access to the entire post array