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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7eaa43e9e984aefab405ab170aef846da58afe0dc6bf1412e5fd9b636fe8b4c7
4
- data.tar.gz: 4266e706d4b3a5fbae71b693223e2a3e9bc9fedc5c871c5d11cb2cf2ec1fb863
3
+ metadata.gz: ea51d4a05adcc40de23c17b92e31139f154176500960782aa592864c71cbd334
4
+ data.tar.gz: a31cc539176deac7ad1e8fd0dea3b4fd45efd906a02d439766e8df82d80adceb
5
5
  SHA512:
6
- metadata.gz: 7c478ecd6a8c6a4182b8d6c0bca7f3cf8518982c56a41c3d0365a21ff79bcc322e0990b4a3f1f6af86ca3d05bd358c2cc1ec065dbbb9cdd5e20d69cedbb32c7d
7
- data.tar.gz: 493a88fae8b56c653e7968d2f9a4e1d4e406e3559ced57438d4be93fce146f8c668f4aa7e1b2991a612f79f7f651b69bcd8bad8d57165467bd2b14d8086db32e
6
+ metadata.gz: 5e3929c8ddee908ae78375186bacffab40da5813432d4a563ab4f61b5767b011cf69959842a0e2f05f4b6d899029d08aec3c9d531154162ef4de6cb2a4ba4c99
7
+ data.tar.gz: 2470a7946363160ebfebc258c5326089976b91a620d2bde2edc35c76149eec1a6d6f0d739812e8917e96b1910fa13a53c7c9e15198688207ebaef5f61a04cce2
data/.rubocop.yml CHANGED
@@ -7,4 +7,7 @@ AllCops:
7
7
 
8
8
  Style/FrozenStringLiteralComment:
9
9
  Enabled: true
10
- EnforcedStyle: always
10
+ EnforcedStyle: always
11
+
12
+ Rails/RefuteMethods:
13
+ Enabled: false
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 "rspec/core/rake_task"
4
+ require "minitest/test_task"
5
5
 
6
- RSpec::Core::RakeTask.new(:spec)
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[spec rubocop]
12
+ task default: %i[test rubocop]
@@ -53,6 +53,10 @@ class JekyllOgImage::Configuration
53
53
  @raw_config["collections"] || [ "posts" ]
54
54
  end
55
55
 
56
+ def enabled?
57
+ @raw_config["enabled"].nil? ? true : @raw_config["enabled"]
58
+ end
59
+
56
60
  def output_dir
57
61
  @raw_config["output_dir"] || "assets/images/og"
58
62
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllOgImage
4
- VERSION = "1.6.0"
4
+ VERSION = "2.0.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-og-image
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Alexandrov