[wp-trac] [WordPress Trac] #3794: Generate post_title based on post_content

WordPress Trac wp-trac at lists.automattic.com
Thu Feb 15 08:05:48 GMT 2007


#3794: Generate post_title based on post_content
--------------------------+-------------------------------------------------
 Reporter:  Justinsomnia  |       Owner:  anonymous
     Type:  enhancement   |      Status:  new      
 Priority:  normal        |   Milestone:  2.2      
Component:  General       |     Version:  2.1      
 Severity:  normal        |    Keywords:           
--------------------------+-------------------------------------------------
 === Scenario ===
 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/}}}

 === Prior Art ===
  * Blogger uses the first 32ish characters of the post for the post_title
 and post_name, without breaking a word in half
  * [http://kottke.org/ 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 [http://feeds.kottke.org/main his
 feed].
  * I'm not sure what MT does

 === Proposal ===
 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.

 === Implementation ===
 I've implemented this as a function called
 {{{generate_title_from_content()}}}, see attached patch.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/3794>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list