jekyll-devto 0.2.0 → 0.3.1
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/CHANGELOG.md +18 -0
- data/README.md +8 -2
- data/lib/jekyll/devto/feed.xml +20 -5
- data/lib/jekyll/devto/html.rb +18 -2
- data/lib/jekyll/devto/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: 9b8f57cf2fb543865943e101591c785ab55fa902cd77ea72a8022aa71d347074
|
|
4
|
+
data.tar.gz: 1f1797416470e4cb8391503f5141a19576091d96a0488150836e49df601a8b09
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9c6e5bea0a3edeaaa4ae757b432f0b43f3f2dcbb6b9997896e35ba27292e71b71805df4bc1040fef658c8b92b41a419c16a40ca5484b8492a9f0e8d1bc3db864
|
|
7
|
+
data.tar.gz: e84f567be97bcf106a10b0145483db93c2fb19d9ab04e308bf00e71ca5ad7eeeab031a34ce7a8732a4c693c48f5e9706a08cf7116b7b0af4873d99457e0a1951
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.1](https://github.com/JuanVqz/jekyll-devto/compare/v0.3.0...v0.3.1) (2026-10-02)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **feed:** ignore front matter values of the wrong type instead of crashing ([#16](https://github.com/JuanVqz/jekyll-devto/issues/16)) ([a890385](https://github.com/JuanVqz/jekyll-devto/commit/a890385ad4427fb2875f78e723d4f750eadcfb6b))
|
|
9
|
+
|
|
10
|
+
## [0.3.0](https://github.com/JuanVqz/jekyll-devto/compare/v0.2.0...v0.3.0) (2026-10-02)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### ⚠ BREAKING CHANGES
|
|
14
|
+
|
|
15
|
+
* **feed:** posts no longer get their image as the dev.to cover by default. Set devto: { cover: image } in _config.yml to keep the 0.2.0 behavior.
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **feed:** add a dev.to cover only when asked for ([#14](https://github.com/JuanVqz/jekyll-devto/issues/14)) ([9e9b43f](https://github.com/JuanVqz/jekyll-devto/commit/9e9b43f9422cee3ef4fd7a47aa483347bf5bfde8))
|
|
20
|
+
|
|
3
21
|
## [0.2.0](https://github.com/JuanVqz/jekyll-devto/compare/v0.1.0...v0.2.0) (2026-10-02)
|
|
4
22
|
|
|
5
23
|
|
data/README.md
CHANGED
|
@@ -49,16 +49,22 @@ All optional.
|
|
|
49
49
|
devto:
|
|
50
50
|
path: "/devto.xml" # where the feed is written
|
|
51
51
|
limit: 20 # newest posts to include (default: all)
|
|
52
|
+
cover: image # use each post's image as its dev.to cover (default: no cover)
|
|
52
53
|
```
|
|
53
54
|
|
|
54
55
|
To keep a post off dev.to, set `devto: false` in its front matter.
|
|
55
56
|
|
|
56
|
-
**Cover image.**
|
|
57
|
+
**Cover image.** No cover by default. Many Open Graph images, including the ones [jekyll-og-image](https://github.com/igor-alexandrov/jekyll-og-image) and Chirpy produce, already carry the post title, which dev.to shows right under the cover, and without a cover dev.to generates its own share image. To add one:
|
|
58
|
+
|
|
59
|
+
- `devto_cover:` on a post sets that post's cover, and always wins. `devto_cover: true` uses the post's `image`, and `devto_cover: false` turns the cover off for that post.
|
|
60
|
+
- `cover: image` under `devto:` in `_config.yml` uses each post's `image` (a path, a URL, or `{ path: ... }`) for every post, for sites whose images have no title on them.
|
|
57
61
|
|
|
58
62
|
```yaml
|
|
59
|
-
devto_cover: /assets/img/devto-cover.png # optional
|
|
63
|
+
devto_cover: /assets/img/devto-cover.png # optional, per post
|
|
60
64
|
```
|
|
61
65
|
|
|
66
|
+
`jekyll-devto publish` adds the cover to the draft; a cover already set on the dev.to draft is kept. dev.to crops covers to 1000×420.
|
|
67
|
+
|
|
62
68
|
**Tags and series.** dev.to keeps only the first four tags, as lowercase letters and digits (`tailwind-css` becomes `tailwindcss`). `devto_tags` picks them for dev.to; it is used for the import and also replaces the tags of a draft that was already imported. `devto_series` puts the post in a dev.to series, created if it does not exist; a series already set on the draft is kept.
|
|
63
69
|
|
|
64
70
|
```yaml
|
data/lib/jekyll/devto/feed.xml
CHANGED
|
@@ -29,17 +29,32 @@
|
|
|
29
29
|
<category>{{ tag | xml_escape }}</category>
|
|
30
30
|
{%- endfor %}
|
|
31
31
|
<description>{{ post.description | default: post.excerpt | strip_html | strip_newlines | truncatewords: 60 | xml_escape }}</description>
|
|
32
|
-
{%- comment -%}
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
{%- comment -%}
|
|
33
|
+
The dev.to cover is opt-in: many Open Graph images carry the post title, which dev.to
|
|
34
|
+
already shows under the cover, and without one dev.to generates its own share image.
|
|
35
|
+
devto_cover on a post always wins (false turns it off, true uses the post image);
|
|
36
|
+
`devto: { cover: image }` in _config.yml uses each post's image. Unlike content
|
|
37
|
+
links, image paths leave baseurl out (Chirpy and jekyll-og-image add it when
|
|
38
|
+
rendering), so the cover needs it.
|
|
39
|
+
{%- endcomment -%}
|
|
40
|
+
{%- assign cover = "" %}
|
|
41
|
+
{%- if post.devto_cover == false %}
|
|
42
|
+
{%- elsif post.devto_cover == true %}
|
|
43
|
+
{%- assign cover = post.image | devto_url: site_root %}
|
|
44
|
+
{%- elsif post.devto_cover %}
|
|
45
|
+
{%- assign cover = post.devto_cover | devto_url: site_root %}
|
|
46
|
+
{%- elsif devto.cover == "image" or devto.cover == true %}
|
|
47
|
+
{%- assign cover = post.image | devto_url: site_root %}
|
|
48
|
+
{%- endif %}
|
|
35
49
|
{%- if cover != "" %}
|
|
36
50
|
<devto:cover>{{ cover | xml_escape }}</devto:cover>
|
|
37
51
|
{%- endif %}
|
|
38
52
|
{%- if devto_tags %}
|
|
39
53
|
<devto:tags>{{ devto_tags | join: "," | xml_escape }}</devto:tags>
|
|
40
54
|
{%- endif %}
|
|
41
|
-
{%-
|
|
42
|
-
|
|
55
|
+
{%- assign devto_series = post.devto_series | devto_text %}
|
|
56
|
+
{%- if devto_series %}
|
|
57
|
+
<devto:series>{{ devto_series | xml_escape }}</devto:series>
|
|
43
58
|
{%- endif %}
|
|
44
59
|
<content:encoded>{{ post.content | devto_html: site_url | xml_escape }}</content:encoded>
|
|
45
60
|
</item>
|
data/lib/jekyll/devto/html.rb
CHANGED
|
@@ -87,7 +87,12 @@ module Jekyll
|
|
|
87
87
|
# { "path" => ... } hash; nil when there is nothing to point at.
|
|
88
88
|
def absolute_url(value, base_url)
|
|
89
89
|
path = value.is_a?(Hash) ? value['path'] : value
|
|
90
|
-
|
|
90
|
+
# Front matter is YAML, so this can be true, a number or a list; only a
|
|
91
|
+
# string is a path, anything else is ignored rather than crashing the build.
|
|
92
|
+
return unless path.is_a?(String)
|
|
93
|
+
|
|
94
|
+
path = path.strip
|
|
95
|
+
return if path.empty?
|
|
91
96
|
return path if path.match?(%r{\Ahttps?://})
|
|
92
97
|
return "#{base_url.to_s[/\A[a-z][a-z0-9+.-]*:/i] || 'https:'}#{path}" if path.start_with?('//')
|
|
93
98
|
|
|
@@ -126,11 +131,22 @@ module Jekyll
|
|
|
126
131
|
# string ("ruby, rails" or "ruby rails", as Jekyll accepts for tags), so
|
|
127
132
|
# the import and the publisher see the same tags. nil when there are none.
|
|
128
133
|
def devto_list(value)
|
|
129
|
-
list =
|
|
134
|
+
list = case value
|
|
135
|
+
when Array then value.filter_map { |item| devto_text(item) }
|
|
136
|
+
when String, Numeric then value.to_s.split(/[,\s]+/)
|
|
137
|
+
else []
|
|
138
|
+
end
|
|
130
139
|
list = list.map(&:strip).reject(&:empty?)
|
|
131
140
|
list unless list.empty?
|
|
132
141
|
end
|
|
133
142
|
|
|
143
|
+
# A front matter value as text when it is one (a string or a number);
|
|
144
|
+
# nil for true, false, lists and hashes, which mean nothing as a name.
|
|
145
|
+
def devto_text(value)
|
|
146
|
+
text = value.to_s.strip if value.is_a?(String) || value.is_a?(Numeric)
|
|
147
|
+
text unless text.to_s.empty?
|
|
148
|
+
end
|
|
149
|
+
|
|
134
150
|
def devto_url(value, base_url)
|
|
135
151
|
HTML.absolute_url(value, base_url).to_s
|
|
136
152
|
end
|
data/lib/jekyll/devto/version.rb
CHANGED