Skip to content

Commit

Permalink
Merge pull request #1 from maastrichtlawtech/chore/template_sync_8cacee6
Browse files Browse the repository at this point in the history
upstream merge template repository
  • Loading branch information
kasnder authored Mar 5, 2024
2 parents 7dc3d4f + 6e15407 commit a265ba0
Show file tree
Hide file tree
Showing 32 changed files with 239 additions and 82 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
assets/css/main.scss
assets/plotly/demo.html
lighthouse_results/**
_posts/2015-10-20-math.md
8 changes: 4 additions & 4 deletions CUSTOMIZE.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,19 @@ scholar:
If the entry matches one form of the last names and the first names, it will be underlined. Keep meta-information about your co-authors in [\_data/coauthors.yml](_data/coauthors.yml) and Jekyll will insert links to their webpages automatically. The co-author data format is as follows,
```yaml
"Adams":
"adams":
- firstname: ["Edwin", "E.", "E. P.", "Edwin Plimpton"]
url: https://en.wikipedia.org/wiki/Edwin_Plimpton_Adams

"Podolsky":
"podolsky":
- firstname: ["Boris", "B.", "B. Y.", "Boris Yakovlevich"]
url: https://en.wikipedia.org/wiki/Boris_Podolsky

"Rosen":
"rosen":
- firstname: ["Nathan", "N."]
url: https://en.wikipedia.org/wiki/Nathan_Rosen

"Bach":
"bach":
- firstname: ["Johann Sebastian", "J. S."]
url: https://en.wikipedia.org/wiki/Johann_Sebastian_Bach

Expand Down
4 changes: 3 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

# Installing and Deploying

## Recommended Approach

The recommended approach for using **al-folio** is to first create your own site using the template with as few changes as possible, and only when it is up and running customize it however you like. This way it is easier to pinpoint what causes a potential issue in case of a bug. The minimum steps required to create your own site are:

1. Create a new repository using this template. For this, click on [Use this template -> Create a new repository](https://github.com/new?template_name=al-folio&template_owner=alshedivat) above the file list. If you plan to upload your site to `<your-github-username>.github.io`, note that the name of your repository MUST BE `<your-github-username>.github.io` or `<your-github-orgname>.github.io`, as stated in the [GitHub pages docs](https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages#types-of-github-pages-sites).
1. Create a new repository using this template. For this, click on [Use this template -> Create a new repository](https://github.com/new?template_name=al-folio&template_owner=alshedivat) above the file list. If you plan to upload your site to `<your-github-username>.github.io`, note that the name of your repository :warning: **MUST BE** :warning: `<your-github-username>.github.io` or `<your-github-orgname>.github.io`, as stated in the [GitHub pages docs](https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages#types-of-github-pages-sites).
2. In this new repository, go to `Settings -> Actions -> General -> Workflow permissions` and give `Read and write permissions` to GitHub Actions.
3. Open file `_config.yml`, set `url` to `https://<your-github-username>.github.io` and leave `baseurl` **empty**.
4. Finally, in the repository page go to `Settings -> Pages -> Build and deployment`, make sure that `Source` is set to `Deploy from a branch` and set the branch to `gh-pages` (NOT to master).
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ Feel free to add your own page(s) by sending a PR.
<a href="https://sam-bieberich.github.io/" target="_blank">★</a>
<a href="https://afraniomelo.github.io/en/" target="_blank">★</a>
<a href="https://jonaruthardt.github.io" target="_blank">★</a>
<a href="https://www.zla.app/" target="_blank">★</a>
<a href="https://stavros.github.io" target="_blank">★</a>
<a href="https://ericslyman.com" target="_blank">★</a>
</td>
</tr>
<tr>
Expand Down
1 change: 1 addition & 0 deletions _bibliography/papers.bib
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ @article{PhysRev.47.777
pdf={example_pdf.pdf},
altmetric={248277},
dimensions={true},
google_scholar_id={qyhmnyLat1gC},
selected={true}
}

Expand Down
11 changes: 10 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ x_username: maaslawtech # your X handle
mastodon_username: # your mastodon instance+username in the format instance.tld/@username
linkedin_username: # your LinkedIn user name
telegram_username: # your Telegram user name
scholar_userid: # your Google Scholar ID
scholar_userid: qc6CJjYAAAAJ # your Google Scholar ID
semanticscholar_id: # your Semantic Scholar ID
whatsapp_number: # your WhatsApp number (full phone number in international format. Omit any zeroes, brackets, or dashes when adding the phone number in international format.)
orcid_id: # your ORCID ID
Expand Down Expand Up @@ -309,6 +309,7 @@ scholar:
enable_publication_badges:
altmetric: true # Altmetric badge (https://www.altmetric.com/products/altmetric-badges/)
dimensions: true # Dimensions badge (https://badge.dimensions.ai/)
google_scholar: true # Google Scholar badge (https://scholar.google.com/intl/en/scholar/citations.html)

# Filter out certain bibtex entry keywords used internally from the bib output
filtered_bibtex_keywords:
Expand Down Expand Up @@ -355,6 +356,14 @@ imagemagick:
output_formats:
webp: "-quality 85"

# Lazy loading images
# If you enable lazy loading, all images will add the loading="lazy" attribute.
# This will make your site load faster, but it may not be supported in all browsers.
# You can also set loading="" to other values for specific images to override the default behavior.
# Options: "auto", "eager", "lazy"
# See https://web.dev/browser-level-image-lazy-loading/ for more information.
lazy_loading_images: true # enables lazy loading of images (recommended)

# -----------------------------------------------------------------------------
# Optional Features
# -----------------------------------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions _includes/figure.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
{% if include.zoomable %}
data-zoomable
{% endif %}
{% if include.loading %}
loading="{{ include.loading }}"
{% elsif site.lazy_loading_images %}
loading="lazy"
{% endif %}
onerror="this.onerror=null; $('.responsive-img-srcset').remove();"
>
</picture>
Expand Down
4 changes: 1 addition & 3 deletions _includes/header.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
{% if site.first_name %}
<span class="font-weight-bold">
{{- site.first_name -}}
&nbsp;</span
>
</span>
{% endif %}
{% if site.middle_name %}
{{- site.middle_name -}}
&nbsp;
{% endif %}
{% if site.last_name %}
{{- site.last_name -}}
Expand Down
1 change: 1 addition & 0 deletions _includes/projects.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{% if project.img %}
{%
include figure.liquid
loading="eager"
path=project.img
sizes = "250px"
alt="project thumbnail"
Expand Down
2 changes: 1 addition & 1 deletion _includes/projects_horizontal.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="row g-0">
{% if project.img %}
<div class="card-img col-md-6">
{% include figure.liquid path=project.img sizes="(min-width: 768px) 156px, 50vw" alt="project thumbnail" %}
{% include figure.liquid loading="eager" path=project.img sizes="(min-width: 768px) 156px, 50vw" alt="project thumbnail" %}
</div>
{% endif %}
<div class="{% if project.img %}col-md-6{% else %}col-md-12{% endif %}">
Expand Down
3 changes: 3 additions & 0 deletions _includes/scripts/misc.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@
<script src="{{ '/assets/js/no_defer.js' | relative_url | bust_file_cache }}"></script>
<script defer src="{{ '/assets/js/common.js' | relative_url | bust_file_cache }}"></script>
<script defer src="{{ '/assets/js/copy_code.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>

<!-- Jupyter Open External Links New Tab -->
<script defer src="{{ '/assets/js/jupyter_new_tab.js' | relative_url | bust_file_cache }}"></script>
4 changes: 2 additions & 2 deletions _layouts/about.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ layout: default
{% capture sizes %}(min-width: {{site.max_width}}) {{ site.max_width | minus: 30 | times: 0.3}}px, (min-width: 576px)
30vw, 95vw"{% endcapture %}
{%
include figure.liquid path = profile_image_path class = profile_image_class sizes = sizes alt = page.profile.image
cache_bust = true
include figure.liquid loading="eager" path=profile_image_path class=profile_image_class sizes=sizes alt=page.profile.image
cache_bust=true
%}
{% endif %}
{% if page.profile.more_info %}
Expand Down
56 changes: 35 additions & 21 deletions _layouts/bib.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
{% assign entry_path = entry.preview | prepend: '/assets/img/publication_preview/' %}
{%
include figure.liquid
loading="eager"
path=entry_path
sizes = "200px"
class="preview z-depth-1 rounded"
Expand Down Expand Up @@ -50,60 +51,60 @@
{% assign author_array_limit = site.max_author_limit %}
{% endif %}

{% for author in entry.author_array limit: author_array_limit %}
{%- for author in entry.author_array limit: author_array_limit -%}
{% assign author_is_self = false %}
{% assign author_last_name = author.last | remove: '¶' | remove: '&' | remove: '*' | remove: '†' | remove: '^' %}
{%- assign author_last_name = author.last | remove: '¶' | remove: '&' | remove: '*' | remove: '†' | remove: '^' -%}
{% if site.scholar.last_name contains author_last_name %}
{% if site.scholar.first_name contains author.first %}
{% assign author_is_self = true %}
{% endif %}
{% endif %}
{%- endif -%}
{% assign coauthor_url = null %}
{% assign clean_last_name = author_last_name | downcase | remove_accents %}
{%- assign clean_last_name = author_last_name | downcase | remove_accents -%}
{% if site.data.coauthors[clean_last_name] %}
{% for coauthor in site.data.coauthors[clean_last_name] %}
{%- for coauthor in site.data.coauthors[clean_last_name] -%}
{% if coauthor.firstname contains author.first %}
{% assign coauthor_url = coauthor.url %}
{%- assign coauthor_url = coauthor.url -%}
{% break %}
{% endif %}
{% endfor %}
{% endif %}
{%- endif -%}

{% if forloop.length > 1 %}
{%- if forloop.length > 1 -%}
{% if forloop.first == false %},&nbsp;{% endif %}
{% if forloop.last and author_array_limit == author_array_size %}and&nbsp;{% endif %}
{%- if forloop.last and author_array_limit == author_array_size %}and&nbsp;{% endif -%}
{% endif %}
{% if author_is_self %}
{%- if author_is_self -%}
<em>
{{- author.first }}
{{ author.last -}}
</em>
{% else %}
{% if coauthor_url %}
{%- else -%}
{%- if coauthor_url -%}
<a href="{{coauthor_url}}">
{{- author.first }}
{{ author.last -}}
</a>
{% else %}
{%- else -%}
{{ author.first }}
{{ author.last }}
{% endif %}
{% endif %}
{%- endif -%}
{% endfor %}
{% assign more_authors = author_array_size | minus: author_array_limit %}
{%- assign more_authors = author_array_size | minus: author_array_limit -%}

{% assign more_authors_hide = more_authors | append: ' more author' %}
{%- assign more_authors_hide = more_authors | append: ' more author' -%}
{% if more_authors > 0 %}
{% if more_authors > 1 %}
{%- if more_authors > 1 -%}
{% assign more_authors_hide = more_authors_hide | append: 's' %}
{% endif %}
{%- endif -%}
{% assign more_authors_show = '' %}
{% for author in entry.author_array offset: author_array_limit %}
{%- for author in entry.author_array offset: author_array_limit -%}
{% assign more_authors_show = more_authors_show | append: author.first | append: ' ' | append: author.last %}
{% unless forloop.last %}
{% assign more_authors_show = more_authors_show | append: ', ' %}
{% endunless %}
{% endfor %}
{%- endfor -%}
, and
<span
class="more-authors"
Expand Down Expand Up @@ -211,7 +212,8 @@
{% if site.enable_publication_badges %}
{% assign entry_has_altmetric_badge = entry.altmetric or entry.doi or entry.eprint or entry.pmid or entry.isbn %}
{% assign entry_has_dimensions_badge = entry.dimensions or entry.doi or entry.pmid %}
{% if entry_has_altmetric_badge or entry_has_dimensions_badge %}
{% assign entry_has_google_scholar_badge = entry.google_scholar_id %}
{% if entry_has_altmetric_badge or entry_has_dimensions_badge or entry_has_google_scholar_badge %}
<div class="badges">
{% if site.enable_publication_badges.altmetric and entry_has_altmetric_badge %}
<span
Expand Down Expand Up @@ -249,6 +251,18 @@
style="margin-bottom: 3px;"
></span>
{% endif %}
{% if site.enable_publication_badges.google_scholar and entry_has_google_scholar_badge %}
<a
href="https://scholar.google.com/citations?view_op=view_citation&hl=en&user={{ site.scholar_userid }}&citation_for_view={{ site.scholar_userid }}:{{ entry.google_scholar_id }}"
aria-label="Google Scholar link"
role="button"
>
<img
src="https://img.shields.io/badge/scholar-{% google_scholar_citations site.scholar_userid entry.google_scholar_id %}-4285F4?logo=googlescholar&labelColor=beige"
alt="{% google_scholar_citations site.scholar_userid entry.google_scholar_id %} Google Scholar citations"
>
</a>
{% endif %}
</div>
{% endif %}
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion _layouts/profiles.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ layout: page
{% assign profile_image_class = 'img-fluid z-depth-1 rounded' %}
{% endif %}
{% capture sizes %}(min-width: {{site.max_width}}) {{ site.max_width | minus: 30 | times: 0.3}}px, (min-width: 576px) 30vw, 95vw"{% endcapture %}
{% include figure.liquid path = profile_image_path class = profile_image_class sizes = sizes alt = profile.image %}
{% include figure.liquid loading="eager" path=profile_image_path class=profile_image_class sizes=sizes alt=profile.image %}
{% endif %}
{% if profile.more_info %}
<div class="more-info">{{ profile.more_info }}</div>
Expand Down
78 changes: 78 additions & 0 deletions _plugins/google-scholar-citations.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
require "active_support/all"
require 'nokogiri'
require 'open-uri'

module Helpers
extend ActiveSupport::NumberHelper
end

module Jekyll
class GoogleScholarCitationsTag < Liquid::Tag
Citations = { }

def initialize(tag_name, params, tokens)
super
splitted = params.split(" ").map(&:strip)
@scholar_id = splitted[0]
@article_id = splitted[1]
end

def render(context)
article_id = context[@article_id.strip]
scholar_id = context[@scholar_id.strip]
article_url = "https://scholar.google.com/citations?view_op=view_citation&hl=en&user=#{scholar_id}&citation_for_view=#{scholar_id}:#{article_id}"

begin
# If the citation count has already been fetched, return it
if GoogleScholarCitationsTag::Citations[article_id]
return GoogleScholarCitationsTag::Citations[article_id]
end

# Sleep for a random amount of time to avoid being blocked
sleep(rand(1.5..3.5))

# Fetch the article page
doc = Nokogiri::HTML(URI.open(article_url, "User-Agent" => "Ruby/#{RUBY_VERSION}"))

# Attempt to extract the "Cited by n" string from the meta tags
citation_count = 0

# Look for meta tags with "name" attribute set to "description"
description_meta = doc.css('meta[name="description"]')
og_description_meta = doc.css('meta[property="og:description"]')

if !description_meta.empty?
cited_by_text = description_meta[0]['content']
matches = cited_by_text.match(/Cited by (\d+[,\d]*)/)

if matches
citation_count = matches[1].sub(",", "").to_i
end

elsif !og_description_meta.empty?
cited_by_text = og_description_meta[0]['content']
matches = cited_by_text.match(/Cited by (\d+[,\d]*)/)

if matches
citation_count = matches[1].sub(",", "").to_i
end
end

citation_count = Helpers.number_to_human(citation_count, :format => '%n%u', :precision => 2, :units => { :thousand => 'K', :million => 'M', :billion => 'B' })

rescue Exception => e
# Handle any errors that may occur during fetching
citation_count = "N/A"

# Print the error message including the exception class and message
puts "Error fetching citation count for #{article_id}: #{e.class} - #{e.message}"
end


GoogleScholarCitationsTag::Citations[article_id] = citation_count
return "#{citation_count}"
end
end
end

Liquid::Template.register_tag('google_scholar_citations', Jekyll::GoogleScholarCitationsTag)
24 changes: 14 additions & 10 deletions _posts/2015-03-15-formatting-and-links.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,26 @@ Jean shorts raw denim Vice normcore, art party High Life PBR skateboard stumptow

#### Hipster list

<ul>
<li>brunch</li>
<li>fixie</li>
<li>raybans</li>
<li>messenger bag</li>
</ul>
- brunch
- fixie
- raybans
- messenger bag

#### Check List

- [x] Brush Teeth
- [ ] Put on socks
- [x] Put on left sock
- [ ] Put on right sock
- [x] Go to school

Hoodie Thundercats retro, tote bag 8-bit Godard craft beer gastropub. Truffaut Tumblr taxidermy, raw denim Kickstarter sartorial dreamcatcher. Quinoa chambray slow-carb salvia readymade, bicycle rights 90's yr typewriter selfies letterpress cardigan vegan.

<hr>

Pug heirloom High Life vinyl swag, single-origin coffee four dollar toast taxidermy reprehenderit fap distillery master cleanse locavore. Est anim sapiente leggings Brooklyn ea. Thundercats locavore excepteur veniam eiusmod. Raw denim Truffaut Schlitz, migas sapiente Portland VHS twee Bushwick Marfa typewriter retro id keytar.

<blockquote>
We do not grow absolutely, chronologically. We grow sometimes in one dimension, and not in another, unevenly. We grow partially. We are relative. We are mature in one realm, childish in another.
—Anais Nin
</blockquote>
> We do not grow absolutely, chronologically. We grow sometimes in one dimension, and not in another, unevenly. We grow partially. We are relative. We are mature in one realm, childish in another.
> —Anais Nin
Fap aliqua qui, scenester pug Echo Park polaroid irony shabby chic ex cardigan church-key Odd Future accusamus. Blog stumptown sartorial squid, gastropub duis aesthetic Truffaut vero. Pinterest tilde twee, odio mumblecore jean shorts lumbersexual.
Loading

0 comments on commit a265ba0

Please sign in to comment.