From 07618cad80c30affdbf84200864c1358f113fdbe Mon Sep 17 00:00:00 2001 From: Mirza Arnaut Date: Wed, 12 Jul 2023 04:26:25 +0200 Subject: [PATCH] Add jsonresume support (#1547) Just as discussed in #1513 , this pull request adds support for [jsonresume](https://jsonresume.org/). Create the resume once, either as a file in the repository or at [github gist](https://gist.github.com/) called `resume.json`. Put the file in the `_config.yaml` file and that's it! Other platforms like [resumake](https://latexresu.me/) use the same schema. I also incorperated the changes introduced by #1339 to the best of my abilites. The style could be further improved. **Please merge this pull request after #1339 is merged, due to dependencies from it** If someone has a bettet approach on how to solve the problem that each section needs its own template, please let me know. But for now it works fine and is still backwards compatible with the `cv.yaml` file. Co-authored-by: George <31376482+george-gca@users.noreply.github.com> --- Gemfile | 1 + _config.yml | 22 ++++++ _includes/resume/awards.html | 23 ++++++ _includes/resume/basics.html | 23 ++++++ _includes/resume/certificates.html | 31 ++++++++ _includes/resume/education.html | 47 ++++++++++++ _includes/resume/interests.html | 29 ++++++++ _includes/resume/languages.html | 27 +++++++ _includes/resume/projects.html | 32 +++++++++ _includes/resume/publications.html | 30 ++++++++ _includes/resume/references.html | 27 +++++++ _includes/resume/skills.html | 29 ++++++++ _includes/resume/volunteer.html | 34 +++++++++ _includes/resume/work.html | 34 +++++++++ _layouts/cv.html | 112 +++++++++++++++++++++++++++++ assets/json/resume.json | 77 ++++++++++++++++++++ 16 files changed, 578 insertions(+) create mode 100644 _includes/resume/awards.html create mode 100644 _includes/resume/basics.html create mode 100644 _includes/resume/certificates.html create mode 100644 _includes/resume/education.html create mode 100644 _includes/resume/interests.html create mode 100644 _includes/resume/languages.html create mode 100644 _includes/resume/projects.html create mode 100644 _includes/resume/publications.html create mode 100644 _includes/resume/references.html create mode 100644 _includes/resume/skills.html create mode 100644 _includes/resume/volunteer.html create mode 100644 _includes/resume/work.html create mode 100644 assets/json/resume.json diff --git a/Gemfile b/Gemfile index 058139a3614f..7c6104f08cf7 100644 --- a/Gemfile +++ b/Gemfile @@ -15,6 +15,7 @@ group :jekyll_plugins do gem 'jekyll-sitemap' gem 'jekyll-toc' gem 'jekyll-twitter-plugin' + gem 'jekyll-get-json' gem 'jemoji' gem 'mini_racer' gem 'unicode_utils' diff --git a/_config.yml b/_config.yml index 97538bc92e3d..4b85b28326ce 100644 --- a/_config.yml +++ b/_config.yml @@ -223,6 +223,7 @@ plugins: - jekyll-sitemap - jekyll-toc - jekyll-twitter-plugin + - jekyll-get-json - jemoji # Sitemap settings @@ -396,3 +397,24 @@ mdb: medium_zoom: version: "1.0.8" integrity: "sha256-7PhEpEWEW0XXQ0k6kQrPKwuoIomz8R8IYyuU1Qew4P8=" + +# ----------------------------------------------------------------------------- +# Get external JSON data +# ----------------------------------------------------------------------------- + +jekyll_get_json: + - data: resume + json: "https://alshedivat.github.io/al-folio/assets/json/resume.json" +jsonresume: + - basics + - work + - education + - publications + - projects + - volunteer + - awards + - certificates + - skills + - languages + - interests + - references \ No newline at end of file diff --git a/_includes/resume/awards.html b/_includes/resume/awards.html new file mode 100644 index 000000000000..2bd912c93136 --- /dev/null +++ b/_includes/resume/awards.html @@ -0,0 +1,23 @@ + \ No newline at end of file diff --git a/_includes/resume/basics.html b/_includes/resume/basics.html new file mode 100644 index 000000000000..875af11df100 --- /dev/null +++ b/_includes/resume/basics.html @@ -0,0 +1,23 @@ + + {% assign skip_basics = "image,profiles,location" | split:"," %} + {% for content in data[1] %} + {% if (content[1] == "") or (skip_basics contains content[0]) %} + {% continue %} + {% endif %} + + + + + + {% endfor %} +
{{ content[0] | capitalize }} + {% if content[0] == "url" %} + {{ content[1] }} + {% elsif content[0] == "email" %} + {{ content[1] }} + {% elsif content[0] == "phone" %} + {{ content[1] }} + {% else %} + {{ content[1] }} + {% endif %} +
diff --git a/_includes/resume/certificates.html b/_includes/resume/certificates.html new file mode 100644 index 000000000000..cdd797894056 --- /dev/null +++ b/_includes/resume/certificates.html @@ -0,0 +1,31 @@ +
+ {% assign certificates = data[1] | sort: 'date' | reverse %} + {% for content in certificates %} +
+ + + + {% if content.icon %} + + {% else %} + + {% endif %} + + {% assign i = 1 %} + {% for item in content.items %} + {% assign i = i | plus:1 %} + {% endfor %} + + + + + + + + +
+ {{ content.name }} +
{{ content.issuer }}{{ content.date }}
+
+ {% endfor %} +
\ No newline at end of file diff --git a/_includes/resume/education.html b/_includes/resume/education.html new file mode 100644 index 000000000000..4dcfab56ac11 --- /dev/null +++ b/_includes/resume/education.html @@ -0,0 +1,47 @@ + \ No newline at end of file diff --git a/_includes/resume/interests.html b/_includes/resume/interests.html new file mode 100644 index 000000000000..3519179962d5 --- /dev/null +++ b/_includes/resume/interests.html @@ -0,0 +1,29 @@ +
+ {% for content in data[1] %} +
+ + + + {% if content.icon %} + + {% else %} + + {% endif %} + + {% assign i = 1 %} + {% for item in content.items %} + {% assign i = i | plus:1 %} + {% endfor %} + + + {% for item in content.keywords %} + + + + + {% endfor %} + +
{{ content.name }}
{{ item }}
+
+ {% endfor %} +
\ No newline at end of file diff --git a/_includes/resume/languages.html b/_includes/resume/languages.html new file mode 100644 index 000000000000..8b0fd2b018d1 --- /dev/null +++ b/_includes/resume/languages.html @@ -0,0 +1,27 @@ +
+ {% for content in data[1] %} +
+ + + + {% if content.icon %} + + {% else %} + + {% endif %} + + {% assign i = 1 %} + {% for item in content.items %} + {% assign i = i | plus:1 %} + {% endfor %} + + + + + + + +
{{ content.language }}
{{ content.fluency }}
+
+ {% endfor %} +
\ No newline at end of file diff --git a/_includes/resume/projects.html b/_includes/resume/projects.html new file mode 100644 index 000000000000..0436c80717e3 --- /dev/null +++ b/_includes/resume/projects.html @@ -0,0 +1,32 @@ + \ No newline at end of file diff --git a/_includes/resume/publications.html b/_includes/resume/publications.html new file mode 100644 index 000000000000..d77d715fce04 --- /dev/null +++ b/_includes/resume/publications.html @@ -0,0 +1,30 @@ + \ No newline at end of file diff --git a/_includes/resume/references.html b/_includes/resume/references.html new file mode 100644 index 000000000000..fef4d28db78f --- /dev/null +++ b/_includes/resume/references.html @@ -0,0 +1,27 @@ +
+ {% for content in data[1] %} +
+ + + + {% if content.icon %} + + {% else %} + + {% endif %} + + {% assign i = 1 %} + {% for item in content.items %} + {% assign i = i | plus:1 %} + {% endfor %} + + + + + + + +
{{ content.name }}
{{ content.reference }}
+
+ {% endfor %} +
\ No newline at end of file diff --git a/_includes/resume/skills.html b/_includes/resume/skills.html new file mode 100644 index 000000000000..69bb4e317831 --- /dev/null +++ b/_includes/resume/skills.html @@ -0,0 +1,29 @@ +
+ {% for content in data[1] %} +
+ + + + {% if content.icon %} + + {% else %} + + {% endif %} + + {% assign i = 1 %} + {% for item in content.items %} + {% assign i = i | plus:1 %} + {% endfor %} + + + {% for item in content.keywords %} + + + + + {% endfor %} + +
{{ content.name }}
{{ item }}
+
+ {% endfor %} +
\ No newline at end of file diff --git a/_includes/resume/volunteer.html b/_includes/resume/volunteer.html new file mode 100644 index 000000000000..fb68f7afc3c5 --- /dev/null +++ b/_includes/resume/volunteer.html @@ -0,0 +1,34 @@ + \ No newline at end of file diff --git a/_includes/resume/work.html b/_includes/resume/work.html new file mode 100644 index 000000000000..9f8e1852a226 --- /dev/null +++ b/_includes/resume/work.html @@ -0,0 +1,34 @@ + \ No newline at end of file diff --git a/_layouts/cv.html b/_layouts/cv.html index fbd59c53a0e9..55bcd77002e9 100644 --- a/_layouts/cv.html +++ b/_layouts/cv.html @@ -2,6 +2,8 @@ layout: default --- +{% unless site.data.resume %} +
@@ -42,4 +44,114 @@

{{ entry.title }}

+
+

{{ page.title }} {% if page.cv_pdf %}{% endif %}

+ {% if page.description %}

{{ page.description }}

{% endif %} +
+ +

Table of contents

+ + +
+
+ {% for entry in site.data.cv %} + +
+

{{ entry.title }}

+
+ {% if entry.type == "list" %} + {% include cv/list.html %} + {% elsif entry.type == "map" %} + {% include cv/map.html %} + {% elsif entry.type == "nested_list" %} + {% include cv/nested_list.html %} + {% elsif entry.type == "time_table" %} + {% include cv/time_table.html %} + {% elsif entry.type == "list_groups" %} + {% include cv/list_groups.html %} + {% else %} + {{ entry.contents }} + {% endif %} +
+
+ {% endfor %} +
+
+ +
+{% else %} +
+ +
+

{{ page.title }} {% if page.cv_pdf %}{% endif %}

+ {% if page.description %}

{{ page.description }}

{% endif %} +
+ +

Table of contents

+ + +
+
+ {% for data in site.data.resume %} + {% if site.jsonresume and site.jsonresume.size > 0 %} + {% unless site.jsonresume contains data[0] %} + {% continue %} + {% endunless %} + {% endif %} + {% if data[0] == "meta" or data[1].size == 0 %} + {% continue %} + {% endif %} + +
+

{{ data[0] | capitalize }}

+
+ {% case data[0] %} + {% when "basics" %} + {% include resume/basics.html %} + {% when "education" %} + {% include resume/education.html %} + {% when "work" %} + {% include resume/work.html %} + {% when "volunteer" %} + {% include resume/volunteer.html %} + {% when "projects" %} + {% include resume/projects.html %} + {% when "awards" %} + {% include resume/awards.html %} + {% when "skills" %} + {% include resume/skills.html %} + {% when "publications" %} + {% include resume/publications.html %} + {% when "languages" %} + {% include resume/languages.html %} + {% when "interests" %} + {% include resume/interests.html %} + {% when "certificates" %} + {% include resume/certificates.html %} + {% else %} + + {% endcase %} +
+ {% endfor %} +
+
+ +
+{% endunless %} \ No newline at end of file diff --git a/assets/json/resume.json b/assets/json/resume.json new file mode 100644 index 000000000000..dea0fc9f2d13 --- /dev/null +++ b/assets/json/resume.json @@ -0,0 +1,77 @@ +{ + "basics": { + "name": "Albert Einstein", + "label": "Scientist", + "image": "", + "email": "albert@einstein.de", + "phone": "(912) 123-4567", + "url": "https://alshedivat.github.io/al-folio/", + "summary": "A German-born theoretical physicist, widely ranked among the greatest and most influential scientists of all time", + "location": { + "address": "2712 Broadway St", + "postalCode": "CA 94115", + "city": "San Francisco", + "countryCode": "US", + "region": "California" + }, + "profiles": [ + { + "network": "Twitter", + "username": "AlbertEinstein", + "url": "https://twitter.com/AlbertEinstein" + } + ] + }, + "work": [ + { + "name": "Institute for Advanced Study, Princeton University", + "position": "Professor of Theoretical Physics", + "url": "https://example.com", + "startDate": "1933-01-01", + "endDate": "1955-01-01", + "summary": "Teaching at Palmer Physical Laboratory (now 302 Frist Campus Center). While not a professor at Princeton, I associated with the physics professors and continued to give lectures on campus.", + "highlights": [ + "Relativity" + ] + } + ], + "volunteer": [], + "education": [ + { + "institution": "University of Zurich, Zurich, Switzerland", + "url": "https://www.uzh.ch/", + "area": "Software Development", + "studyType": "PhD", + "startDate": "1905-01-01", + "endDate": "1905-01-01", + "score": "", + "courses": [ + "Theory of Relativity" + ] + } + ], + "awards": [ + { + "title": "Nobel Prize in Physics", + "date": "1921-11-01", + "awarder": "Royal Swedish Academy of Sciences", + "summary": "The Nobel Prizes are five separate prizes that, according to Alfred Nobel's will of 1895, are awarded to 'those who, during the preceding year, have conferred the greatest benefit to humankind.'" + } + ], + "certificates": [], + "publications": [], + "skills": [], + "languages": [ + { + "language": "German", + "fluency": "Native speaker" + }, + { + "language": "English", + "fluency": "Fluent" + } + ], + "interests": [], + "references": [], + "projects": [] +} \ No newline at end of file