jekyll-post-card 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8d12dec9ffb29d9ce43f99cb3aa3adcb9748ae7d23977d43e41fffc7c0f03684
4
+ data.tar.gz: 4c9942a1ffd67c49f57fa373a62aca0e008af7527d2acf4baec39c27369f724d
5
+ SHA512:
6
+ metadata.gz: 7d76e329ba5bfd01d64fcac538215e0181c1e6664331a413c760bf6f10cf862387552eaa339e0b8b8f3940f0eefba7f438193ee539c7b77d5aad65907d160251
7
+ data.tar.gz: afbce464b3c32fe4ae9464332dfa0e2d9337268bc36391992f3238f3faefbba3a28931077a787b061b9a31542d16810ba4234932f8f10cde939c0bc56884cc91
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Your Name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,177 @@
1
+ # Jekyll Post Card
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/jekyll-post-card.svg)](https://badge.fury.io/rb/jekyll-post-card)
4
+ [![Demo](https://img.shields.io/badge/Demo-Live-brightgreen)](https://r0x0d.github.io/jekyll-post-card/)
5
+
6
+ A Jekyll plugin to display beautiful, responsive post cards in your Markdown. Works with both internal Jekyll posts and external URLs.
7
+
8
+ **[📺 View Live Demo](https://r0x0d.github.io/jekyll-post-card/)**
9
+
10
+ ## Features
11
+
12
+ - 📝 **Internal Posts** - Link to posts within your Jekyll site using permalinks
13
+ - 🌐 **External URLs** - Automatically fetches metadata (title, description, image) from any URL
14
+ - 🎨 **Multiple Variants** - Default, compact, and vertical card layouts
15
+ - 🌙 **Theme Support** - Built-in light and dark theme CSS variables
16
+ - 📱 **Responsive** - Cards look great on all screen sizes
17
+ - ⚡ **Open Graph & Twitter Cards** - Extracts metadata from standard meta tags
18
+
19
+ ## Installation
20
+
21
+ Add this line to your application's Gemfile:
22
+
23
+ ```ruby
24
+ gem 'jekyll-post-card'
25
+ ```
26
+
27
+ And then execute:
28
+
29
+ ```bash
30
+ bundle install
31
+ ```
32
+
33
+ Or install it yourself:
34
+
35
+ ```bash
36
+ gem install jekyll-post-card
37
+ ```
38
+
39
+ Then add the plugin to your `_config.yml`:
40
+
41
+ ```yaml
42
+ plugins:
43
+ - jekyll-post-card
44
+ ```
45
+
46
+ ## Usage
47
+
48
+ ### Basic Usage
49
+
50
+ **Internal post (by permalink):**
51
+
52
+ ```liquid
53
+ {% post_card /2024/01/15/my-awesome-post %}
54
+ ```
55
+
56
+ **External URL:**
57
+
58
+ ```liquid
59
+ {% post_card https://dev.to/example/great-article %}
60
+ ```
61
+
62
+ ### Variants
63
+
64
+ **Compact card:**
65
+
66
+ ```liquid
67
+ {% post_card /my-post variant:compact %}
68
+ ```
69
+
70
+ **Vertical card:**
71
+
72
+ ```liquid
73
+ {% post_card /my-post variant:vertical %}
74
+ ```
75
+
76
+ ### Options
77
+
78
+ **Hide the image:**
79
+
80
+ ```liquid
81
+ {% post_card /my-post hide_image:true %}
82
+ ```
83
+
84
+ You can combine options:
85
+
86
+ ```liquid
87
+ {% post_card /my-post variant:compact hide_image:true %}
88
+ ```
89
+
90
+ ### Styling
91
+
92
+ The plugin automatically copies `post-card.css` to your site's `assets/css/` folder during build.
93
+
94
+ **Add the CSS to your layout:**
95
+
96
+ ```html
97
+ <link rel="stylesheet" href="{{ '/assets/css/post-card.css' | relative_url }}">
98
+ ```
99
+
100
+ Or import it in your main SCSS file:
101
+
102
+ ```scss
103
+ @import "post-card";
104
+ ```
105
+
106
+ The CSS uses CSS variables for easy theming:
107
+
108
+ ```css
109
+ :root {
110
+ --post-card-bg: #ffffff;
111
+ --post-card-bg-hover: #fff8f0;
112
+ --post-card-text: #2d2a26;
113
+ --post-card-text-secondary: #5a5650;
114
+ --post-card-text-muted: #8a8680;
115
+ --post-card-accent: #d35400;
116
+ --post-card-border: rgba(211, 84, 0, 0.15);
117
+ --post-card-shadow: rgba(45, 42, 38, 0.12);
118
+ --post-card-placeholder-bg: #f0ebe3;
119
+ }
120
+ ```
121
+
122
+ For dark mode, add the `.dark` class to your body or a parent element, or override the variables.
123
+
124
+ ### Post Front Matter
125
+
126
+ For internal posts, the plugin reads these front matter fields:
127
+
128
+ ```yaml
129
+ ---
130
+ title: "My Post Title"
131
+ excerpt: "A short description of the post"
132
+ image: "/images/featured.jpg" # or thumbnail, og_image
133
+ date: 2024-01-15
134
+ ---
135
+ ```
136
+
137
+ ### Grid Layouts
138
+
139
+ Display multiple cards side by side using CSS Grid:
140
+
141
+ ```html
142
+ <div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px;">
143
+ {% post_card /post-one %}
144
+ {% post_card /post-two %}
145
+ </div>
146
+ ```
147
+
148
+ ## Demo
149
+
150
+ **[View the live demo →](https://r0x0d.github.io/jekyll-post-card/)**
151
+
152
+ Or open `demo.html` locally in your browser to see all card variants and layouts.
153
+
154
+ ## Development
155
+
156
+ After checking out the repo, run `bundle install` to install dependencies.
157
+
158
+ Run tests:
159
+
160
+ ```bash
161
+ bundle exec rake test
162
+ ```
163
+
164
+ Build the gem:
165
+
166
+ ```bash
167
+ gem build jekyll-post-card.gemspec
168
+ ```
169
+
170
+ ## Contributing
171
+
172
+ Bug reports and pull requests are welcome on GitHub at https://github.com/r0x0d/jekyll-post-card.
173
+
174
+ ## License
175
+
176
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
177
+
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/test_*.rb"]
10
+ end
11
+
12
+ task default: :test
13
+
@@ -0,0 +1,364 @@
1
+ /* Jekyll Post Card - Styles
2
+ * https://github.com/r0x0d/jekyll-post-card
3
+ *
4
+ * Include this file in your Jekyll site to style post cards.
5
+ * You can customize the CSS variables to match your theme.
6
+ * Compatible with Jekyll Chirpy theme.
7
+ */
8
+
9
+ :root {
10
+ /* Light theme (default) */
11
+ --post-card-bg: #ffffff;
12
+ --post-card-bg-hover: #fef9f5;
13
+ --post-card-text: #1b1b1b;
14
+ --post-card-text-secondary: #5a5a5a;
15
+ --post-card-text-muted: #868686;
16
+ --post-card-accent: #d35400;
17
+ --post-card-border: rgba(0, 0, 0, 0.1);
18
+ --post-card-shadow: rgba(0, 0, 0, 0.08);
19
+ --post-card-placeholder-bg: #f5f5f5;
20
+ }
21
+
22
+ /* Dark theme - Chirpy uses [data-mode="dark"] on html element */
23
+ [data-mode="dark"],
24
+ .dark,
25
+ html[data-mode="dark"] body {
26
+ --post-card-bg: #1e1e1e;
27
+ --post-card-bg-hover: #2a2a2a;
28
+ --post-card-text: #d3d3d3;
29
+ --post-card-text-secondary: #a0a0a0;
30
+ --post-card-text-muted: #707070;
31
+ --post-card-accent: #e94560;
32
+ --post-card-border: rgba(255, 255, 255, 0.1);
33
+ --post-card-shadow: rgba(0, 0, 0, 0.3);
34
+ --post-card-placeholder-bg: #2d2d2d;
35
+ }
36
+
37
+ /* Auto dark mode via prefers-color-scheme */
38
+ @media (prefers-color-scheme: dark) {
39
+ :root:not([data-mode="light"]) {
40
+ --post-card-bg: #1e1e1e;
41
+ --post-card-bg-hover: #2a2a2a;
42
+ --post-card-text: #d3d3d3;
43
+ --post-card-text-secondary: #a0a0a0;
44
+ --post-card-text-muted: #707070;
45
+ --post-card-accent: #e94560;
46
+ --post-card-border: rgba(255, 255, 255, 0.1);
47
+ --post-card-shadow: rgba(0, 0, 0, 0.3);
48
+ --post-card-placeholder-bg: #2d2d2d;
49
+ }
50
+ }
51
+
52
+ /* Post Card Base Styles */
53
+ .post-card {
54
+ display: block !important;
55
+ background: var(--post-card-bg) !important;
56
+ border: 1px solid var(--post-card-border) !important;
57
+ border-radius: 16px !important;
58
+ overflow: hidden !important;
59
+ transition: all 0.3s ease !important;
60
+ box-shadow: 0 4px 20px var(--post-card-shadow) !important;
61
+ margin: 24px 0 !important;
62
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
63
+ line-height: 1.5 !important;
64
+ padding: 0 !important;
65
+ }
66
+
67
+ .post-card:hover {
68
+ transform: translateY(-4px) !important;
69
+ background: var(--post-card-bg-hover) !important;
70
+ border-color: var(--post-card-accent) !important;
71
+ box-shadow: 0 12px 40px var(--post-card-shadow), 0 0 0 1px var(--post-card-accent) !important;
72
+ }
73
+
74
+ /* The link wrapper inside the card */
75
+ .post-card .post-card-link,
76
+ .post-card > a.post-card-link {
77
+ display: block !important;
78
+ text-decoration: none !important;
79
+ color: inherit !important;
80
+ background: transparent !important;
81
+ border: none !important;
82
+ padding: 0 !important;
83
+ margin: 0 !important;
84
+ }
85
+
86
+ .post-card .post-card-link:hover,
87
+ .post-card > a.post-card-link:hover {
88
+ text-decoration: none !important;
89
+ color: inherit !important;
90
+ }
91
+
92
+ /* Reset Chirpy link styles */
93
+ .post-card .post-card-link::before,
94
+ .post-card .post-card-link::after,
95
+ .post-card a::before,
96
+ .post-card a::after {
97
+ display: none !important;
98
+ content: none !important;
99
+ }
100
+
101
+ .post-card .post-card-inner {
102
+ display: flex !important;
103
+ gap: 0 !important;
104
+ position: relative !important;
105
+ flex-direction: row !important;
106
+ }
107
+
108
+ /* Image Container */
109
+ .post-card .post-card-image-container {
110
+ flex-shrink: 0 !important;
111
+ width: 200px !important;
112
+ height: 160px !important;
113
+ min-height: 160px !important;
114
+ max-height: 160px !important;
115
+ overflow: hidden !important;
116
+ position: relative !important;
117
+ margin: 0 !important;
118
+ padding: 0 !important;
119
+ background: var(--post-card-placeholder-bg) !important;
120
+ }
121
+
122
+ /* Handle Chirpy's lightbox wrapper around images */
123
+ .post-card .post-card-image-container a,
124
+ .post-card .post-card-image-container a.popup,
125
+ .post-card .post-card-image-container a.img-link,
126
+ .post-card .post-card-image-container a.shimmer {
127
+ display: contents !important;
128
+ pointer-events: none !important;
129
+ }
130
+
131
+ /* Reset shimmer animation that hides the image */
132
+ .post-card .post-card-image-container a.shimmer::before,
133
+ .post-card .post-card-image-container a.shimmer::after,
134
+ .post-card .post-card-image-container a::before,
135
+ .post-card .post-card-image-container a::after {
136
+ display: none !important;
137
+ content: none !important;
138
+ opacity: 0 !important;
139
+ visibility: hidden !important;
140
+ }
141
+
142
+ .post-card .post-card-image,
143
+ .post-card .post-card-image-container img,
144
+ .post-card .post-card-image-container a img {
145
+ width: 200px !important;
146
+ height: 160px !important;
147
+ min-width: 200px !important;
148
+ min-height: 160px !important;
149
+ object-fit: cover !important;
150
+ transition: transform 0.4s ease !important;
151
+ margin: 0 !important;
152
+ padding: 0 !important;
153
+ border-radius: 0 !important;
154
+ display: block !important;
155
+ opacity: 1 !important;
156
+ visibility: visible !important;
157
+ position: relative !important;
158
+ z-index: 1 !important;
159
+ }
160
+
161
+ .post-card:hover .post-card-image,
162
+ .post-card:hover .post-card-image-container img {
163
+ transform: scale(1.05) !important;
164
+ }
165
+
166
+ .post-card .post-card-placeholder {
167
+ width: 100% !important;
168
+ height: 100% !important;
169
+ background: var(--post-card-placeholder-bg) !important;
170
+ display: flex !important;
171
+ align-items: center !important;
172
+ justify-content: center !important;
173
+ }
174
+
175
+ .post-card .post-card-placeholder svg {
176
+ width: 48px !important;
177
+ height: 48px !important;
178
+ opacity: 0.3 !important;
179
+ }
180
+
181
+ .post-card .post-card-placeholder svg path {
182
+ fill: var(--post-card-text-muted) !important;
183
+ }
184
+
185
+ /* Content */
186
+ .post-card .post-card-content {
187
+ flex: 1 !important;
188
+ padding: 20px 24px !important;
189
+ display: flex !important;
190
+ flex-direction: column !important;
191
+ justify-content: center !important;
192
+ min-width: 0 !important;
193
+ background: transparent !important;
194
+ }
195
+
196
+ .post-card .post-card-meta {
197
+ display: flex !important;
198
+ align-items: center !important;
199
+ gap: 12px !important;
200
+ margin-bottom: 10px !important;
201
+ flex-wrap: wrap !important;
202
+ }
203
+
204
+ .post-card .post-card-source {
205
+ display: inline-flex !important;
206
+ align-items: center !important;
207
+ gap: 6px !important;
208
+ font-size: 0.7rem !important;
209
+ font-weight: 600 !important;
210
+ text-transform: uppercase !important;
211
+ letter-spacing: 0.08em !important;
212
+ color: var(--post-card-accent) !important;
213
+ background: rgba(211, 84, 0, 0.1) !important;
214
+ padding: 4px 10px !important;
215
+ border-radius: 6px !important;
216
+ margin: 0 !important;
217
+ }
218
+
219
+ [data-mode="dark"] .post-card .post-card-source,
220
+ .dark .post-card .post-card-source {
221
+ background: rgba(233, 69, 96, 0.15) !important;
222
+ }
223
+
224
+ .post-card .post-card-source svg {
225
+ width: 12px !important;
226
+ height: 12px !important;
227
+ }
228
+
229
+ .post-card .post-card-source svg path {
230
+ fill: currentColor !important;
231
+ }
232
+
233
+ .post-card .post-card-date {
234
+ font-size: 0.8rem !important;
235
+ color: var(--post-card-text-muted) !important;
236
+ margin: 0 !important;
237
+ }
238
+
239
+ .post-card .post-card-title,
240
+ .post-card h3.post-card-title {
241
+ font-size: 1.25rem !important;
242
+ font-weight: 600 !important;
243
+ line-height: 1.35 !important;
244
+ margin: 0 0 8px 0 !important;
245
+ padding: 0 !important;
246
+ color: var(--post-card-text) !important;
247
+ overflow: hidden !important;
248
+ text-overflow: ellipsis !important;
249
+ display: -webkit-box !important;
250
+ -webkit-line-clamp: 2 !important;
251
+ -webkit-box-orient: vertical !important;
252
+ font-family: Georgia, "Times New Roman", Times, serif !important;
253
+ border: none !important;
254
+ background: transparent !important;
255
+ }
256
+
257
+ .post-card .post-card-excerpt,
258
+ .post-card p.post-card-excerpt {
259
+ font-size: 0.875rem !important;
260
+ color: var(--post-card-text-secondary) !important;
261
+ line-height: 1.5 !important;
262
+ margin: 0 !important;
263
+ padding: 0 !important;
264
+ overflow: hidden !important;
265
+ text-overflow: ellipsis !important;
266
+ display: -webkit-box !important;
267
+ -webkit-line-clamp: 2 !important;
268
+ -webkit-box-orient: vertical !important;
269
+ }
270
+
271
+ /* Arrow indicator */
272
+ .post-card .post-card-arrow {
273
+ position: absolute !important;
274
+ right: 16px !important;
275
+ top: 50% !important;
276
+ transform: translateY(-50%) translateX(-8px) !important;
277
+ opacity: 0 !important;
278
+ transition: all 0.3s ease !important;
279
+ color: var(--post-card-accent) !important;
280
+ }
281
+
282
+ .post-card:hover .post-card-arrow {
283
+ opacity: 1 !important;
284
+ transform: translateY(-50%) translateX(0) !important;
285
+ }
286
+
287
+ .post-card .post-card-arrow svg {
288
+ width: 20px !important;
289
+ height: 20px !important;
290
+ }
291
+
292
+ /* Compact variant */
293
+ .post-card.compact .post-card-image-container {
294
+ width: 120px !important;
295
+ height: 100px !important;
296
+ }
297
+
298
+ .post-card.compact .post-card-content {
299
+ padding: 14px 18px !important;
300
+ }
301
+
302
+ .post-card.compact .post-card-title {
303
+ font-size: 1rem !important;
304
+ -webkit-line-clamp: 1 !important;
305
+ }
306
+
307
+ .post-card.compact .post-card-excerpt {
308
+ -webkit-line-clamp: 1 !important;
309
+ }
310
+
311
+ /* No image variant */
312
+ .post-card.no-image .post-card-image-container {
313
+ display: none !important;
314
+ }
315
+
316
+ /* Vertical variant */
317
+ .post-card.vertical .post-card-inner {
318
+ flex-direction: column !important;
319
+ }
320
+
321
+ .post-card.vertical .post-card-image-container {
322
+ width: 100% !important;
323
+ height: 180px !important;
324
+ }
325
+
326
+ /* External link indicator */
327
+ .post-card.external .post-card-source::after {
328
+ content: '↗' !important;
329
+ margin-left: 4px !important;
330
+ font-size: 0.9em !important;
331
+ }
332
+
333
+ /* Error state */
334
+ .post-card.error {
335
+ border-color: rgba(255, 100, 100, 0.3) !important;
336
+ background: rgba(255, 100, 100, 0.05) !important;
337
+ pointer-events: none !important;
338
+ }
339
+
340
+ .post-card.error .post-card-title {
341
+ color: #e74c3c !important;
342
+ }
343
+
344
+ /* Responsive */
345
+ @media (max-width: 600px) {
346
+ .post-card .post-card-inner {
347
+ flex-direction: column !important;
348
+ }
349
+
350
+ .post-card .post-card-image-container {
351
+ width: 100% !important;
352
+ height: 160px !important;
353
+ }
354
+
355
+ .post-card.compact .post-card-inner {
356
+ flex-direction: column !important;
357
+ }
358
+
359
+ .post-card.compact .post-card-image-container {
360
+ width: 100% !important;
361
+ height: 120px !important;
362
+ }
363
+ }
364
+