Skip to content

Commit

Permalink
Merge branch 'alshedivat:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
kastnerp authored Sep 16, 2024
2 parents 4964c2c + 0465459 commit d3bc489
Show file tree
Hide file tree
Showing 227 changed files with 49,499 additions and 2,875 deletions.
31 changes: 31 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/jekyll
{
"name": "Jekyll",
"image": "mcr.microsoft.com/devcontainers/jekyll",

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
"packages": "build-essential,imagemagick,inotify-tools,jupyter-nbconvert,procps,ruby-full,zlib1g-dev"
},
"ghcr.io/devcontainers-contrib/features/prettier:1": {}
},

// Optionally: run jekyll serve automatically on container entering using the Docker entrypoint
"postAttachCommand": "./bin/entry_point.sh",

"customizations": {
"vscode": {
"extensions": ["esbenp.prettier-vscode", "sissel.shopify-liquid", "yzhang.markdown-all-in-one"],
"settings": {
// use prettier code formatter as default formatter
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.configPath": ".prettierrc",
"editor.formatOnSave": true
}
}
},

"remoteUser": "vscode"
}
2 changes: 1 addition & 1 deletion .github/workflows/axe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
run: |
pip3 install --upgrade jupyter
export JEKYLL_ENV=production
bundle exec jekyll build --lsi
bundle exec jekyll build
- name: Purge unused CSS 🧹
run: |
npm install -g purgecss
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/broken-links-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: |
pip3 install --upgrade jupyter
export JEKYLL_ENV=production
bundle exec jekyll build --lsi
bundle exec jekyll build
- name: Purge unused CSS 🧹
run: |
npm install -g purgecss
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/broken-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ jobs:
with:
fail: true
# removed md files that include liquid tags
args: --exclude-path README.md --exclude-path _pages/404.md --exclude-path _pages/blog.md --exclude-path _posts/2018-12-22-distill.md --verbose --no-progress './**/*.md' './**/*.html'
args: --user-agent 'curl/7.54' --exclude-path README.md --exclude-path _pages/404.md --exclude-path _pages/blog.md --exclude-path _posts/2018-12-22-distill.md --exclude-path _posts/2023-04-24-videos.md --verbose --no-progress './**/*.md' './**/*.html'
2 changes: 2 additions & 0 deletions .github/workflows/deploy-docker-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
tags:
- "v*"
paths:
- ".github/workflows/deploy-docker-tag.yml"
- ".github/workflows/deploy-image.yml"
- "bin/entry_point.sh"
- "Dockerfile"
- "Gemfile"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- master
- main
paths:
- ".github/workflows/deploy-image.yml"
- "bin/entry_point.sh"
- "Dockerfile"
- "Gemfile"
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ on:
- main
paths:
- "assets/**"
- "**.bib"
- "**.html"
- "**.js"
- "**.liquid"
- "**/*.md"
- "**.yml"
- "Gemfile"
- "Gemfile.lock"
- "!.github/workflows/axe.yml"
- "!.github/workflows/broken-links.yml"
- "!.github/workflows/deploy-docker-tag.yml"
Expand All @@ -31,11 +34,14 @@ on:
- main
paths:
- "assets/**"
- "**.bib"
- "**.html"
- "**.js"
- "**.liquid"
- "**/*.md"
- "**.yml"
- "Gemfile"
- "Gemfile.lock"
- "!.github/workflows/axe.yml"
- "!.github/workflows/broken-links.yml"
- "!.github/workflows/deploy-docker-tag.yml"
Expand Down Expand Up @@ -77,7 +83,7 @@ jobs:
run: |
pip3 install --upgrade jupyter
export JEKYLL_ENV=production
bundle exec jekyll build --lsi
bundle exec jekyll build
- name: Purge unused CSS 🧹
run: |
npm install -g purgecss
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/docker-slim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: Docker Slim

#Only trigger, when the build workflow succeeded
on:
push:
branches:
- master
- main
paths:
- ".github/workflows/docker-slim.yml"
workflow_run:
workflows: ["Docker Image CI"]
types:
Expand All @@ -15,7 +21,7 @@ on:
jobs:
build:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow
if: ${{ github.event.workflow_run.conclusion == 'success' }} and github.repository_owner == 'alshedivat'
if: ${{ github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'alshedivat' }}
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -37,7 +43,7 @@ jobs:
sed -i "s|\.:|${{ github.workspace }}:|g" ${{ github.workspace }}/docker-compose.yml
cat ${{ github.workspace }}/docker-compose.yml
- uses: kitabisa/docker-slim-action@v1.0.3
- uses: kitabisa/docker-slim-action@v1.1.1
env:
DSLIM_PULL: true
DSLIM_COMPOSE_FILE: ${{ github.workspace }}/docker-compose.yml
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/lighthouse-badger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ name: "Lighthouse Badger"
# DEFINE YOUR INPUTS AND TRIGGERS IN THE FOLLOWING
########################################################################

# INPUTS as environmental variables (env) for not manually triggered workflows
# INPUTS as Secrets (env) for not manually triggered workflows
env:
URLS: https://alshedivat.github.io/al-folio/
TOKEN_NAME: LIGHTHOUSE_BADGER_TOKEN
# If any of the following env is blank, a default value is used instead
REPO_BRANCH: "${{ github.repository }} master" # target repository & branch e.g. 'dummy/mytargetrepo main'
MOBILE_LIGHTHOUSE_PARAMS: "--only-categories=performance,accessibility,best-practices,seo --throttling.cpuSlowdownMultiplier=2"
Expand Down Expand Up @@ -50,7 +49,7 @@ jobs:
- uses: actions/checkout@v4
with:
repository: ${{ env.REPOSITORY }}
token: ${{ secrets[github.event.inputs.token_name] || secrets[env.TOKEN_NAME] }}
token: ${{ secrets.LIGHTHOUSE_BADGER_TOKEN }}
ref: ${{ env.BRANCH }}
- uses: actions/checkout@v4
with:
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/prettier-html.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Prettify gh-pages

on:
workflow_dispatch:

jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
ref: gh-pages

- name: Find and Remove </source> Tags
run: find . -type f -name "*.html" -exec sed -i 's/<\/source>//g' {} +

- name: Set up Node.js
uses: actions/setup-node@v4

- name: Install Prettier
run: npm install -g prettier

- name: Check for Prettier
run: npx prettier --version || echo "Prettier not found"

- name: Run Prettier on HTML files
run: npx prettier --write '**/*.html'

- name: Commit and push changes
run: |
git config user.name "github-actions"
git config user.email "actions@github.com"
git add .
git commit -m "Formatted HTML files" || echo "No changes to commit"
git push
39 changes: 39 additions & 0 deletions .github/workflows/schedule-posts.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Publish posts scheduled for today

on:
schedule:
# Run every day at 23:30 UTC or manually run
- cron: "30 23 * * *"
workflow_dispatch:

jobs:
publish_scheduled:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: master

- name: Get the date for today
id: date
run: echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- name: Check for scheduled posts and move to posts
run: |
echo "Today is $TODAY"
shopt -s nullglob
for file in _scheduled/${TODAY}-*.md; do
echo "Found scheduled: $file"
mv "$file" "_posts/"
echo "Moved $file to _posts/"
done

- name: Commit and push changes
run: |
git config user.name "github-actions"
git config user.email "actions@github.com"
git add _posts/
git add _scheduled/
git commit -m "Posted Scheduled Drafts on $TODAY" || echo "No changes to commit"
git push
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ _site
.ruby-version
.tweet-cache
Gemfile.lock
assets/libs/
node_modules/
vendor
vendor
.idea
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
**/*.map
**/*.min.css
**/*.min.js
assets/css/main.scss
assets/js/search-data.js
assets/js/distillpub/template.v2.js
assets/js/search/*.js
assets/plotly/demo.html
lighthouse_results/**
_posts/2015-10-20-math.md
_sass/font-awesome/*.scss
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ We welcome your pull requests (PRs).
For minor fixes (e.g., documentation improvements), feel free to submit a PR directly.
If you would like to implement a new feature or a bug, please make sure you (or someone else) has opened an appropriate issue first; in your PR, please mention the issue it addresses.

Note that since [#2048](https://github.com/alshedivat/al-folio/pull/2048) al-folio uses the [prettier formatter](https://prettier.io/) for its code, meaning all new submitted code must conform to its standard. If you don't have `prettier` installed for your setup and the `prettier` code check fails when submitting a PR, you can check the referred failed action in our repo. In that action there will be an artifact with an HTML diff showing the needed changes.

## Issues

We use GitHub issues to track bugs and feature requests.
Expand Down
68 changes: 60 additions & 8 deletions CUSTOMIZE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Customize

Here we will give you some tips on how to customize the website.
Here we will give you some tips on how to customize the website. One important thing to note is that **ALL** the changes you make should be done on the **main** branch of your repository. The `gh-pages` branch is automatically overwritten every time you make a change to the main branch.

## Project structure

Expand Down Expand Up @@ -40,7 +40,7 @@ The configuration file [\_config.yml](_config.yml) contains the main configurati

> Note that the `url` and `baseurl` settings are used to generate the links of the website, as explained in the [install instructions](INSTALL.md).
All changes made to this file are only visible after you rebuild the website. That means that you need to run `bundle exec jekyll serve --lsi` again if you are running the website locally or push your changes to GitHub if you are using GitHub Pages. All other changes are visible immediately, you only need to refresh the page.
All changes made to this file are only visible after you rebuild the website. That means that you need to run `bundle exec jekyll serve` again if you are running the website locally or push your changes to GitHub if you are using GitHub Pages. All other changes are visible immediately, you only need to refresh the page.

## Modifying the CV information

Expand All @@ -54,7 +54,7 @@ The user and repository information is defined in [\_data/repositories.yml](_dat

## Creating new pages

You can create new pages by adding new Markdown files in the [\_pages](_pages/) directory. The easiest way to do this is to copy an existing page and modify it. You can choose the layout of the page in the [frontmatter](https://jekyllrb.com/docs/front-matter/) of the Markdown file. You can also add new layouts in the [\_layouts](_layouts/) directory if you feel the need for it.
You can create new pages by adding new Markdown files in the [\_pages](_pages/) directory. The easiest way to do this is to copy an existing page and modify it. You can choose the layout of the page by changing the [layout](https://jekyllrb.com/docs/layouts/) attribute in the [frontmatter](https://jekyllrb.com/docs/front-matter/) of the Markdown file, and also the path to access it by changing the [permalink](https://jekyllrb.com/docs/permalinks/) attribute. You can also add new layouts in the [\_layouts](_layouts/) directory if you feel the need for it.

## Creating new blog posts

Expand All @@ -80,7 +80,7 @@ You can easily create your own collections, apps, short stories, courses, or wha

To add publications create a new entry in the [\_bibliography/papers.bib](_bibliography/papers.bib) file. You can find the BibTeX entry of a publication in Google Scholar by clicking on the quotation marks below the publication title, then clicking on "BibTeX", or also in the conference page itself. By default, the publications will be sorted by year and the most recent will be displayed first. You can change this behavior and more in the `Jekyll Scholar` section in [\_config.yml](_config.yml) file.

You can add extra information to a publication, like a PDF file in the `assets/pdfs/` directory and add the path to the PDF file in the BibTeX entry with the `pdf` field. Some of the supported fields are: `abstract`, `altmetric`, `arxiv`, `bibtex_show`, `blog`, `code`, `dimensions`, `doi`, `eprint`, `html`, `isbn`, `pdf`, `pmid`, `poster`, `slides`, `supp`, `video`, and `website`.
You can add extra information to a publication, like a PDF file in the `assets/pdfs/` directory and add the path to the PDF file in the BibTeX entry with the `pdf` field. Some of the supported fields are: `abstract`, `altmetric`, `annotation`, `arxiv`, `bibtex_show`, `blog`, `code`, `dimensions`, `doi`, `eprint`, `html`, `isbn`, `pdf`, `pmid`, `poster`, `slides`, `supp`, `video`, and `website`.

### Author annotation

Expand All @@ -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 All @@ -124,6 +124,7 @@ There are several custom bibtex keywords that you can use to affect how the entr
- `abbr`: Adds an abbreviation to the left of the entry. You can add links to these by creating a venue.yaml-file in the \_data folder and adding entries that match.
- `abstract`: Adds an "Abs" button that expands a hidden text field when clicked to show the abstract text
- `altmetric`: Adds an [Altmetric](https://www.altmetric.com/) badge (Note: if DOI is provided just use `true`, otherwise only add the altmetric identifier here - the link is generated automatically)
- `annotation`: Adds a popover info message to the end of the author list that can potentially be used to clarify superscripts. HTML is allowed.
- `arxiv`: Adds a link to the Arxiv website (Note: only add the arxiv identifier here - the link is generated automatically)
- `bibtex_show`: Adds a "Bib" button that expands a hidden text field with the full bibliography entry
- `blog`: Adds a "Blog" button redirecting to the specified link
Expand All @@ -145,3 +146,54 @@ A variety of beautiful theme colors have been selected for you to choose from. T
## Adding social media information

You can add your social media links by adding the specified information at the `Social integration` section in the [\_config.yml](_config.yml) file. This information will appear at the bottom of the `About` page.

## Adding a newsletter

You can add a newsletter subscription form by adding the specified information at the `newsletter` section in the [\_config.yml](_config.yml) file. To set up a newsletter, you can use a service like [Loops.so](https://loops.so/), which is the current supported solution. Once you have set up your newsletter, you can add the form [endpoint](https://loops.so/docs/forms/custom-form) to the `endpoint` field in the `newsletter` section of the [\_config.yml](_config.yml) file.

Depending on your specified footer behavior, the sign up form either will appear at the bottom of the `About` page and at the bottom of blogposts if `related_posts` are enabled, or in the footer at the bottom of each page.

## Adding Token for Lighthouse Badger

To add secrets for [lighthouse-badger](https://github.com/alshedivat/al-folio/actions/workflows/lighthouse-badger.yml), create a [personal access token (PAT)](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) and add it as a [secret](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-encrypted-secrets-for-a-repository) named `LIGHTHOUSE_BADGER_TOKEN` to your repository. The [lighthouse-badger documentation](https://github.com/MyActionWay/lighthouse-badger-workflows#lighthouse-badger-easyyml) specifies using an environment variable, but using it as a secret is more secure and appropriate for a PAT.

Also In case you face the error: "Input required and not supplied: token" in the Lighthouse Badger action, this solution resolves it.

### Personal Access Token (fine-grained) Permissions for Lighthouse Badger:

- **contents**: access: read and write
- **metadata**: access: read-only

Due to the necessary permissions (PAT and others mentioned above), it is recommended to use it as a secret rather than an environment variable.

## Customizing fonts, spacing, and more

You can customize the fonts, spacing, and more by editing [\_sass/\_base.scss](_sass/_base.scss). The easiest way to try in advance the changes is by using [chrome dev tools](https://developer.chrome.com/docs/devtools/css) or [firefox dev tools](https://firefox-source-docs.mozilla.org/devtools-user/). In there you can click in the element and find all the attributes that are set for that element and where are they. For more information on how to use this, check [chrome](https://developer.chrome.com/docs/devtools/css) and [firefox](https://firefox-source-docs.mozilla.org/devtools-user/page_inspector/how_to/examine_and_edit_css/index.html) how-tos, and [this tutorial](https://www.youtube.com/watch?v=l0sgiwJyEu4).

## Scheduled Posts

`al-folio` contains a workflow which automatically publishes all posts scheduled at a specific day, at the end of the day (23:30). By default the action is disabled, and to enable it you need to go to `.github/workflows/` and find the file called `schedule-posts.txt`. This is the workflow file. For GitHub to recognize it as one (or to enable the action), you need to rename it to `schedule-posts.yml`.

In order to use this you need to save all of your "Completed" blog posts which are scheduled to be uploaded on a specific date, in a folder named `_scheduled/` in the root directory.

> Incomplete posts should be saved in `_drafts/`

### Name Format

In this folder you need to store your file in the same format as you would in `_posts/`

> Example file name: `2024-08-26-This file will be uploaded on 26 August.md`

### Important Notes

- The scheduler uploads posts everyday at 🕛 23:30 UTC
- It will only upload posts at 23:30 UTC of their respective scheduled days, It's not uploaded in 23:59 in case there are a lot of files as the scheduler must finish before 00:00
- It will only upload files which follow the pattern `yyyy-mm-dd-title.md`
- This means that only markdown files will be posted
- It means that any markdown which do not follow this pattern will not be posted
- The scheduler works by moving posts from the `_scheduled/` directory to `_posts/`, it will not post to folders like `_projects/` or `_news/`
- The date in the name of the file is the day that file will be uploaded on
- `2024-08-27-file1.md` will not be posted before or after 27-August-2024 (Scheduler only works for posts scheduled on the present day)
- `2025-08-27-file2.md` will be posted exactly on 27-August-2025
- `File3.md` will not be posted at all
- `2026-02-31-file4.md` is supposed to be posted on 31-February-2026, but there is no 31st in February hence this file will never be posted either
Loading

0 comments on commit d3bc489

Please sign in to comment.