mirror of
https://github.com/meineerde/holgerjust.de.git
synced 2025-10-17 17:01:01 +00:00
Allow multiple authors
This commit is contained in:
parent
5a633d5e32
commit
208f469b88
78
config.rb
78
config.rb
@ -67,6 +67,13 @@ activate :blog do |blog|
|
||||
blog.paginate = true
|
||||
blog.per_page = 10
|
||||
blog.page_link = "page/{num}"
|
||||
|
||||
blog.custom_collections = {
|
||||
author: {
|
||||
link: '/author/:author.html',
|
||||
template: '/author.html'
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
set :casper, {
|
||||
@ -76,41 +83,46 @@ set :casper, {
|
||||
description: 'Stories about Life and Technology',
|
||||
date_format: '%Y-%m-%d',
|
||||
navigation: true,
|
||||
default_license: 'cc_by_sa'
|
||||
default_license: 'cc_by_sa',
|
||||
author: 'Holger Just'
|
||||
},
|
||||
author: {
|
||||
name: 'Holger Just',
|
||||
email: 'hello@holgerjust.de',
|
||||
bio: markdown(<<-MARKDOWN.gsub(/^[ ]*/, ' ').strip),
|
||||
I spend most of my life pressing buttons on a computer to change its
|
||||
pattern of lights. I support the DevOps culture by creating,
|
||||
maintaining, and operating software systems. I want to understand the world.
|
||||
MARKDOWN
|
||||
location: 'Berlin, Germany',
|
||||
website: 'https://holgerjust.de',
|
||||
avatar_url: '//www.gravatar.com/avatar/b2c6828974b9192f619c6206d4d20f1d',
|
||||
twitter: 'meineerde',
|
||||
profile_links: {
|
||||
twitter: {
|
||||
name: 'Twitter',
|
||||
user: 'meineerde',
|
||||
link: 'https://twitter.com/meineerde'
|
||||
},
|
||||
github: {
|
||||
name: 'GitHub',
|
||||
user: 'meineerde',
|
||||
link: 'https://github.com/meineerde'
|
||||
},
|
||||
stackoverflow: {
|
||||
name: 'Stack Overflow',
|
||||
link: 'https://stackoverflow.com/users/421705/holger-just'
|
||||
},
|
||||
xing: {
|
||||
name: 'XING',
|
||||
link: 'https://www.xing.com/profile/Holger_Just'
|
||||
authors: [
|
||||
# When adding an author here, be sure to also create a matching author site
|
||||
# in source/partials/author
|
||||
{
|
||||
name: 'Holger Just',
|
||||
email: 'hello@holgerjust.de',
|
||||
bio: markdown(<<-MARKDOWN.gsub(/^[ ]*/, ' ').strip),
|
||||
I spend most of my life pressing buttons on a computer to change its
|
||||
pattern of lights. I support the DevOps culture by creating,
|
||||
maintaining, and operating software systems. I want to understand the world.
|
||||
MARKDOWN
|
||||
location: 'Berlin, Germany',
|
||||
website: 'https://holgerjust.de',
|
||||
avatar_url: '//www.gravatar.com/avatar/b2c6828974b9192f619c6206d4d20f1d',
|
||||
twitter: 'meineerde',
|
||||
profile_links: {
|
||||
twitter: {
|
||||
name: 'Twitter',
|
||||
user: 'meineerde',
|
||||
link: 'https://twitter.com/meineerde'
|
||||
},
|
||||
github: {
|
||||
name: 'GitHub',
|
||||
user: 'meineerde',
|
||||
link: 'https://github.com/meineerde'
|
||||
},
|
||||
stackoverflow: {
|
||||
name: 'Stack Overflow',
|
||||
link: 'https://stackoverflow.com/users/421705/holger-just'
|
||||
},
|
||||
xing: {
|
||||
name: 'XING',
|
||||
link: 'https://www.xing.com/profile/Holger_Just'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
navigation: {
|
||||
'Home' => ->{ url_for '/index.html' },
|
||||
'About Me' => ->{ author_path },
|
||||
@ -140,8 +152,6 @@ ready do
|
||||
@articles = articles
|
||||
end
|
||||
end
|
||||
|
||||
proxy "/author/#{blog_author.name.parameterize}.html", '/author.html', ignore: true
|
||||
end
|
||||
|
||||
###
|
||||
|
||||
@ -42,8 +42,14 @@ module MiddlemanCasperHelpers
|
||||
truncate_words(body, length: words, omission: '')
|
||||
end
|
||||
|
||||
def blog_author
|
||||
OpenStruct.new(casper[:author])
|
||||
def blog_author(author_name = nil)
|
||||
author_name ||= current_resource.data.author
|
||||
author_name ||= blog_settings.author
|
||||
|
||||
author_name = author_name.to_s.parameterize
|
||||
|
||||
author = casper[:authors].find { |author| author[:name].parameterize == author_name }
|
||||
OpenStruct.new(author)
|
||||
end
|
||||
|
||||
def blog_settings
|
||||
@ -84,17 +90,17 @@ module MiddlemanCasperHelpers
|
||||
page.data.cover.present?
|
||||
end
|
||||
|
||||
def gravatar(size = 68)
|
||||
if blog_author.avatar_url.present?
|
||||
"#{blog_author.avatar_url}?size=#{size}"
|
||||
def gravatar(author = nil, size: 68)
|
||||
if blog_author(author).avatar_url.present?
|
||||
"#{blog_author(author).avatar_url}?size=#{size}"
|
||||
else
|
||||
md5 = Digest::MD5.hexdigest(blog_author.gravatar_email.downcase)
|
||||
md5 = Digest::MD5.hexdigest(blog_author(author).gravatar_email.downcase)
|
||||
"https://www.gravatar.com/avatar/#{md5}?size=#{size}"
|
||||
end
|
||||
end
|
||||
def gravatar?
|
||||
blog_author.avatar_url.present? ||
|
||||
blog_author.gravatar_email.present?
|
||||
def gravatar?(author = nil)
|
||||
blog_author(author).avatar_url.present? ||
|
||||
blog_author(author).gravatar_email.present?
|
||||
end
|
||||
|
||||
def twitter_url
|
||||
@ -125,12 +131,12 @@ module MiddlemanCasperHelpers
|
||||
def home_path
|
||||
"#{blog.options.prefix.to_s}/"
|
||||
end
|
||||
def author_path
|
||||
"#{blog.options.prefix.to_s}/author/#{blog_author.name.parameterize}/"
|
||||
def author_path(author = nil)
|
||||
"#{blog.options.prefix.to_s}/author/#{blog_author(author).name.parameterize}/"
|
||||
end
|
||||
def author_email
|
||||
def author_email(author = nil)
|
||||
# The email address is stored encoded in the blog sources
|
||||
raw_email = blog_author.email.to_s.scan(/&#\d+;/).map{|c| c[2..-2].to_i}.pack('U*')
|
||||
raw_email = blog_author(author).email.to_s.scan(/&#\d+;/).map{|c| c[2..-2].to_i}.pack('U*')
|
||||
obfuscated_email = raw_email.tr('!-~', 'P-~!-O').unpack('U*').map{ |code| "&##{code.to_s};"}.join
|
||||
|
||||
%{<span class="hidden-email" data-email="#{obfuscated_email}"><em>(Please enable JavaScript to show the email address)</em></span>}.html_safe
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
---
|
||||
title: Warum man ein Boot braucht
|
||||
author: Holger Just
|
||||
date: 2006-08-08 19:45:24 UTC
|
||||
lang: :de
|
||||
tags: Life
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
---
|
||||
title: Chili con Carne
|
||||
author: Holger Just
|
||||
date: 2009-10-01 16:16 UTC
|
||||
lang: :de
|
||||
tags: Life
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
---
|
||||
title: Cross-browser CSS gradient
|
||||
author: Holger Just
|
||||
date: 2010-07-26 9:22 UTC
|
||||
lang: :en
|
||||
tags: Technology
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
---
|
||||
title: How to compile Postfix + SASL + LDAP on Opensolaris
|
||||
author: Holger Just
|
||||
date: 2010-06-14 18:44 UTC
|
||||
lang: :en
|
||||
tags: Technology
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
---
|
||||
title: 30 Minute Timeout
|
||||
author: Holger Just
|
||||
date: 2011-02-01
|
||||
lang: :en
|
||||
tags: Life
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
---
|
||||
title: Speeding up Git at Planio
|
||||
author: Holger Just
|
||||
date: 2016-02-05
|
||||
lang: :en
|
||||
tags: Technology
|
||||
|
||||
@ -16,42 +16,23 @@ cover_license: '[Cover Image](https://unsplash.com/photos/2ShvY8Lf6l0) by [Lukas
|
||||
%section.author-profile.inner
|
||||
- if gravatar?
|
||||
%figure.author-image
|
||||
.img{style: "background-image: url(#{gravatar(114)})"}
|
||||
%span.hidden #{blog_author.name}'s Picture
|
||||
%h1.author-title= blog_author.name
|
||||
.author-bio
|
||||
:markdown
|
||||
I'm a software developer and operations engineer from Berlin,
|
||||
Germany. I want to bridge the gap between those functions by building and
|
||||
maintaining a [DevOps culture](https://www.oreilly.com/ideas/what-is-devops-yet-again)
|
||||
throughout my work.
|
||||
|
||||
I am a contributor to [Redmine](https://www.redmine.org) and was project
|
||||
lead of [ChiliProject](https://www.chiliproject.org). I am a contributer
|
||||
to [Chef](https://www.chef.io) and have created and maintain several [Chef
|
||||
cookbooks](https://github.com/meineerde-cookbooks/) and a few general-pupose
|
||||
[Ruby Gems](https://rubygems.org/profiles/meineerde).
|
||||
|
||||
I strongly believe in the values of Open Source and strive to be an
|
||||
integral part of the community by not only providing source code but also
|
||||
advice, help, and organisational support to advance the status quo.
|
||||
|
||||
If you want to contact me, preferrably send an email to #{author_email}
|
||||
in either German or English. I am
|
||||
[#{blog_author.profile_links[:github][:user]}](#{blog_author.profile_links[:github][:link]}) on GitHub and
|
||||
[@#{blog_author.profile_links[:twitter][:user]}](#{blog_author.profile_links[:twitter][:link]}) on Twitter.
|
||||
I try to help people on [Stack Overflow](#{blog_author.profile_links[:stackoverflow][:link]}).
|
||||
.img{style: "background-image: url(#{gravatar(author, size: 114)})"}
|
||||
%span.hidden #{blog_author(author).name}'s Picture
|
||||
%h1.author-title= blog_author(author).name
|
||||
.author-bio= partial("author/#{author.parameterize}")
|
||||
.author-meta
|
||||
- if blog_author.location.present?
|
||||
%span.author-location.icon-location= blog_author.location
|
||||
= partial(:profile_links)
|
||||
- if blog_author.website.present?
|
||||
- if blog_author(author).location.present?
|
||||
%span.author-location.icon-location= blog_author(author).location
|
||||
= partial(:profile_links, locals: {author: author})
|
||||
- if blog_author(author).website.present?
|
||||
%span.author-link.icon-link
|
||||
%a{href: blog_author.website}= blog_author.website.sub(%r{^https?://}, '')
|
||||
%a{href: blog_author.website}= blog_author(author).website.sub(%r{^https?://}, '')
|
||||
%span.author-stats
|
||||
%i.icon-stats
|
||||
= pluralize(blog.articles.count, 'post')
|
||||
=# TODO: articles per author
|
||||
= pluralize(locals['articles'].count, 'post')
|
||||
|
||||
%main#content.content{role: :main}
|
||||
=# TODO: articles per author
|
||||
= partial(:page_articles,
|
||||
locals: { page_articles: page_articles, paginate: paginate })
|
||||
|
||||
@ -15,7 +15,7 @@ cover_license: '[Cover Image](https://unsplash.com/photos/2ShvY8Lf6l0) by [Lukas
|
||||
%h2.page-description= blog_settings.description
|
||||
%section.byline
|
||||
%span= "by #{link_to blog_author.name, author_path}"
|
||||
= partial(:profile_links)
|
||||
= partial(:profile_links, locals: {author: blog_author.name})
|
||||
|
||||
%a.scroll-down.icon-arrow-left{href: '#content', data: {offset: '-45'}}
|
||||
%span.hidden Scroll Down
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
.author-meta
|
||||
- if blog_author.location.present?
|
||||
%span.author-location.icon-location= blog_author.location
|
||||
= partial(:profile_links)
|
||||
= partial(:profile_links, locals: {author: blog_author.name})
|
||||
- if blog_author.website.present?
|
||||
%span.author-link.icon-link
|
||||
%a{href: blog_author.website}= blog_author.website.sub(%r{^https?://}, '')
|
||||
|
||||
20
source/partials/author/holger-just.html.md.erb
Normal file
20
source/partials/author/holger-just.html.md.erb
Normal file
@ -0,0 +1,20 @@
|
||||
I'm a software developer and operations engineer from Berlin,
|
||||
Germany. I want to bridge the gap between those functions by building and
|
||||
maintaining a [DevOps culture](https://www.oreilly.com/ideas/what-is-devops-yet-again)
|
||||
throughout my work.
|
||||
|
||||
I am a contributor to [Redmine](https://www.redmine.org) and was project
|
||||
lead of [ChiliProject](https://www.chiliproject.org). I am a contributer
|
||||
to [Chef](https://www.chef.io) and have created and maintain several [Chef
|
||||
cookbooks](https://github.com/meineerde-cookbooks/) and a few general-pupose
|
||||
[Ruby Gems](https://rubygems.org/profiles/meineerde).
|
||||
|
||||
I strongly believe in the values of Open Source and strive to be an
|
||||
integral part of the community by not only providing source code but also
|
||||
advice, help, and organisational support to advance the status quo.
|
||||
|
||||
If you want to contact me, preferrably send an email to <%= author_email %>
|
||||
in either German or English. I am
|
||||
[<%= blog_author.profile_links[:github][:user] %>](<%= blog_author.profile_links[:github][:link] %>) on GitHub and
|
||||
[@<%= blog_author.profile_links[:twitter][:user] %>](<%= blog_author.profile_links[:twitter][:link] %>) on Twitter.
|
||||
I try to help people on [Stack Overflow](<%= blog_author.profile_links[:stackoverflow][:link] %>).
|
||||
@ -12,8 +12,8 @@
|
||||
= link_to '» Read more', article, class: 'read-more'
|
||||
%footer.post-meta
|
||||
- if gravatar?
|
||||
%img.author-thumb{src: gravatar(24), alt: blog_author.name, nopin: 'nopin'}
|
||||
%a{href: author_path}= blog_author.name
|
||||
%img.author-thumb{src: gravatar(article.data.author, size: 24), alt: blog_author(article.data.author).name, nopin: 'nopin'}
|
||||
%a{href: author_path(article.data.author)}= blog_author(article.data.author).name
|
||||
- if tags?(article)
|
||||
on #{tags(article)}
|
||||
%time.post-date{datetime: article.date.strftime('%Y-%m-%d')}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
%span.profile-links
|
||||
- blog_author.profile_links.each do |name, opts|
|
||||
- Array(blog_author(author).profile_links).each do |name, opts|
|
||||
%a{class: "icon-#{name}", href: opts[:link]}
|
||||
%span.hidden= opts[:name]
|
||||
|
||||
@ -47,6 +47,10 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
.archive-template .author-profile .author-bio {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.left {
|
||||
float: left;
|
||||
margin: 0 1rem .75rem 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user