Skip to content

Commit

Permalink
Add initial code.
Browse files Browse the repository at this point in the history
  • Loading branch information
aterenin committed Dec 11, 2023
0 parents commit 27b830d
Show file tree
Hide file tree
Showing 29 changed files with 751 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build and Deploy Website

on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Download Zola
run: curl -fLsS "https://github.com/getzola/zola/releases/download/v0.17.2/zola-v0.17.2-x86_64-unknown-linux-gnu.tar.gz" | tar xzf - -C /usr/local/bin
- name: Verify Zola binary
run: echo "b62c19a1e104a0526a48a1f29c05ba90b9a14fe7a17ef6a7978d9610886cc783 /usr/local/bin/zola" | shasum -a 256 -b -c --strict
- name: Build website
run: zola build
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./public
name: github-pages
retention-days: 1
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
/public
15 changes: 15 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
base_url = "https://aterenin.github.io/academic-paper"
compile_sass = true
build_search_index = false
generate_feed = false
minify_html = true

[markdown]
highlight_code = true
highlight_theme = "css"
smart_punctuation = true

[extra]
favicon = false
large_card = true
footer_text = "This website is built using [Zola](https://www.getzola.org) and the [Academic Paper](http://github.com/aterenin/academic-paper/) theme, which is [designed to last](https://jeffhuang.com/designed_to_last/)."
54 changes: 54 additions & 0 deletions content/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
+++
title = "Academic Paper Zola Theme"
[extra]
authors = [
{name = "Alexander Terenin", url = "https://avt.im/"},
]
venue = {name = "GitHub", url = "https://github.com/aterenin/academic-paper"}
buttons = [
{name = "Paper", url = "https://aterenin.github.io/academic-paper"},
{name = "PDF", url = "https://aterenin.github.io/academic-paper"},
{name = "Code", url = "https://github.com/aterenin/academic-paper"},
{name = "Poster", url = "https://aterenin.github.io/academic-paper"},
{name = "Video", url = "https://aterenin.github.io/academic-paper"},
]
katex = true
+++

Welcome to the [Academic Paper](https://github.com/aterenin/academic-paper) Zola theme!
This theme is designed for hosting a blog-post-style website to facilitate scientific communication of your academic paper.

# Features

[Academic Paper](https://github.com/aterenin/academic-paper) is designed to be reasonably feature-complete. In particular, it supports:

* A header with title, author, publication venue, year, and optional buttons for the paper, PDF download link, code, poster, and video.
* Syntax highlighting via Zola, with a minimal CSS-based color theme.
* Math rendering via KaTeX, compatible with both client-side and server-side rendering when configured appropriately.
* Figures via a `figure(alt='Image alt text',src='path/to/image.png')` Zola shortcode, with support for optional captions, subfigures with optional subcaptions, implemented in responsive manner via flexbox.
* Markdown footnotes via Zola.
* Twitter Summary Card, OpenGraph, and JSON-LD metadata, to ensure the web pages produced are search-engine-friendly, and provide social media websites with a banner image link they can display when the website is shared on social media, with an implementation very similar to [Jekyll SEO Tag](https://github.com/jekyll/jekyll-seo-tag).

Let's demonstrate some of these: writing
```tex
$$
\int_{\mathbb{R}} \frac{1}{\sqrt{2\pi\sigma^2}} \exp\left(\frac{(x-\mu)^2}{-2\sigma^2}\right) \mathrm{d} x = 1.
$$
```
in the Markdown file produces the output
```
$$
\int_{\mathbb{R}} \frac{1}{\sqrt{2\pi\sigma^2}} \exp\left(\frac{(x-\mu)^2}{-2\sigma^2}\right) \mathrm{d} x = 1.
$$
```
This theme also supports footnotes, and will style the heading that immediately precedes them.[^author]

# Design and maintainability

[Academic Paper](https://github.com/aterenin/academic-paper) is [designed to last](https://jeffhuang.com/designed_to_last/), meaning that it follows a number of best practices to ensure the websites it produces continue to work correctly in the indefinite future with minimal to no maintenance.
In particular, this theme uses no JavaScript or CSS dependencies, except optionally KaTeX for math.
Zola, with its Rust-based code, focus on simplicity, and one-binary design, is the clear static site generator of choice for such a theme.

# References

[^author]: This theme is designed and built by Alexander Terenin.
71 changes: 71 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Academic Paper: a Zola theme

[Academic Paper](https://aterenin.github.io/academic-paper) is a Zola theme desgned for hosting a website for scientific communication of an academic paper in the style of a blog post.
A demo website built with Academic Paper can be found at [aterenin.github.io/academic-paper](https://aterenin.github.io/academic-paper), and an example repository using this theme can be found at [github.com/aterenin/papers.avt.im](https://github.com/aterenin/papers.avt.im), with links to the pages in this repository found at [avt.im/archive?papers](https://avt.im/archive?papers).

# Features

[Academic Paper](https://github.com/aterenin/academic-paper) is designed to be reasonably feature-complete. Its features include:

* An automatic header which lists the title, author, venue, year, and along with customizable buttons.
* Syntax highlighting and math rendering via KaTeX which can be done both client-side and server-side with appropriate configuration.
* Figures via a Zola shortcode `figure(alt='Image alt text',src='path/to/image.png')`, which supports captions, subfigures, subcaptions, and is rendered using responsive flexbox.
* Markdown footnotes via Zola's footnote support.
* Metadata including Twitter Summary Card, OpenGrapd, and JSON-LD, implemented similar to [Jekyll SEO Tag](https://github.com/jekyll/jekyll-seo-tag): these ensure pages are search-engine-fiendly and provide social media websites with links which are displayed when links are shared,

# Design and maintainability

[Academic Paper](https://github.com/aterenin/academic-paper) is [designed to last](https://jeffhuang.com/designed_to_last/).
This means it follows a set of best practices which try to ensure websites correctly built with it will work correctly in the indefinite future with minimal maintenance, even as the internet changes and links break over time.
As consequence, the theme has no JavaScript or CSS dependencies if KaTeX is used server-side.

# Documentation

The examples below document the theme's options which are available in the TOML files, which are listed as comments within each file.

## Config.toml

```toml
base_url = "https://example.com"
compile_sass = true # should be set to true
build_search_index = false # not used by the theme
generate_feed = false # not used by the theme
minify_html = true # to ensure correct rendering due to minification of whitespace, should be set to true, unless there is a reason to override it

[markdown]
highlight_code = true # should be set to true unless the page has no code to highlight
highlight_theme = "css" # this theme includes its own CSS-based styling of highlighting, so this should be set to CSS

[extra]
favicon = false # set to true to use favicon.ico as the page's favicon
large_card = true # set to true to generate a large-size Twitter card
footer_text = "This website is built using [Zola](https://www.getzola.org) and the [Academic Paper](http://github.com/aterenin/academic-paper/) theme, which is [designed to last](https://jeffhuang.com/designed_to_last/)." # by default this page adds a small and non-intrusive footer with some text linking to this repository - you can set this to false to remove the footer if you prefer
```

## Page and section configuration

```toml
+++
title = "Paper Title"
[extra]
authors = [ # authors should be listed as an array in [extra] rather than via Zola's built-in support
{name = "Author 1", star = true}, # prints a star next to the author name, often useful for 'equal contribution' or similar flags
{name = "Author 2", url = "https://example.com/", star = true}, # url is optional
{name = "Author 3"},
]
star = 'Equal contribution' # adds the text 'Equal contribution' with a star superscript to the title
venue = {name = "Example Conference", date = 2023-12-10, url = "https://example.org/"} # date of publication should be listed here, to distinguish it from the date the website itself was written and updated, which can be added via Zola's built-in support
buttons = [ # this theme supports any set of buttons, but and will by default include an SVG icon for the examples listed below
{name="Paper", url = "https://example.com", no_icon = true}, # to disable drawing the icon, set no_icon to true
{name="PDF", url = "https://example.com"},
{name="Code", url = "https://example.com"},
{name="Video", url = "https://example.com"},
{name="Slides", url = "https://example.com"},
{name="Poster", url = "https://example.com"},
{name="Your custom button", url = "https://example.com"}, # to add an icon, add it as an include, and override the macro icons.html
]
katex = true # to enable math via katex - whether using server-side or client-side rendering - set katex to true
+++

Your page's Markdown content goes here...
```
32 changes: 32 additions & 0 deletions sass/_buttons.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.btn {
display: inline-block;
font-weight: 400;
color: var(--color-white);
text-align: center;
vertical-align: middle;
user-select: none;
background-color: var(--color-btn);
border: 1px solid var(--color-btn);
padding: 0.375rem 0.75rem;
font-size: 1rem;
line-height: 1.5;
border-radius: 1.5rem;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
svg {
width: 1.25rem;
display: inline-block;
vertical-align: text-bottom;
}
}

.btn:hover {
color: var(--color-white);
background-color: color-mix(in srgb, var(--color-btn), var(--color-white) 15%);
text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
.btn {
transition: none !important;
}
}
37 changes: 37 additions & 0 deletions sass/_color.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
:root {
color-scheme: light dark;
--color-text: #212529;
--color-primary: #007bff;
--color-light: #f8f9fa;
--color-white: #fff;
--color-black: #000;
--color-btn: #343a40;
--color-video-border: #dee2e6;
--color-selection: #fec6c4;
}

@media (prefers-color-scheme: dark) {
:root {
--color-text: #d1cdc7;
--color-primary: #33a3ff;
--color-light: #1b1e1f;
--color-white: #181a1b;
--color-black: #e7e5e4;
--color-btn: #cbc5bf;
--color-selection: #01393b;
}
.dark-invert, pre.z-code code {
filter: invert(90%) hue-rotate(180deg) sepia(10%);
}
img:not(.dark-invert) {
filter: brightness(80%);
}
}

::selection {
background: var(--color-selection);
}

::-moz-selection {
background: var(--color-selection);
}
31 changes: 31 additions & 0 deletions sass/_figures.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
$responsive-cutoff: 768px;

figure {
display: flex;
flex-direction: column;
align-items: center;
video {
border: 1px solid var(--color-video-border);
border-radius: 0.25rem;
}
img, video {
margin-bottom: 0.5rem;
}
> div {
display: flex;
flex-direction: column;
align-items: center;
}
figure {
margin-left: 1rem;
margin-right: 1rem;
}
}

@media (min-width: $responsive-cutoff) {
figure > div {
flex-direction: row;
align-items: baseline;
justify-content: center;
}
}
15 changes: 15 additions & 0 deletions sass/_footnotes.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.content .footnote-definition {
display: flex;
sup {
margin-left: 1rem;
margin-right: 0.5rem;
vertical-align: baseline;
font-size: inherit;
}
sup:after {
content: ".";
}
p {
text-align: left;
}
}
35 changes: 35 additions & 0 deletions sass/_highlight.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.z-code { color: #334; }
.z-comment { color: #99a; }
.z-variable.z-parameter.z-function { color: #334; }
.z-keyword { color: #a2a; }
.z-variable { color: #d54; }
.z-entity.z-name.z-function, .z-meta.z-require, .z-support.z-function.z-any-method { color: #08b; }
.z-support.z-class, .z-entity.z-name.z-class, .z-entity.z-name.z-type.z-class { color: #b80; }
.z-meta.z-class { color: #b80; }
.z-keyword.z-other.z-special-method { color: #08b; }
.z-storage { color: #a2a; }
.z-support.z-function { color: #08b; }
.z-string { color: #595; }
.z-constant.z-numeric { color: #b80; }
.z-none { color: #b80; }
.z-none { color: #b80; }
.z-constant { color: #b80; }
.z-entity.z-name.z-tag { color: #d54; }
.z-entity.z-other.z-attribute-name { color: #b80; }
.z-entity.z-other.z-attribute-name.z-id, .z-punctuation.z-definition.z-entity { color: #b80; }
.z-meta.z-selector { color: #a2a; }
.z-markup.z-heading .z-punctuation.z-definition.z-heading, .z-entity.z-name.z-section { color: #08b; }
.z-markup.z-bold, .z-punctuation.z-definition.z-bold { color: #a2a; }
.z-markup.z-italic, .z-punctuation.z-definition.z-italic { color: #a2a; }
.z-markup.z-raw.z-inline { color: #595; }
.z-meta.z-link { color: #595; }
.z-markup.z-quote { color: #595; }
.z-markup.z-inserted { color: #9b7; }
.z-markup.z-deleted { color: #d67; }
.z-markup.z-changed { color: #db7; }
.z-string.z-regexp { color: #595; }
.z-constant.z-character.z-escape { color: #19b; }
.z-invalid.z-illegal { color: #fff; background-color: #d67; }
.z-invalid.z-broken { color: #fff; background-color: #db7; }
.z-invalid.z-deprecated { color: #fff; background-color: #db7; }
.z-invalid.z-unimplemented { color: #fff; background-color: #c7d; }
Loading

0 comments on commit 27b830d

Please sign in to comment.