Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boyvanamstel/jekyll-gensocial
A Jekyll plugin that automatically generates images that will be used when your links are shared on social media.
https://github.com/boyvanamstel/jekyll-gensocial
jekyll jekyll-plugin seo social-media
Last synced: about 1 month ago
JSON representation
A Jekyll plugin that automatically generates images that will be used when your links are shared on social media.
- Host: GitHub
- URL: https://github.com/boyvanamstel/jekyll-gensocial
- Owner: boyvanamstel
- License: mit
- Created: 2020-04-06T18:12:32.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-07-23T11:07:25.000Z (over 1 year ago)
- Last Synced: 2024-10-01T15:49:46.348Z (about 1 month ago)
- Topics: jekyll, jekyll-plugin, seo, social-media
- Language: Ruby
- Homepage: https://jekyll-gensocial.netlify.com/
- Size: 710 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Jekyll Gensocial
[![Gem Version](https://badge.fury.io/rb/jekyll-gensocial.svg)](https://badge.fury.io/rb/jekyll-gensocial)
A Jekyll plugin that automatically generates images that will be used when your links are shared on social media.
![An image generated by this plugin](https://raw.githubusercontent.com/boyvanamstel/jekyll-gensocial/master/screenshots/twitter.png)
_^ Here's an example._## Installation
### Dependencies
First install ImageMagick (and GhostScript if you don't supply your own font):
#### macOS
```bash
brew install pkg-config imagemagick [gs]
```#### Linux and Windows
_Haven't tried yet. If you have, please submit a PR._
### Jekyll
Add `gem "jekyll-gensocial"` to the `:jekyll_plugins` group in your `Gemfile`:
```ruby
# Gemfilegroup :jekyll_plugins do
gem "jekyll-gensocial"
end
```Add these lines to your site's `_config.yml`:
```yml
# _config.ymlplugins:
- jekyll-gensocial
```## Usage
You can customize the image's background layer and text appearance from your `_config.yml`.
```yaml
# _config.ymljekyll-gensocial: # These are the default settings
enabled: true # Disables the output
size: # The size of the overall canvas
width: 1920
height: 1080
background: # The background image
path: nil
text:
string: nil # Overrides the post/page title
font_path: nil # Path to your custom font
pointsize: 100 # Font size
fill: "#000000" # Font color
rect: # Text will appear inside this frame
size:
width: 1600
height: 500
origin:
x: 150
y: 100
```Set the `image` front matter in the posts and pages that you want to generate images for.
```yaml
# _posts/2020-03-19-macdevsclub.md---
layout: post
title: "Your #1 resource for building, distributing and selling Mac apps. Visit macdevs.club!"
date: 2020-03-19
categories: [swift-ui]
image: assets/img/macdevsclub.jpg
---The contents of your post goes here.
```After building the site, an image will appear in `[your site's source]/assets/img/macdevsclub.jpg`.
The plugin generates images in the source directory per default. This enables post-processors to minify and optimize the files if needed.
### Overrides
You can override the default settings on a per post/page basis.
```yaml
# _posts/2020-03-19-macdevsclub.md---
layout: post
title: "Your #1 resource for building, distributing and selling Mac apps. Visit macdevs.club!"
date: 2020-03-19
categories: [swift-ui]
image: assets/img/macdevsclub.jpg
jekyll-gensocial:
text:
string: "Let's display something else"
fill: "#ff0000" # And make it red
---The contents of your post goes here.
```### Example
```yaml
# _config.ymljekyll-gensocial:
background:
path: "_assets/img/gensocial_bg.jpg"
text:
fill: "#2d3748"
font_path: "_assets/fonts/Lato-Regular.ttf"
```![The settings used by macdevs.club](https://raw.githubusercontent.com/boyvanamstel/jekyll-gensocial/master/screenshots/macdevsclub.jpg)
## Purpose
Used in conjuction with the [`jekyll-seo-tag`](https://github.com/jekyll/jekyll-seo-tag) plugin, this automatically improves how your links look when shared online.
Instead of having to create a new image for every page and post, why not automate the process.
## Development
After checking out the repo, run `script/bootstrap` to install dependencies. Then, run `bundle exec rake spec` to run the tests.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `lib/jekyll-gensocial/version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/boyvanamstel/jekyll-gensocial. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to behave appropriately.
### Stuff to work on
- [ ] Expand testing to verify generated images.
- [ ] Add support for setting a background color (instead of just an image).
- [x] Don't overwrite existing images per default.
- [ ] Introduce a way to update images that have changed.## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).