Skip to content

Commit

Permalink
Improve link posts in archive listings
Browse files Browse the repository at this point in the history
- Remove `target="_blank"` anti-pattern
- If link post point title to source article
- Switch star icon to a link to indicate "permalink" and markup semantically with `rel="permalink"`
- Reduce opacity of permalink icon
- Adjust hover styles due to shuffling around <a> element
- Close #276
  • Loading branch information
mmistakes committed Jul 11, 2016
1 parent dfa94b8 commit a6a5565
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 25 deletions.
52 changes: 29 additions & 23 deletions _includes/archive-single.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,35 @@
{% capture teaser %}{{ site.teaser }}{% endcapture %}
{% endif %}

{% if post.id %}
{% assign title = post.title | markdownify | remove: "<p>" | remove: "</p>" %}
{% else %}
{% assign title = post.title %}
{% endif %}

<div class="{{ include.type | default: "list" }}__item">
{% if post.link %}
<a href="{{ post.link }}" target="_blank">
{% else %}
<a href="{{ base_path }}{{ post.url }}">
{% endif %}
<article class="archive__item" itemscope itemtype="http://schema.org/CreativeWork">
{% if include.type == "grid" and teaser != blank %}
<div class="archive__item-teaser">
<img src=
{% if teaser contains "://" %}
"{{ teaser }}"
{% else %}
"{{ teaser | prepend: "/images/" | prepend: base_path }}"
{% endif %}
alt="">
</div>
{% endif %}
<h2 class="archive__item-title" itemprop="headline">{% if post.id %}{{ post.title | markdownify | remove: "<p>" | remove: "</p>" }}{% else %}{{ post.title }}{% endif %}{% if post.link %}<i class="fa fa-star" aria-hidden="true"></i>{% endif %}</h2>
{% if post.read_time %}
<p class="page__meta"><i class="fa fa-clock-o" aria-hidden="true"></i> {% include read-time.html %}</p>
<article class="archive__item" itemscope itemtype="http://schema.org/CreativeWork">
{% if include.type == "grid" and teaser != blank %}
<div class="archive__item-teaser">
<img src=
{% if teaser contains "://" %}
"{{ teaser }}"
{% else %}
"{{ teaser | prepend: "/images/" | prepend: base_path }}"
{% endif %}
alt="">
</div>
{% endif %}
<h2 class="archive__item-title" itemprop="headline">
{% if post.link %}
<a href="{{ post.link }}">{{ title }}</a> <a href="{{ base_path }}{{ post.url }}" rel="permalink"><i class="fa fa-link" aria-hidden="true" title="permalink"></i><span class="sr-only">Permalink</span></a>
{% else %}
<a href="{{ base_path }}{{ post.url }}" rel="permalink">{{ title }}</a>
{% endif %}
{% if post.excerpt %}<p class="archive__item-excerpt" itemprop="description">{{ post.excerpt | markdownify | strip_html | truncate: 160 }}</p>{% endif %}
</article>
</a>
</h2>
{% if post.read_time %}
<p class="page__meta"><i class="fa fa-clock-o" aria-hidden="true"></i> {% include read-time.html %}</p>
{% endif %}
{% if post.excerpt %}<p class="archive__item-excerpt" itemprop="description">{{ post.excerpt | markdownify | strip_html | truncate: 160 }}</p>{% endif %}
</article>
</div>
6 changes: 5 additions & 1 deletion assets/_scss/_archive.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
.archive__item-title {
margin-bottom: 0.25em;
font-family: $sans-serif-narrow;

a + a {
opacity: 0.5;
}
}

// remove border
Expand Down Expand Up @@ -63,7 +67,7 @@
}
}

a:hover {
.archive__item:hover {
.archive__item-teaser {
box-shadow: 0 0 10px rgba(#000, 0.25);
}
Expand Down
2 changes: 1 addition & 1 deletion assets/css/main.css

Large diffs are not rendered by default.

0 comments on commit a6a5565

Please sign in to comment.