jekyll-bits

jekyll-bits

Jekyll plugin with simple and nice tools for better blogging

It's a collection of very simply and useful Jekyll plugins, which I'm using on my blog.

ATTENTION: You can't use this plugin with GitHub Pages.

To start, add it to your _config.yml:

gems:
  - jekyll-bits

jb_picture

Add this to the front matter of your Jekyll page:

---
jb_picture: http://...
---

Or with more details:

---
jb_picture:
  src: SRC attribute of <IMG> (mandatory)
  alt: ALT attribute of <IMG> (optional)
  href: HREF attribute of <A> (optional)
  caption: text of <FIGCAPTION> (optional)
  width: width in pixels (optional)
  height: height in pixels (optional)
---

Then, in the HTML <head>:

{{ page | jb_picture_head }}

This meta information will be rendered:

<meta property='og:image' content='...'/>

Then, in the HTML <body>:

{{ page | jb_picture_body }}

Or this way:

{% jb_picture_body %}

Something like that will be rendered:

<figure class='jb_picture'>
  <a href='...'>
    <img alt='...' src='...'/>
  </a>
  <figcaption>...</figcaption>
</figure>

You can also define your picture URL in image, for example:

---
image: /images/2017/01/hello-world.jpg
jb_picture:
  alt: Hello, world!
  caption: This is my hello world picture for you
  width: 1280
  height: 800
---

License

(The MIT License)

Copyright (c) 2016 Yegor Bugayenko

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.