mirror of
https://github.com/expressjs/expressjs.com.git
synced 2026-02-21 19:41:33 +00:00
Display author avatars in the blog (#1915)
* feat: allow blogs to have multiple authors This requires us to update the `author` front-matter, requiring it to be an array of objects instead of a single string. This paves the way for us to include further author metadata. For now we only add "name" which expects a string. * feat: allow linking to author GitHub profiles This adds the ability for authors to add their GitHub username to the blog posts they author. If they provide this then their name will be linked to their GitHub profile page. * feat: add GitHub profile images to author lines This adds a small profile image to author lines that have a GitHub. * feat: add author URLs to the feeds * fix: space the authors a little more The authors looked a little bunched up, a left margin on each of them reads a little better. Co-Authored-By: Wes Todd <wesleytodd@users.noreply.github.com> * fix: improve readability of the feed entry Liquid Co-Authored-By: Sebastian Beltran <bjohansebas@users.noreply.github.com> * feat: add author image for the technical committee Co-Authored-By: Sebastian Beltran <bjohansebas@users.noreply.github.com> * fix: set a width and height on author images This ensures we still display a circle if, for some reason, the image that we get isn't a perfect square. Co-Authored-By: Shubham Oulkar <ShubhamOulkar@users.noreply.github.com> --------- Co-authored-by: Wes Todd <wesleytodd@users.noreply.github.com> Co-authored-by: Sebastian Beltran <bjohansebas@users.noreply.github.com> Co-authored-by: Shubham Oulkar <ShubhamOulkar@users.noreply.github.com>
This commit is contained in:
21
_includes/blog/authors.html
Normal file
21
_includes/blog/authors.html
Normal file
@@ -0,0 +1,21 @@
|
||||
{%- assign authors = include.authors -%}
|
||||
{% if authors %}
|
||||
<div class="blog-authors">
|
||||
By
|
||||
{% for author in authors %}
|
||||
|
||||
{%- assign label = author.github | prepend: '@' -%}
|
||||
{%- if author.name -%}
|
||||
{%- assign label = author.name -%}
|
||||
{%- endif -%}
|
||||
|
||||
{% if label and author.github %}
|
||||
<a href="https://github.com/{{author.github}}" rel="author" class="blog-author-link">
|
||||
<img src="https://github.com/{{author.github}}.png?size=64" alt="" class="blog-author-avatar" />
|
||||
<span class="blog-author-link-label">{{label}}</span></a>{% unless forloop.last %}, {% endunless %}
|
||||
{% elsif label %}
|
||||
{{label}}{% unless forloop.last %}, {% endunless %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -3,11 +3,18 @@
|
||||
<id>{{ site.url }}{{ entry.url }}</id>
|
||||
<link href="{{ site.url }}{{ entry.url }}" rel="alternate" type="text/html" />
|
||||
<title type="text">{{ entry.title }}</title>
|
||||
{%- if entry.author %}
|
||||
<author>
|
||||
<name>{{ entry.author }}</name>
|
||||
</author>
|
||||
{%- endif %}
|
||||
{%- for author in entry.authors %}
|
||||
<author>
|
||||
{% if author.name %}
|
||||
<name>{{ author.name }}</name>
|
||||
{% elsif author.github %}
|
||||
<name>@{{ author.github }}</name>
|
||||
{% endif %}
|
||||
{% if author.github %}
|
||||
<uri>https://github.com/{{ author.github }}</uri>
|
||||
{% endif %}
|
||||
</author>
|
||||
{%- endfor %}
|
||||
<published>{{ entry.date | date_to_xmlschema }}</published>
|
||||
<updated>{{ entry.last_modified_at | default: post.date | date_to_xmlschema }}</updated>
|
||||
{%- for tag in post.tags %}
|
||||
|
||||
@@ -40,9 +40,11 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="description" content="{{page.description}}">
|
||||
<meta property="og:url" content="https://expressjs.com{{page.url}}">
|
||||
{% if page.author %}
|
||||
<meta property="og:type" content="article">
|
||||
<meta property="og:article:author" content="{{page.author}}">
|
||||
{% if page.authors %}
|
||||
<meta property="og:type" content="article">
|
||||
{%- for author in page.authors %}
|
||||
<meta property="og:article:author" content="{{author.name}}">
|
||||
{%- endfor %}
|
||||
{% else %}
|
||||
<meta property="og:type" content="website">
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user