18f.gsa.gov: Automate bylines

Created on 19 Mar 2015  ·  3Comments  ·  Source: 18F/18f.gsa.gov

Right now blog posts require the following to get a simple byline:

# in the frontmatter
authors:
- author1
- author2

and in the post body

<p class="authors">
  by {% author author1 %} and {% author author2 %}
</p>

Let's eliminate the redundancy and see if it's possible to auto-generate the byline in the post template. We accidentally publish too many posts without bylines.

Desired state:
Something like this in layouts/post.html

<p class="authors">{% authors %}</p>

Considerations:

  • some of our posts have illustrators
  • authors are available in the site object at: site.data.authors in templates. There are different ways to tap into this depending on what kind of plugin you're making.
  • there are probably other Jekyll sites that have done this; I did it for a side project of mine, but that might not be the best model.
help wanted blog-feature

All 3 comments

Some of our posts have authors not listed in the team data file, and include their title. We could make it so that if an author is not found by the handle given in the front matter array, it is instead treated as plain text to be embedded, and not a lookup handle.

Great idea, @konklone, thanks for the suggestion. :+1:

Pretty sure this is done with #966, right?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

coreycaitlin picture coreycaitlin  ·  5Comments

gboone picture gboone  ·  16Comments

anjunainaustin picture anjunainaustin  ·  8Comments

konklone picture konklone  ·  4Comments

NoahKunin picture NoahKunin  ·  10Comments