Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Move away from using `<article>` for non-syndcated content #172

Merged
merged 4 commits into from

4 participants

@obenland
Owner

From the spec about sections:

Authors are encouraged to use the article element instead of the section element when it would make sense to syndicate the contents of the element.

Instances where it does not make sense to syndicate the content, sections should be used. Out of the box, only posts and comments are syndicated.

Please let me know what you think of the class name changes and whether they make sense in the current proposal.

@mfields

I that that we should leave the entry-content class intact.

  • More times than not, pages receive similar styling to the standard post format.
  • The word entry is post-type agnostic, which I think is great.
  • Distinction between posts and pages can be obtained via post or body class.
@obenland
Owner

I agree

@sixhours
Owner

This makes perfect sense to me.

@ianstewart
Owner

+1 to @mfields' comments.

@obenland
Owner

@mfields Does that only go for content-page.php then? The rest are no posts of any kind.

@mfields

Hmmm, good question. I think that the entry- prefix definitely makes sense for content stored in the posts table in the database. Retaining it in these two templates makes sense to me:

  • content-page.php
  • image.php

While 404.php and no-results.php are not technically entries, as defined above, they are so closely related that I think that it makes sense to retain the entry- prefix for them as well. no-results.php is intended to display in the absense of an entry and 404.php

@obenland
Owner

While 404.php and no-results.php are not technically entries, as defined above, they are so closely related that I think that it makes sense to retain the entry- prefix for them as well. no-results.php is intended to display in the absense of an entry and 404.php

But they won't display as an entry. The page- prefix is not entirely new, we already use it in archives and search templates. TBH, I see 404 and no-result templates more related to those than to entries.

@mfields

But they won't display as an entry.

Display is best left to css. For the markup I think that they can be viewed as "entries". The only difference is that in normal posts and pages the entry content comes from the database and in these templates it is hardcoded.

The page- prefix is not entirely new, we already use it in archives and search templates. TBH, I see 404 and no-result templates more related to those than to entries.

When used in the context of archives and search template, I've always considered elements with this prefix to refer to the collection of posts displayed in the loop. For instance: The "page title" in theme template would serve as a title identifying the collection of posts below it.

I think that there is a broader idea here that lies a bit outside the scope of "Move away from using <article> for non-syndcated content" which is: "Should 404 and no results templates display as entries or unique elements". I believe that this decision is best tackled on a theme-by-theme basis. If we leave the entry prefix for these two templates then we are helping out theme authors that forget to style them. In cases where a theme author chooses to have a fancy 404 template, they can enhance the template.

@obenland
Owner

If we leave the entry prefix for these two templates then we are helping out theme authors that forget to style them.

Let's add the .page-content class to style.css then, here for example.

I would be bummed if we'd compromise the semantic improvement for comfort. Also, FWIW, it'll be introduced in Twenty Thirteen - _s would a) not be the first theme to go that route and b) help set and promote good standards.

As far as I can see, that is the only issue holding up this PR, right?
What do you (all) think about it?

@obenland obenland merged commit 629acfc into from
@obenland obenland deleted the branch
@obenland obenland removed the Suggest Merge label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 18 additions and 18 deletions.
  1. +7 −7 404.php
  2. +2 −2 content-page.php
  3. +2 −2 image.php
  4. +7 −7 no-results.php
View
14 404.php
@@ -11,12 +11,12 @@
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
- <article id="post-0" class="post error404 not-found">
- <header class="entry-header">
- <h1 class="entry-title"><?php _e( 'Oops! That page can&rsquo;t be found.', '_s' ); ?></h1>
- </header><!-- .entry-header -->
+ <section class="error-404 not-found">
+ <header class="page-header">
+ <h1 class="page-title"><?php _e( 'Oops! That page can&rsquo;t be found.', '_s' ); ?></h1>
+ </header><!-- .page-header -->
- <div class="entry-content">
+ <div class="page-content">
<p><?php _e( 'It looks like nothing was found at this location. Maybe try one of the links below or a search?', '_s' ); ?></p>
<?php get_search_form(); ?>
@@ -38,8 +38,8 @@
<?php the_widget( 'WP_Widget_Tag_Cloud' ); ?>
- </div><!-- .entry-content -->
- </article><!-- #post-0 .post .error404 .not-found -->
+ </div><!-- .page-content -->
+ </section><!-- .error404 .not-found -->
</div><!-- #content .site-content -->
</div><!-- #primary .content-area -->
View
4 content-page.php
@@ -7,7 +7,7 @@
*/
?>
-<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+<section id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<h1 class="entry-title"><?php the_title(); ?></h1>
</header><!-- .entry-header -->
@@ -17,4 +17,4 @@
<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', '_s' ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
<?php edit_post_link( __( 'Edit', '_s' ), '<footer class="entry-meta"><span class="edit-link">', '</span></footer>' ); ?>
-</article><!-- #post-<?php the_ID(); ?> -->
+</section><!-- #post-<?php the_ID(); ?> -->
View
4 image.php
@@ -14,7 +14,7 @@
<?php while ( have_posts() ) : the_post(); ?>
- <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+ <section id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<h1 class="entry-title"><?php the_title(); ?></h1>
@@ -107,7 +107,7 @@
<?php endif; ?>
<?php edit_post_link( __( 'Edit', '_s' ), ' <span class="edit-link">', '</span>' ); ?>
</footer><!-- .entry-meta -->
- </article><!-- #post-<?php the_ID(); ?> -->
+ </section><!-- #post-<?php the_ID(); ?> -->
<?php
// If comments are open or we have at least one comment, load up the comment template
View
14 no-results.php
@@ -9,12 +9,12 @@
*/
?>
-<article id="post-0" class="post no-results not-found">
- <header class="entry-header">
- <h1 class="entry-title"><?php _e( 'Nothing Found', '_s' ); ?></h1>
- </header><!-- .entry-header -->
+<section class="no-results not-found">
+ <header class="page-header">
+ <h1 class="page-title"><?php _e( 'Nothing Found', '_s' ); ?></h1>
+ </header><!-- .page-header -->
- <div class="entry-content">
+ <div class="page-content">
<?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
<p><?php printf( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', '_s' ), esc_url( admin_url( 'post-new.php' ) ) ); ?></p>
@@ -30,5 +30,5 @@
<?php get_search_form(); ?>
<?php endif; ?>
- </div><!-- .entry-content -->
-</article><!-- #post-0 .post .no-results .not-found -->
+ </div><!-- .page-content -->
+</section><!-- .no-results .not-found -->
Something went wrong with that request. Please try again.