From 30f63599698ceb72ea9447c091f953473b2244e5 Mon Sep 17 00:00:00 2001 From: "kds38@duke.edu" Date: Sun, 11 Apr 2021 05:34:18 -0400 Subject: [PATCH 1/2] Adds support for front matter image captions --- _config.yml | 2 +- _includes/page-intro.html | 2 ++ _sass/basically-basic/_intro.scss | 24 +++++++++++++++++++ _sass/basically-basic/_print.scss | 12 ++++++++++ example/Gemfile | 2 ++ .../_posts/2012-03-14-layout-hero-image.md | 4 +++- 6 files changed, 44 insertions(+), 2 deletions(-) diff --git a/_config.yml b/_config.yml index 7431bef11..fc6d21fca 100644 --- a/_config.yml +++ b/_config.yml @@ -37,7 +37,7 @@ algolia: # Build settings markdown: kramdown -theme: jekyll-theme-basically-basic +# theme: jekyll-theme-basically-basic plugins: # previsously gems - jekyll-feed - jekyll-seo-tag diff --git a/_includes/page-intro.html b/_includes/page-intro.html index 4ed2333ac..a5bb29509 100644 --- a/_includes/page-intro.html +++ b/_includes/page-intro.html @@ -7,6 +7,8 @@ {% assign intro_image = intro_image | escape %}
{{ page.title }} + {% if page.image.caption %}{{ page.image.caption | markdownify | strip_newlines | remove: "

" | remove: "

" }}
{% endif %} +
{% endif %} diff --git a/_sass/basically-basic/_intro.scss b/_sass/basically-basic/_intro.scss index feec9de93..2e6bb9552 100644 --- a/_sass/basically-basic/_intro.scss +++ b/_sass/basically-basic/_intro.scss @@ -28,6 +28,30 @@ img { width: 100%; } + .image-caption { + position: absolute; + bottom: 0; + right: 0; + margin: 0 auto; + padding: 2px 5px; + color: #fff; + font-family: $base-font-family; + font-size: $min-font-size; + background: #000; + text-align: right; + z-index: 5; + opacity: 0.5; + border-radius: $border-radius 0 0 0; + + @include breakpoint($large) { + padding: 5px 10px; + } + + a { + color: #fff; + text-decoration: none; + } + } } .intro-text { diff --git a/_sass/basically-basic/_print.scss b/_sass/basically-basic/_print.scss index 61fdf91c8..c03d150cc 100644 --- a/_sass/basically-basic/_print.scss +++ b/_sass/basically-basic/_print.scss @@ -235,6 +235,18 @@ color: #000; } + .intro-image { + .image-caption { + color: #000 !important; + background: #fff !important; + opacity: 1; + + a { + color: #000 !important; + } + } + } + /* Hide the following elements on print ========================================================================== */ diff --git a/example/Gemfile b/example/Gemfile index 737ee617c..2b55d5705 100644 --- a/example/Gemfile +++ b/example/Gemfile @@ -13,3 +13,5 @@ group :jekyll_plugins do end gem "wdm", "~> 0.1.0" if Gem.win_platform? + +gem "webrick", "~> 1.7" diff --git a/example/_posts/2012-03-14-layout-hero-image.md b/example/_posts/2012-03-14-layout-hero-image.md index 2d34e3415..e9f94c41f 100644 --- a/example/_posts/2012-03-14-layout-hero-image.md +++ b/example/_posts/2012-03-14-layout-hero-image.md @@ -1,6 +1,8 @@ --- title: "Layout: Hero Image" -image: /assets/images/eder-oliveira-180877.jpg +image: + path: /assets/images/eder-oliveira-180877.jpg + caption: "Right [here](https://apple.com)" categories: - Layout tags: From ab3e2629b2f7b51479f222e689c539870b8ee39e Mon Sep 17 00:00:00 2001 From: "kds38@duke.edu" Date: Sun, 11 Apr 2021 12:51:29 -0400 Subject: [PATCH 2/2] removes tangentally-modified files in relation to the pull request. --- _config.yml | 2 +- example/Gemfile | 2 -- example/_posts/2012-03-14-layout-hero-image.md | 4 +--- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/_config.yml b/_config.yml index fc6d21fca..7431bef11 100644 --- a/_config.yml +++ b/_config.yml @@ -37,7 +37,7 @@ algolia: # Build settings markdown: kramdown -# theme: jekyll-theme-basically-basic +theme: jekyll-theme-basically-basic plugins: # previsously gems - jekyll-feed - jekyll-seo-tag diff --git a/example/Gemfile b/example/Gemfile index 2b55d5705..737ee617c 100644 --- a/example/Gemfile +++ b/example/Gemfile @@ -13,5 +13,3 @@ group :jekyll_plugins do end gem "wdm", "~> 0.1.0" if Gem.win_platform? - -gem "webrick", "~> 1.7" diff --git a/example/_posts/2012-03-14-layout-hero-image.md b/example/_posts/2012-03-14-layout-hero-image.md index e9f94c41f..2d34e3415 100644 --- a/example/_posts/2012-03-14-layout-hero-image.md +++ b/example/_posts/2012-03-14-layout-hero-image.md @@ -1,8 +1,6 @@ --- title: "Layout: Hero Image" -image: - path: /assets/images/eder-oliveira-180877.jpg - caption: "Right [here](https://apple.com)" +image: /assets/images/eder-oliveira-180877.jpg categories: - Layout tags: