Skip to content

Commit

Permalink
Add feature about feature image has a link address
Browse files Browse the repository at this point in the history
  • Loading branch information
leiming committed Oct 25, 2014
1 parent b4ca8dd commit d5ddb20
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,13 @@ A good rule of thumb is to keep feature images nice and wide so you don't push t

``` yaml
image:
# local image
feature: feature-image-filename.jpg
# link image
feature: "http(s)://image.domain.com/feature-image-filename.jpg"
```

This makes the assumption that the feature image is in the *images* folder. To add a feature image to a post or page just include the filename in the front matter like so.
This makes the assumption that the feature image is in the *images* folder unless it has a link address. To add a feature image to a post or page just include the filename in the front matter like so.
You can "serve" images responsively with retina.js. All you need to do is have a file with @2x before the file type. That should be placed in the *images* folder. You literally don't have to do anything other than that. 2 copies. One is linked. That's it.
Ex:
`cool-photo@2x.jpg`
Expand Down
4 changes: 4 additions & 0 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

{% if page.image.feature %}
<div class="overlay"></div>
{% if page.image.feature contains 'https://' | escape or page.image.feature contains 'http://' | escape %}
<div class="featured-image" style="background-image: url({{ page.image.feature }})"></div>
{% else %}
<div class="featured-image" style="background-image: url({{ site.url }}/images/{{ page.image.feature }})"></div>
{% endif %}
{% else %}
<div class="overlay"></div>
<div class="featured-image" style="background-image: url({{ site.url }}/images/typewriter.jpg)"></div>
Expand Down
2 changes: 1 addition & 1 deletion _posts/2013-08-05-post-with-feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: "In my younger and more vulnerable years my father gave me some adv
category: articles
tags: [intro, beginner, jekyll, tutorial]
image:
feature: gatsby.jpg
feature: "https://farm8.staticflickr.com/7014/6840341477_e49612bc59_o_d.jpg"
---

“Whenever you feel like criticizing any one,” he told me, “just remember that all the people in this world haven’t had the advantages that you’ve had.”
Expand Down

0 comments on commit d5ddb20

Please sign in to comment.