jekyll-og-image 1.6.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -1
- data/README.md +53 -0
- data/Rakefile +3 -3
- data/lib/jekyll_og_image/configuration.rb +4 -0
- data/lib/jekyll_og_image/generator.rb +3 -0
- data/lib/jekyll_og_image/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea51d4a05adcc40de23c17b92e31139f154176500960782aa592864c71cbd334
|
4
|
+
data.tar.gz: a31cc539176deac7ad1e8fd0dea3b4fd45efd906a02d439766e8df82d80adceb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e3929c8ddee908ae78375186bacffab40da5813432d4a563ab4f61b5767b011cf69959842a0e2f05f4b6d899029d08aec3c9d531154162ef4de6cb2a4ba4c99
|
7
|
+
data.tar.gz: 2470a7946363160ebfebc258c5326089976b91a620d2bde2edc35c76149eec1a6d6f0d739812e8917e96b1910fa13a53c7c9e15198688207ebaef5f61a04cce2
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -22,6 +22,59 @@ plugins:
|
|
22
22
|
- jekyll-og-image
|
23
23
|
```
|
24
24
|
|
25
|
+
This plugin requires `libvips` to be installed. If you are using GitHub Pages to host your Jekyll site, don't forget to install `libvips` before running `jekyll build`. See the example below.
|
26
|
+
|
27
|
+
``` yaml
|
28
|
+
jobs:
|
29
|
+
build:
|
30
|
+
needs:
|
31
|
+
- lint
|
32
|
+
runs-on: ubuntu-latest
|
33
|
+
steps:
|
34
|
+
- name: Checkout
|
35
|
+
uses: actions/checkout@v4
|
36
|
+
|
37
|
+
- name: Setup Ruby
|
38
|
+
uses: ruby/setup-ruby@v1
|
39
|
+
with:
|
40
|
+
ruby-version: .ruby-version
|
41
|
+
bundler-cache: true
|
42
|
+
|
43
|
+
- name: Set Node.js 20.x
|
44
|
+
uses: actions/setup-node@v3
|
45
|
+
with:
|
46
|
+
node-version: 20.x
|
47
|
+
|
48
|
+
- name: Run install
|
49
|
+
uses: borales/actions-yarn@v4
|
50
|
+
with:
|
51
|
+
cmd: install
|
52
|
+
|
53
|
+
- name: Update apt
|
54
|
+
env:
|
55
|
+
DEBIAN_FRONTEND: noninteractive
|
56
|
+
run: sudo apt-get update -qq
|
57
|
+
|
58
|
+
- name: Install libvips
|
59
|
+
env:
|
60
|
+
DEBIAN_FRONTEND: noninteractive
|
61
|
+
run: sudo apt-get install --fix-missing libvips
|
62
|
+
|
63
|
+
- name: Setup Pages
|
64
|
+
id: pages
|
65
|
+
uses: actions/configure-pages@v5
|
66
|
+
|
67
|
+
- name: Build with Jekyll
|
68
|
+
run: ./bin/jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
|
69
|
+
env:
|
70
|
+
JEKYLL_ENV: production
|
71
|
+
|
72
|
+
- name: Upload artifact
|
73
|
+
# Automatically uploads an artifact from the './_site' directory by default
|
74
|
+
uses: actions/upload-pages-artifact@v3
|
75
|
+
|
76
|
+
```
|
77
|
+
|
25
78
|
## Usage
|
26
79
|
|
27
80
|
Jekyll OG Image works together with [jekyll-seo-tag](https://github.com/jekyll/jekyll-seo-tag) plugin. It automatically generates open graph images for posts and inserts them into the posts metadata.
|
data/Rakefile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "bundler/gem_tasks"
|
4
|
-
require "
|
4
|
+
require "minitest/test_task"
|
5
5
|
|
6
|
-
|
6
|
+
Minitest::TestTask.create
|
7
7
|
|
8
8
|
require "rubocop/rake_task"
|
9
9
|
|
10
10
|
RuboCop::RakeTask.new
|
11
11
|
|
12
|
-
task default: %i[
|
12
|
+
task default: %i[test rubocop]
|
@@ -36,6 +36,7 @@ class JekyllOgImage::Generator < Jekyll::Generator
|
|
36
36
|
# rubocop:enable Layout/ElseAlignment
|
37
37
|
File.basename(item.name, File.extname(item.name))
|
38
38
|
end
|
39
|
+
|
39
40
|
slug = item.data["slug"] || Jekyll::Utils.slugify(item.data["title"] || fallback_basename)
|
40
41
|
image_filename = "#{slug}.png"
|
41
42
|
absolute_image_path = File.join(absolute_output_dir, image_filename)
|
@@ -76,6 +77,8 @@ class JekyllOgImage::Generator < Jekyll::Generator
|
|
76
77
|
def generate_image_for_document(site, item, path, base_config)
|
77
78
|
config = base_config.merge!(item.data["og_image"] || {})
|
78
79
|
|
80
|
+
return unless config.enabled?
|
81
|
+
|
79
82
|
canvas = generate_canvas(site, config)
|
80
83
|
canvas = add_border_bottom(canvas, config) if config.border_bottom
|
81
84
|
canvas = add_image(canvas, File.read(File.join(site.config["source"], config.image))) if config.image
|