Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit efa7a96

Browse files
committed
Add author override test
1 parent 3ee464d commit efa7a96

File tree

2 files changed

+35
-15
lines changed

2 files changed

+35
-15
lines changed

_data/authors.yml

+4-15
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
11
# Authors
22

3-
billy_rick:
3+
Billy Rick:
44
name: Billy Rick
5-
web: http://thewhip.com
6-
7-
bio: "What do you want, jewels? I am a very extravagant man."
8-
avatar: bio-photo-2.jpg
9-
twitter: extravagantman
10-
google:
11-
plus: BillyRick
5+
picture: /images/bio-photo-2.jpg
126

13-
cornelius_fiddlebone:
7+
Cornelius Fiddlebone:
148
name: Cornelius Fiddlebone
15-
16-
bio: "I ordered what?"
17-
avatar: bio-photo.jpg
18-
twitter: rhymeswithsackit
19-
google:
20-
plus: CorneliusFiddlebone
9+
picture: /images/bio-photo.jpg
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: "Layout: Author Override"
3+
author: Billy Rick
4+
excerpt: "A post to test author overrides using a data file."
5+
---
6+
7+
Sites that may have content authored from various individuals can be accommodated by using [data files](https://jekyllrb.com/docs/datafiles/).
8+
9+
To attribute an author to a post or page that is different from the site author specified in `_config.yml`:
10+
11+
**Step 1.** Create `_data/authors.yml` and add authors using the following format. Anything variables found under `author` in `_config.yml` can be used (e.g. `name`, `avatar`, `uri`, social media profiles, etc.).
12+
13+
```yaml
14+
# /_data/authors.yml
15+
16+
Billy Rick:
17+
name: "Billy Rick"
18+
picture: "/images/bio-photo-2.jpg"
19+
20+
Cornelius Fiddlebone:
21+
name: "Cornelius Fiddlebone"
22+
picture: "/images/bio-photo.jpg"
23+
```
24+
25+
**Step 2.** Assign one of the authors in `authors.yml` to a post or page you wish to override the `site.author` with.
26+
27+
Example: To assign `Billy Rick` as an author for a post the following YAML Front Matter would be applied:
28+
29+
```yaml
30+
author: Billy Rick
31+
```

0 commit comments

Comments
 (0)