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 +4 -4
- data/lib/jekyll-socials/version.rb +1 -1
- data/lib/jekyll-socials.rb +101 -26
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 04ca2a29bb5498da6e1378d39ff5e8c7ebb70eeabe414f55612f1efaf46af2fc
|
|
4
|
+
data.tar.gz: 79fa7fe06c3b312bc5092bb403372b71e9311953f4d158ec19492ed5de7668e3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 89bcfca08aa0677044ed63c9e8192a4cf1390fb153a2368f499347fc36484973bd3b18f93f6f922e7cc8aaab9e7f8056fa196d7ae8b25316f87bbc96c47d4d2a
|
|
7
|
+
data.tar.gz: 7b37fba8ac5126f286fbe0882e098df0905e68b7a7cc73c948fd6c2ceec64746e4e29c3358c523d90d0c9996d3c1063aec0d41418c6bedf8040e2cd64c67a55a
|
data/lib/jekyll-socials.rb
CHANGED
|
@@ -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
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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 +
|
|
163
|
+
url = url_template % (baseurl + '/feed.xml')
|
|
138
164
|
else
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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
|
-
|
|
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
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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
|
-
|
|
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
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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.
|
|
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-
|
|
11
|
+
date: 2026-01-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: jekyll
|