jekyll-socials 0.0.5 → 0.0.7

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: 8eee1863c3ce0a7fb4e3a46cc46d7756878314a8e30e9d1e42800a4159486649
4
- data.tar.gz: a9770393c010c97d7a6f3351dfbb36da3fe2180fe2fb5f82d8bf78ba484b6389
3
+ metadata.gz: 04ca2a29bb5498da6e1378d39ff5e8c7ebb70eeabe414f55612f1efaf46af2fc
4
+ data.tar.gz: 79fa7fe06c3b312bc5092bb403372b71e9311953f4d158ec19492ed5de7668e3
5
5
  SHA512:
6
- metadata.gz: 1c091e102f13f181424829c26df0de37073720f7f72cd8f1a4c80b7fe42a0e3296dae626b4d632588171ad03f75476253a33744c4d1940059806072b8415796a
7
- data.tar.gz: 2bd908556d35dfb39181e26152a3077755d4435d005b268c49d1d8ed988d538ec0489cd53c35628f979c025a367b4d3f9bf0a5d225ce65ca37a9fa23a5121501
6
+ metadata.gz: 89bcfca08aa0677044ed63c9e8192a4cf1390fb153a2368f499347fc36484973bd3b18f93f6f922e7cc8aaab9e7f8056fa196d7ae8b25316f87bbc96c47d4d2a
7
+ data.tar.gz: 7b37fba8ac5126f286fbe0882e098df0905e68b7a7cc73c948fd6c2ceec64746e4e29c3358c523d90d0c9996d3c1063aec0d41418c6bedf8040e2cd64c67a55a
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Socials
5
- VERSION = "0.0.5"
5
+ VERSION = "0.0.7"
6
6
  end
7
7
  end
@@ -2,6 +2,13 @@
2
2
 
3
3
  module Jekyll
4
4
  class SocialLinksTag < Liquid::Tag
5
+ # Helper method to construct relative URL with baseurl
6
+ def relative_url(path, context)
7
+ return path if path.include?('://')
8
+ baseurl = context.registers[:site].baseurl.to_s
9
+ "#{baseurl}#{path}"
10
+ end
11
+
5
12
  # https://jpswalsh.github.io/academicons/
6
13
  ACADEMICONS = {
7
14
  'academia_edu' => "<i class='ai ai-academia'></i>",
@@ -36,6 +43,7 @@ module Jekyll
36
43
  'kaggle_id' => "<i class='fa-brands fa-kaggle'></i>",
37
44
  'keybase_username' => "<i class='fa-brands fa-keybase'></i>",
38
45
  'lastfm_id' => "<i class='fa-brands fa-lastfm'></i>",
46
+ 'letterboxd_id' => "<i class='fa-brands fa-square-letterboxd'></i>",
39
47
  'linkedin_username' => "<i class='fa-brands fa-linkedin'></i>",
40
48
  'mastodon_username' => "<i class='fa-brands fa-mastodon'></i>",
41
49
  'medium_username' => "<i class='fa-brands fa-medium'></i>",
@@ -87,6 +95,7 @@ module Jekyll
87
95
  'lastfm_id' => "https://www.last.fm/user/%s",
88
96
  'lattes_id' => "http://lattes.cnpq.br/%s",
89
97
  'leetcode_id' => "https://leetcode.com/u/%s/",
98
+ 'letterboxd_id' => "https://letterboxd.com/%s",
90
99
  'linkedin_username' => "https://www.linkedin.com/in/%s",
91
100
  'mastodon_username' => "https://%s",
92
101
  'medium_username' => "https://medium.com/@%s",
@@ -127,42 +136,108 @@ module Jekyll
127
136
  icon = SOCIAL_ICONS[social[0]]
128
137
  url_template = SOCIAL_URLS[social[0]]
129
138
  if icon && url_template
130
- if social[0] == 'academia_edu'
131
- url = url_template % [social[1]['organization'], social[1]['username']]
132
- elsif social[0] == 'cv_pdf'
133
- if social[1] =~ %r{://}
134
- url = social[1]
135
- elsif !context.registers[:site].respond_to?(:active_lang) || !context.registers[:site].active_lang || context.registers[:site].active_lang.empty?
139
+ # Check if user provided custom logo override
140
+ if social[1].is_a?(Hash) && social[1]['logo']
141
+ # Use custom logo for this built-in social
142
+ logo_value = social[1]['logo']
143
+ file_ext = logo_value.split('.').last.downcase
144
+ image_extensions = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg']
145
+
146
+ # Build URL - extract value from hash (support 'value' key or social-specific keys)
147
+ if social[0] == 'academia_edu'
148
+ url = url_template % [social[1]['organization'], social[1]['username']]
149
+ elsif social[0] == 'cv_pdf'
150
+ social_value = social[1]['value'] || social[1][social[0]]
151
+ if social_value =~ %r{://}
152
+ url = social_value
153
+ elsif !context.registers[:site].respond_to?(:active_lang) || !context.registers[:site].active_lang || context.registers[:site].active_lang.empty?
154
+ baseurl = context.registers[:site].baseurl.to_s.empty? ? '' : context.registers[:site].baseurl
155
+ url = baseurl + social_value
156
+ else
157
+ # support for jekyll-polyglot
158
+ baseurl = context.registers[:site].baseurl.to_s.empty? ? '' : context.registers[:site].baseurl
159
+ url = baseurl + social_value.gsub('[LANG]', context.registers[:site].active_lang)
160
+ end
161
+ elsif social[0] == 'rss_icon'
136
162
  baseurl = context.registers[:site].baseurl.to_s.empty? ? '' : context.registers[:site].baseurl
137
- url = baseurl + social[1]
163
+ url = url_template % (baseurl + '/feed.xml')
138
164
  else
139
- # support for jekyll-polyglot
140
- baseurl = context.registers[:site].baseurl.to_s.empty? ? '' : context.registers[:site].baseurl
141
- url = baseurl + social[1].gsub('[LANG]', context.registers[:site].active_lang)
165
+ social_value = social[1]['value'] || social[1][social[0]]
166
+ url = url_template % social_value
167
+ end
168
+
169
+ # Render with custom logo
170
+ if image_extensions.include?(file_ext)
171
+ # It's a file path or URL, render as image
172
+ if file_ext == 'svg'
173
+ if logo_value.include?('://')
174
+ img_code = "<svg><image xlink:href='#{logo_value}' /></svg>"
175
+ else
176
+ img_code = "<svg><image xlink:href='#{relative_url(logo_value, context)}' /></svg>"
177
+ end
178
+ else
179
+ if logo_value.include?('://')
180
+ img_code = "<img src='#{logo_value}' alt='#{social[0].gsub('_', ' ').capitalize}'>"
181
+ else
182
+ img_code = "<img src='#{relative_url(logo_value, context)}' alt='#{social[0].gsub('_', ' ').capitalize}'>"
183
+ end
184
+ end
185
+ "<a href='#{url}' title='#{social[0].gsub('_', ' ').capitalize}'>#{img_code}</a>"
186
+ else
187
+ # It's an icon class string, render as icon (from any font source)
188
+ icon_html = "<i class='#{logo_value}'></i>"
189
+ "<a href='#{url}' title='#{social[0].gsub('_', ' ').capitalize}'>#{icon_html}</a>"
142
190
  end
143
- elsif social[0] == 'rss_icon'
144
- baseurl = context.registers[:site].baseurl.to_s.empty? ? '' : context.registers[:site].baseurl
145
- url = url_template % (baseurl + '/feed.xml')
146
191
  else
147
- url = url_template % social[1]
192
+ # Use default icon for built-in social
193
+ if social[0] == 'academia_edu'
194
+ url = url_template % [social[1]['organization'], social[1]['username']]
195
+ elsif social[0] == 'cv_pdf'
196
+ if social[1] =~ %r{://}
197
+ url = social[1]
198
+ elsif !context.registers[:site].respond_to?(:active_lang) || !context.registers[:site].active_lang || context.registers[:site].active_lang.empty?
199
+ baseurl = context.registers[:site].baseurl.to_s.empty? ? '' : context.registers[:site].baseurl
200
+ url = baseurl + social[1]
201
+ else
202
+ # support for jekyll-polyglot
203
+ baseurl = context.registers[:site].baseurl.to_s.empty? ? '' : context.registers[:site].baseurl
204
+ url = baseurl + social[1].gsub('[LANG]', context.registers[:site].active_lang)
205
+ end
206
+ elsif social[0] == 'rss_icon'
207
+ baseurl = context.registers[:site].baseurl.to_s.empty? ? '' : context.registers[:site].baseurl
208
+ url = url_template % (baseurl + '/feed.xml')
209
+ else
210
+ url = url_template % social[1]
211
+ end
212
+ "<a href='#{url}' title='#{social[0].gsub('_', ' ').capitalize}'>#{icon}</a>"
148
213
  end
149
- "<a href='#{url}' title='#{social[0].gsub('_', ' ').capitalize}'>#{icon}</a>"
150
214
  else
151
- file_ext = social[1]['logo'].split('.').last
152
- if file_ext == 'svg'
153
- if social[1]['logo'].include?('://')
154
- img_code = "<svg><image xlink:href='#{social[1]['logo']}' /></svg>"
215
+ # Check if logo is an icon class or an image
216
+ logo_value = social[1]['logo']
217
+ file_ext = logo_value.split('.').last.downcase
218
+ image_extensions = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg']
219
+
220
+ if image_extensions.include?(file_ext)
221
+ # It's a file path or URL, render as image
222
+ if file_ext == 'svg'
223
+ if logo_value.include?('://')
224
+ img_code = "<svg><image xlink:href='#{logo_value}' /></svg>"
225
+ else
226
+ img_code = "<svg><image xlink:href='#{relative_url(logo_value, context)}' /></svg>"
227
+ end
155
228
  else
156
- img_code = "<svg><image xlink:href='#{social[1]['logo'] | relative_url}' /></svg>"
229
+ if logo_value.include?('://')
230
+ img_code = "<img src='#{logo_value}' alt='#{social[1]['title']}'>"
231
+ else
232
+ img_code = "<img src='#{relative_url(logo_value, context)}' alt='#{social[1]['title']}'>"
233
+ end
157
234
  end
235
+ "<a href='#{social[1]['url']}' title='#{social[1]['title']}'>#{img_code}</a>"
158
236
  else
159
- if social[1]['logo'].include?('://')
160
- img_code = "<img src='#{social[1]['logo']}' alt='#{social[1]['title']}'>"
161
- else
162
- img_code = "<img src='#{social[1]['logo'] | relative_url}' alt='#{social[1]['title']}'>"
163
- end
237
+ # It's an icon class string, render as icon (from any font source)
238
+ icon_html = "<i class='#{logo_value}'></i>"
239
+ "<a href='#{social[1]['url']}' title='#{social[1]['title']}'>#{icon_html}</a>"
164
240
  end
165
- "<a href='#{social[1]['url']}' title='#{social[1]['title']}'>#{img_code}</a>"
166
241
  end
167
242
  end.join(" ")
168
243
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-socials
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - George Corrêa de Araújo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-01-15 00:00:00.000000000 Z
11
+ date: 2026-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll