From df0fb955fa771a34c5659f13d8d0387cfc797cf4 Mon Sep 17 00:00:00 2001 From: Matt Stratton Date: Thu, 27 Apr 2017 14:24:41 -0500 Subject: Migrate guests to pages instead of data files This change enables the use of pages instead of data files for guests. It is backwards compatible; if the guest does not exist as a page, it will check for a data file for legacy. Fixes #42 --- README.md | 41 ++--- archetypes/guest.md | 10 ++ config.codekit3 | 80 ++++++++++ exampleSite/content/episode/april.md | 2 +- exampleSite/content/episode/aug.md | 2 +- exampleSite/content/episode/sept.md | 2 +- exampleSite/content/guest/jsmith.md | 13 ++ exampleSite/content/guest/mstratton.md | 15 ++ exampleSite/static/img/guest/jsmith.jpg | Bin 0 -> 836952 bytes exampleSite/static/img/guest/mstratton.jpg | Bin 0 -> 185724 bytes layouts/episode/single.html | 243 +++++++++++++++++++---------- layouts/guest/single.html | 68 ++++++++ 12 files changed, 367 insertions(+), 109 deletions(-) create mode 100644 archetypes/guest.md create mode 100644 exampleSite/content/guest/jsmith.md create mode 100644 exampleSite/content/guest/mstratton.md create mode 100644 exampleSite/static/img/guest/jsmith.jpg create mode 100644 exampleSite/static/img/guest/mstratton.jpg create mode 100644 layouts/guest/single.html diff --git a/README.md b/README.md index 8b68648..fe4d96a 100644 --- a/README.md +++ b/README.md @@ -100,35 +100,36 @@ I recommend the following permalink settings, although the theme will work just If you don't have guests on your episodes, feel free to ignore this section. -#### Guest data files +#### Guest pages -Every guest on your show needs a corresponding data file in the `data/guests` directory of your site. Generally speaking, you should be able to name these however you like, but I have only tested it with the format `firstinitiallastname.yml`, i.e., for "John Doe" the file would be `jdoe.yml`. +Every guest on your show needs a corresponding page in the `content/guest` directory of your site. Generally speaking, you should be able to name these however you like, but I have only tested it with the format `firstinitiallastname.md`, i.e., for "John Doe" the file would be `jdoe.md`. A guest file takes the following structure: ``` -name: jdoe -full_name: "John Doe" -thumbnail: "/img/guest/jdoe.jpg" -bio: "Spoon fresh pie ingredients groceries oranges luncheon farm. Broth chick peas Chinese food indie foods. Cream heating cheese food locally grown first class caramelize restaurant grocery shopping savory chick peas. Recommendations lovely starter soda herbes fridge chocolate eat better quinoa sausage java chef locally grown wholesome. Broil sweet sushi lasagna cream indian. Desert sour vegetarian sous-chef soda oven tasty eat better rice recommendations relish salt butter grape. Grocery shopping delicious Chinese food beets conserve ginger. Authentic blend drink sausage. Groceries sour desert. Take away lasagna consumer luncheon scent cookie beer groceries meals restaurants java cheese vegan chick peas." -homepage: "http://www.google.com" -github: "johndoe" -facebook: "johndoe" -twitter: "johndoe" -linkedin: "johndoe" ++++ +Title = "John Doe" +Twitter = "johndoe" +Website = "http://www.google.com" +Type = "guest" +Facebook = "johndoe" +Linkedin = "johndoe" +GitHub = "johndoe" +Thumbnail = "/img/guest/jdoe.jpg" ++++ +Spoon fresh pie ingredients groceries oranges luncheon farm. Broth chick peas Chinese food indie foods. Cream heating cheese food locally grown first class caramelize restaurant grocery shopping savory chick peas. Recommendations lovely starter soda herbes fridge chocolate eat better quinoa sausage java chef locally grown wholesome. Broil sweet sushi lasagna cream indian. Desert sour vegetarian sous-chef soda oven tasty eat better rice recommendations relish salt butter grape. Grocery shopping delicious Chinese food beets conserve ginger. Authentic blend drink sausage. Groceries sour desert. Take away lasagna consumer luncheon scent cookie beer groceries meals restaurants java cheese vegan chick peas. + ``` (See the example site for, well, examples) -- `name` - This MUST match the name you will refer to the guest as in your frontmatter. Ideally it is the same name as the file. Again, I prefer first initial lastname format. Required. -- `full_name` - The full name of the guest. This is what is displayed on the episode page, etc. Required. -- `thumbnail` - The image for the guest. This image must be 500 px x 500 px. You can either enter a value relative to your `BaseURL`, or a fully qualified URL. If you want to use the default, set this to `""`. Optional. If left blank, or not existent, a default image will be provided. You can replace this default image by putting a new 500 px x 500 px PNG image at `/static/img/guest/default-guest.png` in your site (not in the theme!) -- `bio` - The bio of your guest. You can use Markdown in here. If you use quotes, make sure to escape them. Required. -- `homepage` - Optional. -- `github` - Guest's GitHub username. Optional. -- `facebook` - Guest's Facebook username. Example: `matt.stratton`. Do not use the full URL. Optional. -- `twitter` - Guest's Twitter username, without the `@`. Optional. -- `linkedin` - LinkedIn profile name. Optional. This is the part that comes after the `https://www.linkedin.com/in/` in your profile URL. Example: `"mattstratton"` +- `Title` - The full name of the guest. This is what is displayed on the episode page, etc. Required. +- `Thumbnail` - The image for the guest. This image must be 500 px x 500 px. You can either enter a value relative to your `BaseURL`, or a fully qualified URL. If you want to use the default, set this to `""`. Optional. If left blank, or not existent, a default image will be provided. You can replace this default image by putting a new 500 px x 500 px PNG image at `/static/img/guest/default-guest.png` in your site (not in the theme!) +- `Website` - Optional. +- `GitHub` - Guest's GitHub username. Optional. +- `Facebook` - Guest's Facebook username. Example: `matt.stratton`. Do not use the full URL. Optional. +- `Twitter` - Guest's Twitter username, without the `@`. Optional. +- `LinkedIn` - LinkedIn profile name. Optional. This is the part that comes after the `https://www.linkedin.com/in/` in your profile URL. Example: `"mattstratton"` #### Frontmatter diff --git a/archetypes/guest.md b/archetypes/guest.md new file mode 100644 index 0000000..995c639 --- /dev/null +++ b/archetypes/guest.md @@ -0,0 +1,10 @@ ++++ +Twitter = "" +Website = "" +Type = "guest" +Facebook = "" +Linkedin = "" +Pronouns = "" +GitHub = "" +Thumbnail = "" ++++ diff --git a/config.codekit3 b/config.codekit3 index 9c112f2..bf94d63 100644 --- a/config.codekit3 +++ b/config.codekit3 @@ -81,6 +81,24 @@ "rFN": 0, "uCM": 0 }, + "\/archetypes\/guest.md": { + "cS": 0, + "eF": 1, + "eL": 1, + "eLB": 0, + "ema": 1, + "eSQ": 1, + "ft": 4096, + "oA": 1, + "oAP": "\/archetypes\/guest.html", + "oF": 0, + "oFM": 0, + "oS": 0, + "pHT": 0, + "pME": 1, + "rFN": 0, + "uCM": 0 + }, "\/bin\/hugo": { "ft": 8192, "oA": 2, @@ -4911,6 +4929,42 @@ "rFN": 0, "uCM": 0 }, + "\/exampleSite\/content\/guest\/jsmith.md": { + "cS": 0, + "eF": 1, + "eL": 1, + "eLB": 0, + "ema": 1, + "eSQ": 1, + "ft": 4096, + "oA": 1, + "oAP": "\/exampleSite\/content\/guest\/jsmith.html", + "oF": 0, + "oFM": 0, + "oS": 0, + "pHT": 0, + "pME": 1, + "rFN": 0, + "uCM": 0 + }, + "\/exampleSite\/content\/guest\/mstratton.md": { + "cS": 0, + "eF": 1, + "eL": 1, + "eLB": 0, + "ema": 1, + "eSQ": 1, + "ft": 4096, + "oA": 1, + "oAP": "\/exampleSite\/content\/guest\/mstratton.html", + "oF": 0, + "oFM": 0, + "oS": 0, + "pHT": 0, + "pME": 1, + "rFN": 0, + "uCM": 0 + }, "\/exampleSite\/data\/guests\/gbluth.yml": { "ft": 8192, "oA": 2, @@ -7111,6 +7165,26 @@ "opt": 0, "q": 100 }, + "\/exampleSite\/static\/img\/guest\/jsmith.jpg": { + "ft": 16384, + "iS": 836952, + "oA": 0, + "oAP": "\/exampleSite\/static\/img\/guest\/jsmith.jpg", + "oF": 0, + "oIPL": 0, + "opt": 0, + "q": 100 + }, + "\/exampleSite\/static\/img\/guest\/mstratton.jpg": { + "ft": 16384, + "iS": 185724, + "oA": 0, + "oAP": "\/exampleSite\/static\/img\/guest\/mstratton.jpg", + "oF": 0, + "oIPL": 0, + "opt": 0, + "q": 100 + }, "\/images\/screenshot-v01.png": { "ft": 32768, "iS": 545100, @@ -7180,6 +7254,12 @@ "oAP": "\/layouts\/episode\/single.html", "oF": 0 }, + "\/layouts\/guest\/single.html": { + "ft": 8192, + "oA": 2, + "oAP": "\/layouts\/guest\/single.html", + "oF": 0 + }, "\/layouts\/index.html": { "ft": 8192, "oA": 2, diff --git a/exampleSite/content/episode/april.md b/exampleSite/content/episode/april.md index 650dcea..1a5738d 100644 --- a/exampleSite/content/episode/april.md +++ b/exampleSite/content/episode/april.md @@ -7,7 +7,7 @@ date = "2016-04-25T04:09:45-05:00" episode = "7" episode_image = "/img/episode/default.jpg" explicit = "no" -guests = ["jdoe"] +guests = ["jdoe", "jsmith"] images = ["http://www.google.com/img/episode/default-social.jpg"] news_keywords = [] podcast_duration = "1:08:22" diff --git a/exampleSite/content/episode/aug.md b/exampleSite/content/episode/aug.md index 7c926a5..7fa7f2c 100644 --- a/exampleSite/content/episode/aug.md +++ b/exampleSite/content/episode/aug.md @@ -7,7 +7,7 @@ date = "2016-08-25T04:09:58-05:00" episode = "11" episode_image = "/img/episode/default.jpg" explicit = "no" -guests = [] +guests = ["mstratton"] images = ["/img/episode/default-social.jpg"] news_keywords = [] podcast_duration = "1:08:22" diff --git a/exampleSite/content/episode/sept.md b/exampleSite/content/episode/sept.md index 8470050..62629f9 100644 --- a/exampleSite/content/episode/sept.md +++ b/exampleSite/content/episode/sept.md @@ -7,7 +7,7 @@ date = "2016-09-25T04:10:01-05:00" episode = "12" episode_image = "/img/episode/default.jpg" explicit = "no" -guests = [] +guests = ["jsmith"] images = ["/img/episode/default-social.jpg"] news_keywords = [] podcast_duration = "1:08:22" diff --git a/exampleSite/content/guest/jsmith.md b/exampleSite/content/guest/jsmith.md new file mode 100644 index 0000000..087193d --- /dev/null +++ b/exampleSite/content/guest/jsmith.md @@ -0,0 +1,13 @@ ++++ +Title = "Jane Smith" +date = "2016-12-08T20:55:58-06:00" +Twitter = "jsmith" +Website = "http://www.google.com/" +Type = "guest" +Facebook = "" +Linkedin = "" +Pronouns = "" +GitHub = "" +Thumbnail = "/img/guest/jsmith.jpg" ++++ +Spoon fresh pie ingredients groceries oranges luncheon farm. Broth chick peas Chinese food indie foods. Cream heating cheese food locally grown first class caramelize restaurant grocery shopping savory chick peas. Recommendations lovely starter soda herbes fridge chocolate eat better quinoa sausage java chef locally grown wholesome. Broil sweet sushi lasagna cream indian. Desert sour vegetarian sous-chef soda oven tasty eat better rice recommendations relish salt butter grape. Grocery shopping delicious Chinese food beets conserve ginger. Authentic blend drink sausage. Groceries sour desert. Take away lasagna consumer luncheon scent cookie beer groceries meals restaurants java cheese vegan chick peas. diff --git a/exampleSite/content/guest/mstratton.md b/exampleSite/content/guest/mstratton.md new file mode 100644 index 0000000..2e43e4e --- /dev/null +++ b/exampleSite/content/guest/mstratton.md @@ -0,0 +1,15 @@ ++++ +title = "Matt Stratton" +Thumbnail = "/img/guest/mstratton.jpg" +Linkedin = "mattstratton" +GitHub = "mattstratton" +Pronouns = "" +Facebook = "matt.stratton" +date = "2017-04-27T13:53:32-05:00" +Twitter = "mattstratton" +Type = "guest" +Website = "https://www.mattstratton.com" + ++++ + +Matt Stratton is a solutions architect at Chef, where he demonstrates how Chef’s automation platform provides speed and flexibility to clients’ infrastructure. He is devoted to concepts like Continuous Delivery and Infrastructure as Code, and his license plate actually says “DevOps”. He lives in Chicago and has an unhealthy obsession with Doctor Who, Firefly, and Game of Thrones. And whiskey. diff --git a/exampleSite/static/img/guest/jsmith.jpg b/exampleSite/static/img/guest/jsmith.jpg new file mode 100644 index 0000000..682ed81 Binary files /dev/null and b/exampleSite/static/img/guest/jsmith.jpg differ diff --git a/exampleSite/static/img/guest/mstratton.jpg b/exampleSite/static/img/guest/mstratton.jpg new file mode 100644 index 0000000..6a52510 Binary files /dev/null and b/exampleSite/static/img/guest/mstratton.jpg differ diff --git a/layouts/episode/single.html b/layouts/episode/single.html index 01c22a3..68cf8f0 100644 --- a/layouts/episode/single.html +++ b/layouts/episode/single.html @@ -1,104 +1,175 @@ {{ define "main" }} -
-
+
+

{{ title .Title }}

-
-
- +
+
+
-
- {{ .Description | markdownify }} -
+
+ {{ .Description | markdownify }}
-
-
-
+
+
+
+
-
-
+
+
+

Show Notes

{{ .Content }}
- {{ if .Params.guests }} -
-
-

Guests

-
-
- {{ range $person :=.Params.guests }} - {{ if (isset $.Site.Data.guests $person) }} - {{ $p := (index $.Site.Data.guests $person) }} -
-
- {{ if and (isset $p "thumbnail") (ne $p.thumbnail "") }} - {{ if (eq (slicestr $p.thumbnail 0 4) "http") }} - {{ $p.full_name }} - {{ else }} - {{ $p.full_name }} - {{ end }} - {{ else }} - {{ $p.full_name }} - {{ end }} -
-
-

{{ $p.full_name }}

- {{ if isset $p "bio" }} -

{{ $p.bio | markdownify }}

- {{ end }} - {{ if isset $p "homepage" }} - - {{ end }} - {{ if isset $p "twitter" }} - - {{ end }} - {{ if isset $p "github"}} - - {{ end }} - {{ if isset $p "linkedin" }} - + + {{ with .Params.guests }} +
+
+

Guests

+
+
+ {{ range $name := . }} + {{ $.Scratch.Set "person" $name }} + {{ range where $.Site.Pages "Type" "guest" }} + {{ if eq .File.BaseFileName ($.Scratch.Get "person") }} + {{ $.Scratch.Set "guest-exist" "true" }} +
+
+ {{ if and (isset .Params "thumbnail") (ne .Params.thumbnail "") }} + {{ if (eq (slicestr .Params.thumbnail 0 4) "http") }} + {{ .Title }} + {{ else }} + {{ .Title }} + {{ end }} + {{ else }} + {{ .Title }} + {{ end }} +
+
+

{{ .Title }}

+ {{ .Content }} + {{ if .Params.Website }} + + + + {{ end }} + {{ if .Params.Twitter }} + + + + {{ end }} + {{ if .Params.GitHub }} + + + + {{ end }} + {{ if .Params.LinkedIn }} + + + + {{ end }} + {{ if .Params.Facebook }} + + + + {{ end }} +
+
{{ end }} - {{ if isset $p "facebook" }} - + {{ end }} + {{ if ne ($.Scratch.Get "guest-exist") "true"}} + {{ if (isset $.Site.Data.guests ($.Scratch.Get "person")) }} + {{ $p := (index $.Site.Data.guests ($.Scratch.Get "person")) }} +
+
+ {{ if and (isset $p "thumbnail") (ne $p.thumbnail "") }} + {{ if (eq (slicestr $p.thumbnail 0 4) "http") }} + {{ $p.full_name }} + {{ else }} + {{ $p.full_name }} + {{ end }} + {{ else }} + {{ $p.full_name }} + {{ end }} +
+
+

{{ $p.full_name }}

+ {{ if isset $p "bio" }} +

{{ $p.bio | markdownify }}

+ {{ end }} + {{ if isset $p "homepage" }} + + {{ end }} + {{ if isset $p "twitter" }} + + {{ end }} + {{ if isset $p "github"}} + + {{ end }} + {{ if isset $p "linkedin" }} + + {{ end }} + {{ if isset $p "facebook" }} + + {{ end }} +
+ {{ end }} +
{{ end }} -
+ {{ end }} + {{ end }} +
+ +
+
+
+
+ +
+ +
+ {{ partial "disqus.html" . }} +
+
+ +
+ +
+
- {{ end }} + {{ if .NextInSection }} +
  • + Next + + +
  • + {{ else }} +
  • + Next + + +
  • + {{ end }} + + +
    -
    + {{ end }} -
    -
    -
    -
    -
    -
    -
    - {{ partial "disqus.html" . }} -
    -
    -
    -
    - -
    -
    -{{ end }} diff --git a/layouts/guest/single.html b/layouts/guest/single.html new file mode 100644 index 0000000..3e2b403 --- /dev/null +++ b/layouts/guest/single.html @@ -0,0 +1,68 @@ +{{ define "main" }} + +
    +
    +

    {{ title .Title }}

    +
    +
    + +
    +
    + +
    +
    +
    +
    + {{ .Content | markdownify }} +
    +
    +
    +
    + {{ if .Params.Website }} + + + + {{ end }} + {{ if .Params.Twitter }} + + + + {{ end }} + {{ if .Params.GitHub }} + + + + {{ end }} + {{ if .Params.LinkedIn }} + + + + {{ end }} + {{ if .Params.Facebook }} + + + + {{ end }} +
    +
    +
    +
    +

    Episodes

    +
      + {{ $.Scratch.Set "guest-name" .File.BaseFileName }} + {{ range $page := where $.Site.Pages "Type" "episode" }} + {{ range $page.Params.guests }} + {{ if eq . ($.Scratch.Get "guest-name") }} +
    • + {{$page.Title}} +
    • + {{ end }} + {{ end }} + {{ end }} +
    +
    +
    +
    +
    + +{{ end }} -- cgit v1.2.3