Skip to content

Commit a36784b

Browse files
committed
fix: revert language logic and introduce meta lang
1 parent d5e0f1d commit a36784b

File tree

4 files changed

+37
-46
lines changed

4 files changed

+37
-46
lines changed

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ resume export --theme @jsonresume/jsonresume-theme-class your-name.pdf
2323

2424
### Notes
2525

26-
* This theme expects languages in your résumé to be defined with language codes (i.e. `en`), not language names (i.e. `English`).
27-
* If languages are specified, ensure the first language is the language your résumé is written in, so that the document language is set correctly.
26+
* It's recommended to declare the `meta.language` property in your JSON Resume for accessibility. This is the [BCP47 tag](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/lang#language_tag_syntax) for the language your your résumé is written in. For example, `en` for English.
2827

2928
## Features
3029

index.js

-13
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,6 @@ function render(resume) {
111111
}
112112
}
113113

114-
const primaryLanguage = resume.languages && resume.languages[0].language;
115-
116-
if (primaryLanguage) {
117-
Handlebars.registerHelper("lang", (body) => {
118-
const languageNames = new Intl.DisplayNames([primaryLanguage], {
119-
type: 'language',
120-
121-
});
122-
123-
return languageNames.of(body);
124-
});
125-
}
126-
127114
const html = Handlebars.compile(template)({
128115
css,
129116
resume

resume.handlebars

+31-29
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,44 @@
11
<!DOCTYPE html>
2-
{{#if resume.languages.0.language}}
3-
<html lang="{{resume.languages.0.language}}">
2+
{{#if resume.meta.language}}
3+
<html lang="{{resume.meta.language}}">
44
{{else}}
55
<html>
66
{{/if}}
77
<head>
8-
<meta charset="utf-8">
9-
<meta name="viewport" content="width=device-width, initial-scale=1">
10-
<meta property="og:type" content="website">
11-
<meta name="twitter:card" content="summary">
8+
{{#if resume.basics.name}}
9+
<title>{{resume.basics.name}} - CV</title>
10+
<meta property="og:site_name" content="{{resume.basics.name}}">
11+
{{else}}
12+
<title>CV</title>
13+
{{/if}}
1214

13-
{{#resume.basics}}
14-
<title>{{name}} - CV</title>
15-
<meta name="description" content="{{summary}}">
15+
{{#if resume.basics.summary}}
16+
<meta name="description" content="{{resume.basics.summary}}">
17+
<meta property="og:description" content="{{resume.basics.summary}}">
18+
{{/if}}
1619

17-
<meta property="og:site_name" content="{{name}}">
18-
<meta property="og:title" content="{{label}}">
19-
<meta property="og:description" content="{{summary}}">
20+
{{#if resume.basics.label}}
21+
<meta property="og:title" content="{{resume.basics.label}}">
22+
{{/if}}
2023

21-
{{#if image}}
22-
<link rel="icon" href="{{image}}">
23-
<meta property="og:image" content="{{image}}">
24-
<meta property="og:image:alt" content="Avatar of {{name}}.">
25-
{{/if}}
26-
{{/resume.basics}}
24+
{{#if resume.basics.image}}
25+
<meta property="og:image" content="{{resume.basics.image}}">
26+
<link rel="icon" href="{{resume.basics.image}}">
27+
{{#if resume.basics.name}}
28+
<meta property="og:image:alt" content="Avatar of {{resume.basics.name}}.">
29+
{{/if}}
30+
{{/if}}
2731

28-
{{#resume.custom}}
29-
{{#if xTwitterHandle}}
30-
<meta name="twitter:site" content="{{xTwitterHandle}}">
31-
{{/if}}
32-
{{/resume.custom}}
32+
{{#if resume.custom.xTwitterHandle}}
33+
<meta name="twitter:site" content="{{resume.custom.xTwitterHandle}}">
34+
{{/if}}
3335

34-
<style>
35-
{{{css}}}
36-
</style>
36+
<meta charset="utf-8">
37+
<meta name="viewport" content="width=device-width, initial-scale=1">
38+
<meta name="twitter:card" content="summary">
39+
<meta property="og:type" content="website">
3740

41+
<style>{{{css}}}</style>
3842
</head>
3943
<body>
4044

@@ -313,9 +317,7 @@
313317
{{#each resume.languages}}
314318
<div class="item">
315319
{{#if language}}
316-
<div>
317-
{{lang language}}
318-
</div>
320+
<div>{{language}}</div>
319321
{{/if}}
320322
{{#if fluency}}
321323
<div class="level">

test/fixture.resume.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
3+
"meta": {
4+
"language": "en"
5+
},
36
"basics": {
47
"name": "Seth Falco",
58
"label": "Open-Sourcerer 🧙‍♂️",
@@ -76,11 +79,11 @@
7679
],
7780
"languages": [
7881
{
79-
"language": "en",
82+
"language": "English",
8083
"fluency": "Native"
8184
},
8285
{
83-
"language": "fr",
86+
"language": "French",
8487
"fluency": "Elementary"
8588
}
8689
]

0 commit comments

Comments
 (0)