Override author details per post

- Fixes #70
This commit is contained in:
Michael Rose 2014-06-19 15:34:03 -04:00
parent b690ee197a
commit 3ebe915e2d
4 changed files with 33 additions and 1 deletions

View file

@ -10,7 +10,9 @@
<meta name="twitter:image" content="{% if page.image.thumb %}{{ site.url }}/images/{{ page.image.thumb }}{% else %}{{ site.url }}/images/{{ site.logo }}{% endif %}">{% endif %}
<meta name="twitter:title" content="{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}">
<meta name="twitter:description" content="{% if page.description %}{{ page.description }}{% else %}{{ site.description }}{% endif %}">
<meta name="twitter:creator" content="@{{ site.owner.twitter }}">{% endif %}
<meta name="twitter:site" content="@{{ site.owner.twitter }}">
{% if page.author.twitter %}<meta name="twitter:creator" content="@{{ page.author.twitter }}">{% endif %}
{% endif %}
<!-- Open Graph -->
<meta property="og:locale" content="en_US">

View file

@ -24,8 +24,13 @@
{% endif %}
</header>
<footer class="entry-meta">
{% if page.author.name %}
<img src="{{ site.url }}/images/{{ page.author.avatar }}" alt="{{ page.author.name }} photo" class="author-photo">
<span class="author vcard">By <span class="fn">{{ page.author.name }}</span></span>
{% else %}
<img src="{{ site.url }}/images/{{ site.owner.avatar }}" alt="{{ site.owner.name }} photo" class="author-photo">
<span class="author vcard">By <span class="fn"><a href="{{ site.url }}/about/" title="About {{ site.owner.name }}">{{ site.owner.name }}</a></span></span>
{% endif %}
<span class="entry-date date published"><time datetime="{{ page.date | date_to_xmlschema }}"><i class="icon-calendar-empty"></i> {{ page.date | date: "%B %d, %Y" }}</time></span>
{% if page.modified %}<span class="entry-date date modified"><time datetime="{{ page.modified }}"><i class="icon-pencil"></i> {{ page.modified | date: "%B %d, %Y" }}</time></span>{% endif %}
{% if site.disqus_shortname and page.comments %}<span class="entry-comments"><i class="icon-comment-alt"></i> <a href="#disqus_thread">Comment</a></span>{% endif %}

View file

@ -0,0 +1,25 @@
---
layout: post
title: "Override Author Byline Test Post"
description: "An article to test overriding the default site author."
category: articles
tags: [sample post, readability, test]
author:
name: Billy Rick
avatar: bio-photo-alt.jpg
comments: true
share: true
---
For those of you who may have content written by multiple authors on your site, here's a new feature I added to So Simple.
Traditionally you would assign a global author for the entire site and those attributes would be used in all post bylines, social networking links in the footer, Twitter Cards, and Google Authorship. These `owner` variables still work the same way when set in your `config.yml`, but now if you add an author variable to a post's YAML front matter, you can override a post's author byline.
Let's say we have an author Billy Rick --- he wrote this post and we want his name and photo to appear on the page instead of whoever the default site author is. To do so we'd add the following YAML front matter.
``` yaml
author:
name: Billy Rick
avatar: billy-photo.jpg #place in /images
twitter: billyrick #marked as a creator for Twitter Card links
```

BIN
images/bio-photo-alt.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB