File tree Expand file tree Collapse file tree 4 files changed +20
-7
lines changed Expand file tree Collapse file tree 4 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,9 @@ export async function render(resume) {
207207 return `<time datetime="${ datetime } ">${ localeString } </time>` ;
208208 } ) ;
209209
210+ /** @type {Record<string, unknown> } */
211+ resume . custom = { } ;
212+
210213 if ( Array . isArray ( resume . basics ?. profiles ) ) {
211214 const { profiles } = resume . basics ;
212215 const xTwitter = profiles . find ( ( profile ) => {
@@ -218,7 +221,7 @@ export async function render(resume) {
218221 let { username, url } = xTwitter ;
219222
220223 if ( ! username && url ) {
221- const match = url . match ( / h t t p s ? : \/ \/ .+ ?\/ ( \w { 1 , 15 } ) / ) ;
224+ const match = url . match ( / ^ h t t p s ? : \/ \/ .+ ?\/ ( \w { 1 , 15 } ) / ) ;
222225
223226 if ( match . length == 2 ) {
224227 username = match [ 1 ] ;
@@ -229,9 +232,15 @@ export async function render(resume) {
229232 username = `@${ username } ` ;
230233 }
231234
232- resume . custom = {
233- xTwitterHandle : username
234- }
235+ resume . custom . xTwitterHandle = username ;
236+ }
237+ }
238+
239+ if ( resume . basics ?. image ) {
240+ const { image } = resume . basics ;
241+
242+ if ( image . match ( / ^ h t t p s ? : \/ \/ / ) ) {
243+ resume . custom . ogImage = image ;
235244 }
236245 }
237246
Original file line number Diff line number Diff line change 2323 {{ /if }}
2424
2525 {{ #if resume.basics.image }}
26- <meta property =" og:image" content =" {{ resume.basics.image }} " >
27- <link rel =" icon" href =" {{ resume.basics.image }} " >
26+ <link href =" {{ resume.basics.image }} " rel =" icon" >
27+ {{ /if }}
28+ {{ #if resume.custom.ogImage }}
29+ <meta property =" og:image" content =" {{ resume.custom.ogImage }} " >
2830 {{ #if resume.basics.name }}
29- <meta property =" og:image:alt" content =" {{ i18n " avatar-description" " name" resume.basics.name }} " >
31+ <meta property =" og:image:alt" content =" {{ i18n " avatar-description" " name"
32+ resume.basics.name }} " >
3033 {{ /if }}
3134 {{ /if }}
3235
Original file line number Diff line number Diff line change 55 },
66 "basics" : {
77 "name" : " Seth Falco" ,
8+ "image" : " ./test/favicon.png" ,
89 "label" : " Open Sourcerer 🧙♂️" ,
9101011 "phone" : " +00 0694201337" ,
You can’t perform that action at this time.
0 commit comments