Improve metadata markup

This commit is contained in:
2019-01-11 16:13:11 +00:00
parent 4bc196ad7b
commit 14de3f46ad
6 changed files with 183 additions and 135 deletions

View File

@@ -6,6 +6,7 @@
.content h6 { .content h6 {
font-family: var(--heading-font-family); font-family: var(--heading-font-family);
margin-bottom: var(--space-sm); margin-bottom: var(--space-sm);
color: var(--color-dark-blue);
} }
.content h1 { .content h1 {

View File

@@ -28,24 +28,23 @@
} }
} }
.excerpt__title, .excerpt__title {
.excerpt__subtitle {
font-size: var(--size-heading-6); font-size: var(--size-heading-6);
} }
.excerpt__subtitle { .excerpt__list {
margin-top: var(--space-sm);
}
.excerpt__metadata {
color: var(--color-grey); color: var(--color-grey);
font-size: var(--size-body-extra-small); font-size: var(--size-body-extra-small);
margin-bottom: var(--space-sm); margin-bottom: var(--space-sm);
} }
.excerpt__list-item {
display: inline-block;
margin-bottom: var(--space-xs);
}
.excerpt__icon, .excerpt__icon,
.excerpt__text { .excerpt__text {
display: inline-block;
vertical-align: middle; vertical-align: middle;
} }
@@ -54,14 +53,39 @@
} }
.excerpt__text { .excerpt__text {
margin: 0 15px 0 5px; margin: 0 var(--space-sm) 0 var(--space-xxs);
} }
.excerpt__audio { .excerpt__audio {
display: block;
margin-bottom: var(--space-sm); margin-bottom: var(--space-sm);
} }
.excerpt__image { .excerpt__image {
height: 200px; height: 200px;
margin-bottom: var(--space-sm);
}
.excerpt__links {
font-size: var(--size-body-extra-small);
margin-bottom: var(--space-sm);
}
.excerpt__link {
display: inline;
}
.excerpt__link:not(:last-child) {
position: relative;
margin-right: var(--space-xs);
padding-right: var(--space-xs);
}
.excerpt__link:not(:last-child):after {
content: "";
position: absolute;
top: 2px;
bottom: 2px;
right: 1px;
width: 2px;
background-color: var(--color-light-blue);
} }

View File

@@ -1,18 +1,9 @@
.metadata { .metadata {
display: flex;
flex-flow: row wrap;
font-size: var(--size-body-extra-small); font-size: var(--size-body-extra-small);
margin-bottom: var(--space-sm); margin-bottom: var(--space-sm);
border-bottom: 1px solid var(--color-light-grey); border-bottom: 1px solid var(--color-light-grey);
} }
.metadata__item {
display: flex;
align-items: center;
margin: 0 var(--space-sm) var(--space-sm) 0;
color: var(--color-dark-blue);
}
@media (--viewport-md) { @media (--viewport-md) {
.metadata { .metadata {
margin-bottom: var(--space-md); margin-bottom: var(--space-md);
@@ -21,13 +12,8 @@
@media (--viewport-lg) { @media (--viewport-lg) {
.metadata { .metadata {
flex-flow: column wrap;
border-bottom: none; border-bottom: none;
} }
.metadata__item {
margin-right: 0;
}
} }
@media (--viewport-lg) and (min-height: 540px) { @media (--viewport-lg) and (min-height: 540px) {
@@ -36,14 +22,37 @@
} }
} }
.metadata__item--light { .metadata__list {
display: flex;
flex-flow: row wrap;
}
@media (--viewport-lg) {
.metadata__list {
flex-flow: column wrap;
}
}
.metadata__list-item {
display: flex;
align-items: center;
margin: 0 var(--space-sm) var(--space-sm) 0;
}
@media (--viewport-lg) {
.metadata__list-item {
margin-right: 0;
}
}
.metadata__list-item--light {
color: var(--color-grey); color: var(--color-grey);
display: none; display: none;
margin-bottom: var(--space-sm); margin-bottom: var(--space-sm);
} }
@media (--viewport-lg) { @media (--viewport-lg) {
.metadata__item--light { .metadata__list-item--light {
display: block; display: block;
} }
} }

View File

@@ -13,30 +13,36 @@ global $excerpt;
<?php echo $excerpt['content'] ?> <?php echo $excerpt['content'] ?>
</div> </div>
<div class="excerpt__foot"> <div class="excerpt__foot">
<p class="excerpt__metadata"> <ul class="excerpt__list">
<span class="excerpt__icon"> <li class="excerpt__list-item">
<svg class="icon icon--extra-small" aria-hidden="true"> <span class="excerpt__icon">
<use xlink:href="#icon-profile"></use> <svg class="icon icon--extra-small" aria-hidden="true">
</svg> <use xlink:href="#icon-profile"></use>
</span> </svg>
<span class="excerpt__text"><?php echo $excerpt['author'] ?></span> </span>
<span class="excerpt__icon"> <span class="excerpt__text"><?php echo $excerpt['author'] ?></span>
<svg class="icon icon--extra-small" aria-hidden="true"> </li>
<use xlink:href="#icon-calendar"></use> <li class="excerpt__list-item">
</svg> <span class="excerpt__icon">
</span> <svg class="icon icon--extra-small" aria-hidden="true">
<span class="excerpt__text"><?php echo $excerpt['date'] ?></span> <use xlink:href="#icon-calendar"></use>
<span class="excerpt__icon"> </svg>
<svg class="icon icon--extra-small" aria-hidden="true"> </span>
<use xlink:href="#icon-comments"></use> <span class="excerpt__text"><?php echo $excerpt['date'] ?></span>
</svg> </li>
</span> <li class="excerpt__list-item">
<span class="excerpt__text"> <span class="excerpt__icon">
<?php <svg class="icon icon--extra-small" aria-hidden="true">
$number = $excerpt['comments']; <use xlink:href="#icon-comments"></use>
echo $number === '1' ? '1 comment' : $number . ' comments'; </svg>
?> </span>
</span> <span class="excerpt__text">
</p> <?php
$number = $excerpt['comments'];
echo $number === '1' ? '1 comment' : $number . ' comments';
?>
</span>
</li>
</ul>
</div> </div>
</div> </div>

View File

@@ -1,74 +1,76 @@
<section class="metadata"> <section class="metadata">
<div class="metadata__item metadata__item--light"> <ul class="metadata__list">
<span class="metadata__icon"> <li class="metadata__list-item metadata__list-item--light">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-calendar"></use>
</svg>
</span>
<span class="metadata__text">
<?php the_time(get_option('date_format')) ?>
</span>
</div>
<?php if (is_user_logged_in()): ?>
<div class="metadata__item">
<a class="metadata__link" href="<?php echo get_edit_post_link() ?>">
<span class="metadata__icon"> <span class="metadata__icon">
<svg class="icon" aria-hidden="true"> <svg class="icon" aria-hidden="true">
<use xlink:href="#icon-edit"></use> <use xlink:href="#icon-calendar"></use>
</svg> </svg>
</span> </span>
<span class="metadata__text"> <span class="metadata__text">
Edit post <?php the_time(get_option('date_format')) ?>
</span> </span>
</a> </li>
</div> <?php if (is_user_logged_in()): ?>
<?php endif; ?> <li class="metadata__list-item">
<div class="metadata__item"> <a class="metadata__link" href="<?php echo get_edit_post_link() ?>">
<a class="metadata__link" href="<?php the_permalink() ?>#comments"> <span class="metadata__icon">
<span class="metadata__icon"> <svg class="icon" aria-hidden="true">
<svg class="icon" aria-hidden="true"> <use xlink:href="#icon-edit"></use>
<use xlink:href="#icon-comments"></use> </svg>
</svg> </span>
</span> <span class="metadata__text">
<span class="metadata__text"> Edit post
<?php comments_number(); ?> </span>
</span>
</a>
</div>
<div class="metadata__item">
<span class="metadata__icon">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-tag"></use>
</svg>
</span>
<span class="metadata__text">
<?php windycoys_the_tags() ?>
</span>
</div>
<div class="metadata__item">
<div
class="fb-share-button"
data-href="<?php echo get_the_permalink() ?>"
data-layout="box_count"
data-size="small"
data-mobile-iframe="false"
>
<a
target="_blank"
href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fplugins%2F&amp;src=sdkpreparse"
class="fb-xfbml-parse-ignore"
>
Share
</a> </a>
</li>
<?php endif; ?>
<li class="metadata__list-item">
<a class="metadata__link" href="<?php the_permalink() ?>#comments">
<span class="metadata__icon">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-comments"></use>
</svg>
</span>
<span class="metadata__text">
<?php comments_number(); ?>
</span>
</a>
</li>
<li class="metadata__list-item">
<span class="metadata__icon">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-tag"></use>
</svg>
</span>
<span class="metadata__text">
<?php windycoys_the_tags() ?>
</span>
</div> </div>
</div> <li class="metadata__list-item">
<div class="metadata__item"> <div
<a class="fb-share-button"
class="twitter-share-button" data-href="<?php echo get_the_permalink() ?>"
href="<?php echo windycoys_get_twitter_share_url() ?>" data-layout="box_count"
data-url="<?php echo get_the_permalink() ?>" data-size="small"
> data-mobile-iframe="false"
Tweet >
</a> <a
</div> target="_blank"
href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fplugins%2F&amp;src=sdkpreparse"
class="fb-xfbml-parse-ignore"
>
Share
</a>
</div>
</li>
<li class="metadata__list-item">
<a
class="twitter-share-button"
href="<?php echo windycoys_get_twitter_share_url() ?>"
data-url="<?php echo get_the_permalink() ?>"
>
Tweet
</a>
</li>
</ul>
</section> </section>

View File

@@ -8,7 +8,7 @@ $artwork = get_template_directory_uri().'/images/'.$podcast['id'].'.png';
class="excerpt__image" class="excerpt__image"
title="<?php echo $podcast['podcast_title'] ?>" title="<?php echo $podcast['podcast_title'] ?>"
src="<?php echo $artwork ?>"> src="<?php echo $artwork ?>">
<h3 class="excerpt__subtitle"> <h3 class="excerpt__title">
<a class="link" href="<?php echo $podcast['url'] ?>"> <a class="link" href="<?php echo $podcast['url'] ?>">
<?php echo $podcast['title'] ?> <?php echo $podcast['title'] ?>
</a> </a>
@@ -21,24 +21,30 @@ $artwork = get_template_directory_uri().'/images/'.$podcast['id'].'.png';
<audio class="excerpt__audio" src="<?php echo $podcast['audio'] ?>" controls="true"> <audio class="excerpt__audio" src="<?php echo $podcast['audio'] ?>" controls="true">
Your browser does not support the <code>audio</code> element. Your browser does not support the <code>audio</code> element.
</audio> </audio>
<p class="excerpt__metadata"> <ul class="excerpt__links">
<a <li class="excerpt__link">
class="link" <a
href="<?php echo $podcast['audio'] ?>" class="link"
title="Download the MP3"> href="<?php echo $podcast['audio'] ?>"
Download MP3 title="Download the MP3">
</a> | Download MP3
<a class="link" href="<?php echo $podcast['podcast_episodes'] ?>"> </a>
More episodes </li>
</a> <li class="excerpt__link">
</p> <a class="link" href="<?php echo $podcast['podcast_episodes'] ?>">
<p class="excerpt__metadata"> More episodes
<span class="excerpt__icon"> </a>
<svg class="icon icon--extra-small" aria-hidden="true"> </li>
<use xlink:href="#icon-calendar"></use> </ul>
</svg> <ul class="excerpt__list">
</span> <li class="excerpt__list-item">
<span class="excerpt__text"><?php echo $podcast['date'] ?></span> <span class="excerpt__icon">
</p> <svg class="icon icon--extra-small" aria-hidden="true">
<use xlink:href="#icon-calendar"></use>
</svg>
</span>
<span class="excerpt__text"><?php echo $podcast['date'] ?></span>
</li>
</ul>
</div> </div>
</div> </div>