Skip to content

Commit

Permalink
Added support for multiple authors out of the box. Authors' info is s…
Browse files Browse the repository at this point in the history
…pecified in the _config.yml. Post need `author` and `categories` to match the authors `username`.
  • Loading branch information
biomadeira committed Nov 17, 2017
1 parent 5a42803 commit ede3935
Show file tree
Hide file tree
Showing 21 changed files with 326 additions and 287 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ to the original theme. Besides, I have recently updated it to match the current
* Code Syntax Highlight with [highlight.js](https://highlightjs.org/) (New 06.04.2016)
* Rss updated to Jekyll 3.0 (New 06.04.2016)
* Updated to Casper v1.3.7 (same as v1.4.0 that runs in Ghost 1.0) **(New 17.11.2017)**
* 'Out of the box' support for Multiple Authors **(New 17.11.2017)**

## How to use it

Expand Down
51 changes: 42 additions & 9 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@ language: 'en-uk'
name: 'Finding The Way Home'
description: "A beautiful narrative written with the world's most elegant publishing platform. The story begins here."

# Author's info
author: 'Casper McFadden'
# edit 'categories' in the front matter of every post to match this username
nickname: casper
bio: 'A paranormal expert and his daughter bunk in an abandoned house populated by 3 mischievous ghosts and one friendly one.'
location: 'Maine, USA'
url: 'http://biomadeira.github.io/jasper/'
image: 'assets/images/casper.png'

short_url: 'biomadeira.github.io/jasper/'
google_analytics: UA-69281367-1
disqus: username
Expand All @@ -30,6 +21,48 @@ permalink: /:title
# permalink: /author/:username
# permalink: /tag/:tag

# Authors' info
authors:
casper:
username: casper
name: Casper McFadden
location: Maine, USA
url_full: http://biomadeira.github.io/jasper/
url: biomadeira.github.io/jasper
bio: A paranormal expert and his daughter bunk in an abandoned house populated by 3 mischievous ghosts and a friendly one, Casper.
assets: assets/images/casper.png
lewis:
username: lewis
name: Lewis Carroll
location: Cheshire, England
url_full: http://biomadeira.github.io/jasper/
url: biomadeira.github.io/jasper
bio: My real name is Charles Lutwidge Dodgson, but people call me Lewis. I'm an English writer, mathematician, logician, Anglican deacon and photographer. People know me best for writing about Alice.
assets: assets/images/lewis.jpeg
abraham:
username: abraham
name: Abraham Lincoln
location: Kentucky, USA
url_full: http://biomadeira.github.io/jasper/
url: biomadeira.github.io/jasper
bio: I was the 16th president of the USA until I was assassinated in April of 1963. I led the US through its Civil War - its bloodiest and greatest moral, constitutional and political crisis.
assets: assets/images/abraham.jpg
edgar:
username: edgar
name: Edgar Rice Burroughs
location: Chicago, Illinois
url_full: http://biomadeira.github.io/jasper/
url: biomadeira.github.io/jasper
bio: I'm an American novelist, best known for my work writing about a brave jungle hero called Tarzan and his muse, Jane.
assets: assets/images/edgar.gif
martin:
username: martin
name: Martin Luther King
location: Memphis, Tennessee
url_full: http://biomadeira.github.io/jasper/
url: biomadeira.github.io/jasper
bio: An American pastor, activist, humanitarian. People know me for leading the African-American Civil Rights movement using nonviolent civil disobedience.
assets: assets/images/martin.jpg

# gems and other configs
plugins: [jekyll-paginate]
Expand Down
19 changes: 13 additions & 6 deletions _includes/loop.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,25 @@ <h2 class="post-title"><a href="{{ site.baseurl }}{{ post.url | remove: '/' }}">
<p>{{ post.content | strip_html | truncatewords: 26 }} <a class="read-more" href="{{ site.baseurl }}{{ post.url | remove: '/' }}">&raquo;</a></p>
</section>
<footer class="post-meta">
{% if site.image %}<img class="author-thumb" src="{{ site.baseurl }}{{ site.image }}" alt="Author image" nopin="nopin" />{% endif %}
<!-- author -->
<a href='{{ site.baseurl }}author/{{ site.nickname }}'>{{ site.author }}</a>
{% for author in site.authors %}
{% if author[1].username == post.author %}

{% if author[1].assets %}<img class="author-thumb" src="{{ site.baseurl }}{{ author[1].assets }}" alt="Author image" nopin="nopin" />{% endif %}
<!-- author -->
<a href='{{ site.baseurl }}author/{{ post.author }}'>{{ author[1].name }}</a>

{% endif %}
{% endfor %}

<!-- [[tags prefix=" on "]] -->
{% if post.tags.size > 0 %}
on
{% if post.tags.size > 0 %}
on
{% for tag in post.tags %}
{% if forloop.index == post.tags.size %}
<a href='{{ site.baseurl }}tag/{{ tag }}'>{{ tag | capitalize }}</a>
{% else %}
<a href='{{ site.baseurl }}tag/{{ tag }}'>{{ tag | capitalize }}</a>,
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
<time class="post-date" datetime="{{ post.date | date:'%Y-%m-%d' }}">{{ post.date | date_to_string }}</time>
Expand Down
6 changes: 5 additions & 1 deletion _includes/navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ <h3 class="nav-title">Menu</h3>
<li class="nav-fables {% if page.url contains 'fables' %} nav-current{% endif %}" role="presentation"><a href="{{ site.baseurl }}tag/fables">Fables</a></li>
<li class="nav-speeches {% if page.url contains 'speeches' %} nav-current{% endif %}" role="presentation"><a href="{{ site.baseurl }}tag/speeches">Speeches</a></li>
<li class="nav-fiction {% if page.url contains 'fiction' %} nav-current{% endif %}" role="presentation"><a href="{{ site.baseurl }}tag/fiction">Fiction</a></li>
<li class="nav-author {% if page.current == 'author' %} nav-current{% endif %}" role="presentation"><a href="{{ site.baseurl }}author/casper">Author</a></li>
<li class="nav-author {% if page.url contains 'casper' %} nav-current{% endif %}" role="presentation"><a href="{{ site.baseurl }}author/casper">Casper</a></li>
<li class="nav-author {% if page.url contains 'edgar' %} nav-current{% endif %}" role="presentation"><a href="{{ site.baseurl }}author/edgar">Edgar</a></li>
<li class="nav-author {% if page.url contains 'abraham' %} nav-current{% endif %}" role="presentation"><a href="{{ site.baseurl }}author/abraham">Abraham</a></li>
<li class="nav-author {% if page.url contains 'martin' %} nav-current{% endif %}" role="presentation"><a href="{{ site.baseurl }}author/martin">Martin</a></li>
<li class="nav-author {% if page.url contains 'lewis' %} nav-current{% endif %}" role="presentation"><a href="{{ site.baseurl }}author/lewis">Lewis</a></li>
</ul>
<a class="subscribe-button icon-feed" href="{{ site.baseurl }}feed.xml">Subscribe</a>
</div>
Expand Down
36 changes: 21 additions & 15 deletions _layouts/author.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,27 @@
</header>

<section class="author-profile inner">
{% if site.image %}
<figure class="author-image">
<div class="img" style="background-image: url({{ site.baseurl }}{{ site.image }})"><span class="hidden">{{ site.author }}'s Picture</span></div>
</figure>
{% endif %}
<h1 class="author-title">{{ site.author }}</h1>
{% if site.bio %}
<h2 class="author-bio">{{ site.bio }}</h2>
{% endif %}
<div class="author-meta">
{% if site.location %}<span class="author-location icon-location">{{ site.location }}</span>{% endif %}
{% if site.url %}<span class="author-link icon-link"><a href="{{ site.url }}">{{ site.short_url }}</a></span>{% endif %}
<!-- <span class="author-stats"><i class="icon-stats"></i> [[plural ../pagination.total empty='No posts' singular='% post' plural='% posts']]</span> -->
<span class="author-stats"><i class="icon-stats"></i>{% if paginator.total_posts == 0 %}No posts{% elsif paginator.total_posts == 1 %}1 post{% else %}{{ paginator.total_posts }} posts{% endif %}</span>
</div>
{% for author in site.authors %}
{% if author[1].username == page.author %}
{% if author[1].assets %}
<figure class="author-image">
<div class="img" style="background-image: url({{ site.baseurl }}{{ author[1].assets }})"><span class="hidden">{{ author[1].name }}'s Picture</span></div>
</figure>
{% endif %}
<h1 class="author-title">{{ author[1].name }}</h1>
{% if author[1].bio %}
<div style="display:inline; text-align: justify; text-justify: inter-word;">
<h2 class="author-bio">{{ author[1].bio }}</h2>
</div>
{% endif %}
<div class="author-meta">
{% if author[1].location %}<span class="author-location icon-location">{{ author[1].location }}</span>{% endif %}
{% if author[1].url %}<span class="author-link icon-link"><a href="{{ author[1].url_full }}">{{ author[1].url }}</a></span>{% endif %}
<!-- <span class="author-stats"><i class="icon-stats"></i> [[plural ../pagination.total empty='No posts' singular='% post' plural='% posts']]</span> -->
<span class="author-stats"><i class="icon-stats"></i>{% if paginator.total_posts == 0 %}No posts{% elsif paginator.total_posts == 1 %}1 post{% else %}{{ paginator.total_posts }} posts{% endif %}</span>
</div>
{% endif %}
{% endfor %}
</section>
<!-- /author -->

Expand Down
4 changes: 1 addition & 3 deletions _layouts/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
{% if page.logo %}<a class="blog-logo" href="{{ site.baseurl }}"><img src="{{ site.baseurl }}{{ page.logo }}" alt="Blog Logo" /></a>{% endif %}
{% if page.navigation %}
<a class="menu-button icon-menu" href="#"><span class="word">Menu</span></a>
{{ include navigation.html }}
{% endif %}
</nav>
</header>
Expand All @@ -29,10 +28,9 @@ <h1 class="post-title">{{ page.title }}</h1>
</header>

<section class="post-content">
{{content}}
{{ content }}
</section>

</article>

</main>
<!-- /post -->
95 changes: 52 additions & 43 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
disqus: false
class: 'post-template'
---
<!-- < default -->
<!-- default -->

<!-- The comment above "< default" means - insert everything in this file into -->
<!-- the [body] of the default.hbs template, which contains our header/footer. -->
Expand All @@ -28,23 +28,29 @@
<h1 class="post-title">{{ page.title }}</h1>
<section class="post-meta">
<!-- <a href='{{ site.baseurl }}{{ page.about }}'>{{ site.author }}</a> -->

{% for author in site.authors %}
{% if author[1].username == page.author %}
<a href='{{ site.baseurl }}author/{{ page.author }}'>{{ author[1].name }}</a>
{% endif %}
{% endfor %}
<time class="post-date" datetime="{{ page.date | date:'%Y-%m-%d' }}">{{ page.date | date_to_string }}</time>
<!-- [[tags prefix=" on "]] -->
{% if page.tags.size > 0 %}
on
{% if page.tags.size > 0 %}
on
{% for tag in page.tags %}
{% if forloop.index == page.tags.size %}
<a href='{{ site.baseurl }}tag/{{ tag }}'>{{ tag | capitalize }}</a>
{% else %}
<a href='{{ site.baseurl }}tag/{{ tag }}'>{{ tag | capitalize }}</a>,
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
</section>
</header>

<section class="post-content">

{{ content }}

</section>
Expand All @@ -53,50 +59,53 @@ <h1 class="post-title">{{ page.title }}</h1>

<!-- Everything inside the #author tags pulls data from the author -->
<!-- #author-->

{% if site.image %}
<figure class="author-image">
<a class="img" href="{{ site.baseurl }}author/{{ site.nickname }}" style="background-image: url({{ site.baseurl }}{{ site.image }})"><span class="hidden">{{ page.author }}'s Picture</span></a>
</figure>
{% endif %}

<section class="author">
<h4><a href="{{ site.baseurl }}author/{{ site.nickname }}">{{ site.author }}</a></h4>

{% if site.bio %}
<p> {{ site.bio }}</p>
{% else %}
<p>Read <a href="{{ site.baseurl }}author/{{ site.nickname }}">more posts</a> by this author.</p>
{% for author in site.authors %}
{% if author[1].username == page.author %}
{% if author[1].assets %}
<figure class="author-image">
<a class="img" href="{{ site.baseurl }}author/{{ page.author }}" style="background-image: url({{ site.baseurl }}{{ author[1].assets }})"><span class="hidden">{{ page.author }}'s Picture</span></a>
</figure>
{% endif %}

<section class="author">
<h4><a href="{{ site.baseurl }}author/{{ page.author }}">{{ author[1].name }}</a></h4>

{% if author[1].bio %}
<p> {{ author[1].bio }}</p>
{% else %}
<p>Read <a href="{{ site.baseurl }}author/{{ page.author }}">more posts</a> by this author.</p>
{% endif %}
<div class="author-meta">
{% if author[1].location %}<span class="author-location icon-location"> {{ author[1].location }}</span>{% endif %}
{% if author[1].url %}<span class="author-link icon-link"><a href="{{ author[1].url_full }}"> {{ author[1].url }}</a></span>{% endif %}
</div>
</section>

<!-- /author -->

<section class="share">
<h4>Share this post</h4>
<a class="icon-twitter" href="http://twitter.com/share?text={{ page.title }}&amp;url={{ site.url }}{{ page.url | remove: '/' }}"
onclick="window.open(this.href, 'twitter-share', 'width=550,height=235');return false;">
<span class="hidden">Twitter</span>
</a>
<a class="icon-facebook" href="https://www.facebook.com/sharer/sharer.php?u={{ site.url }}{{ page.url | remove: '/' }}"
onclick="window.open(this.href, 'facebook-share','width=580,height=296');return false;">
<span class="hidden">Facebook</span>
</a>
<a class="icon-google-plus" href="https://plus.google.com/share?url={{ site.url }}{{ page.url | remove: '/' }}"
onclick="window.open(this.href, 'google-plus-share', 'width=490,height=530');return false;">
<span class="hidden">Google+</span>
</a>
</section>
{% endif %}
<div class="author-meta">
{% if site.location %}<span class="author-location icon-location"> {{ site.location }}</span>{% endif %}
{% if site.url %}<span class="author-link icon-link"><a href="{{ site.url }}"> {{ site.short_url }}</a></span>{% endif %}
</div>
</section>
{% endfor %}

<!-- /author -->

<section class="share">
<h4>Share this post</h4>
<a class="icon-twitter" href="http://twitter.com/share?text={{ page.title }}&amp;url={{ site.url }}{{ page.url | remove: '/' }}"
onclick="window.open(this.href, 'twitter-share', 'width=550,height=235');return false;">
<span class="hidden">Twitter</span>
</a>
<a class="icon-facebook" href="https://www.facebook.com/sharer/sharer.php?u={{ site.url }}{{ page.url | remove: '/' }}"
onclick="window.open(this.href, 'facebook-share','width=580,height=296');return false;">
<span class="hidden">Facebook</span>
</a>
<a class="icon-google-plus" href="https://plus.google.com/share?url={{ site.url }}{{ page.url | remove: '/' }}"
onclick="window.open(this.href, 'google-plus-share', 'width=490,height=530');return false;">
<span class="hidden">Google+</span>
</a>
</section>

<!-- Add Disqus Comments -->
{% if page.disqus %}
{% include disqus.html %}
{% endif %}

</footer>

</article>
Expand Down
6 changes: 3 additions & 3 deletions _layouts/tag.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
current: tag
---

<!-- < dynamically overriding backgrounds for tags as well as descriptions -->
<!-- dynamically overriding backgrounds for tags as well as descriptions -->
{% if page.url contains 'fables' %}
{% assign tag_description='A series of short stories that make you think.' %}
{% elsif page.url contains 'speeches' %}
Expand All @@ -17,7 +17,7 @@
{% assign new_cover='assets/images/cover1.jpg' %}
{% endif %}

<!-- < default}} -->
<!-- default -->
<!-- The tag above means - insert everything in this file into the [body] of the default.hbs template -->

<!-- If we have a tag cover, display that - else blog cover - else nothing -->
Expand Down Expand Up @@ -48,4 +48,4 @@ <h2 class="page-description">
<!-- The tag below includes the post loop - partials/loop.hbs -->
{% include loop.html %}

</main>
</main>
10 changes: 4 additions & 6 deletions _posts/1863-11-19-gettysburg-address.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
---
layout: post
cover: false
navigation: false
title: Gettysburg Address
date: 1863-11-19 10:18:00
date: 1863-11-19 10:18:00
tags: fiction
subclass: 'post tag-fiction'
categories: 'casper'
author: abraham
categories: abraham
---

Fourscore and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.

Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this.

But, in a larger sense, we can not dedicate-we can not consecrate-we can not hallow-this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us-that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion-that we here highly resolve that these dead shall not have died in vain-that this nation, under God, shall have a new birth of freedom-and that government of the people, by the people, for the people shall not perish from the earth.

By **Abraham Lincoln**

The 16th president of the USA until he was assassinated in April of 1963. He led the US through its Civil War - its bloodiest and greatest moral, constitutional and political crisis.
Loading

1 comment on commit ede3935

@biomadeira
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#10

Please sign in to comment.