Skip to content

Commit 66e2811

Browse files
authored
Basic website to render README. (#24)
* add simple zola page * Update README.md [GH Action] * add workflow to build website
1 parent 9f8bff3 commit 66e2811

File tree

8 files changed

+251
-2
lines changed

8 files changed

+251
-2
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Generate Website
2+
run-name: generate website from README.
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- 'README.md'
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
if: github.ref == 'refs/heads/main'
12+
steps:
13+
- name: checkout
14+
uses: actions/checkout@v4
15+
- run: cp README.md website/content/_index.md
16+
- run: "sed -i '1i ---\\ntemplate: index.html\\n---\\n' website/content/_index.md"
17+
- name: build_and_deploy
18+
uses: shalzz/zola-deploy-action@v0.17.2
19+
env:
20+
# Target branch
21+
PAGES_BRANCH: gh-pages
22+
# Provide personal access token
23+
# TOKEN: ${{ secrets.TOKEN }}
24+
# Or if publishing to the same repo, use the automatic token
25+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
BUILD_DIR: './website'

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
*.html
21
.DS_Store
32
README_files/
43

54
# We don't want to add the README.md file on manual commits
65
# because it will be auto-generated from the .bib file by a GitHub Action
7-
README.md
6+
README.md
7+
website/content/_index.md

website/config.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# The URL the site will be built for
2+
title = "Awesome Amortized Inference"
3+
base_url = "https://awesome-amortized-inference.bayesflow.org"
4+
5+
# Whether to automatically compile all Sass files in the sass directory
6+
compile_sass = false
7+
8+
# Whether to build a search index to be used later on by a JavaScript library
9+
build_search_index = false
10+
11+
[markdown]
12+
# Whether to do syntax highlighting
13+
# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola
14+
highlight_code = false
15+
16+
[extra]
17+
# Put all your custom variables here

website/content/.gitkeep

Whitespace-only changes.

website/static/.gitkeep

Whitespace-only changes.

website/templates/base.html

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
{#- meta tags #}
5+
<meta charset="utf-8" />
6+
<meta http-equiv="x-ua-compatible" content="ie=edge" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1" />
8+
<meta name="base" content="{{ config.base_url | safe }}" />
9+
<meta name="HandheldFriendly" content="True" />
10+
<meta name="color-scheme" content="dark light">
11+
<meta name="theme-color" media="(prefers-color-scheme: dark)">
12+
<meta name="theme-color" media="(prefers-color-scheme: light)">
13+
{#- Security: CSP, referrer #}
14+
{%- if config.extra.security_header_referrer %}
15+
<meta name="referrer" content="{{ config.extra.security_header_referrer | safe }}" />
16+
{%- endif %}
17+
{%- if config.extra.security_header_csp %}
18+
<meta http-equiv="Content-Security-Policy" content="{{ config.extra.security_header_csp | safe }}" />
19+
{%- endif %}
20+
{#- Style Sheets #}
21+
{% set css = load_data(path="templates/partials/styles.css") %}
22+
<style>{{ css | safe }}</style>
23+
</head>
24+
<body>
25+
{%- block header %}
26+
<header>
27+
<div class="navigation-container">
28+
<nav class="site-navigation top-bar" role="navigation">
29+
<div class="top-bar--title">
30+
31+
{%- if config.extra.logo -%}
32+
33+
<a href="{{ get_url(path="/", lang=lang) }}" title="{{config.title}}">
34+
{%- if config.extra.logo.file -%}
35+
<img src="{{ config.base_url | safe }}/{{ config.extra.logo.file | safe }}"{%- if config.extra.logo.alt %} alt="{{ config.extra.logo.alt | safe }}"{%- endif %}{%- if config.extra.logo.width %} width="{{ config.extra.logo.width | safe }}"{%- endif %}{%- if config.extra.logo.height %} height="{{ config.extra.logo.height | safe }}"{%- endif %} />
36+
{%- endif -%}
37+
{%- if config.extra.logo.text -%}{{ config.extra.logo.text | safe }}{%- endif -%}
38+
</a>
39+
40+
{%- elif config.extra.textlogo -%}
41+
<a href="{{ get_url(path="/", lang=lang) }}" title="{{config.title}}">{{ config.extra.textlogo | safe }}</a>
42+
{%- elif config.title -%}
43+
<a href="{{ get_url(path="/", lang=lang) }}" title="{{config.title}}">{{ config.title | safe }}</a>
44+
{%- endif -%}
45+
</div>
46+
47+
<div class="top-bar--links">
48+
<a href="https://github.com/bayesflow-org/awesome-amortized-inference/blob/main/CONTRIBUTING.md">Contribute here!</a>
49+
</div>
50+
</nav>
51+
{%- if config.extra.sitedesc %}
52+
{%- if config.description %}
53+
<div class="desc">{{ config.description }}</div>
54+
{%- endif %}
55+
{%- endif %}
56+
{%- if config.extra.headhr %}
57+
<hr />
58+
{%- endif %}
59+
</div>
60+
</header>
61+
{%- endblock header %}
62+
<main>
63+
{%- block content %}
64+
{%- endblock content %}
65+
</main>
66+
{%- block footer %}
67+
<footer>
68+
{%- if config.extra.foothr %}
69+
<hr />
70+
{%- endif %}
71+
<div class="c">
72+
73+
{%- if config.extra.menu_footer %}
74+
<nav class="vpad">
75+
{%- for i in config.extra.menu_footer -%}
76+
{%- if i.url is matching("^http[s]?://") %}
77+
{%- set furl=i.url %}
78+
{%- elif i.url != "sitemap.xml" %}
79+
{%- set furl=get_url(path=i.url, lang=lang, trailing_slash=i.slash) %}
80+
{%- else %}
81+
{%- set furl=get_url(path=i.url, trailing_slash=i.slash) %}
82+
{%- endif %}
83+
<a class="rpad{%- if i.size %} {{ i.size }}{% endif %}" href="{{ furl | safe }}{%- if i.slash and uglyurls %}index.html{%- endif %}"{% if i.blank %} target="_blank"{% endif %}>{{ i.name | safe }} </a>
84+
{%- endfor %}
85+
</nav>
86+
{%- endif %}
87+
88+
{#- Copyright START #}
89+
{%- set current_year = now() | date(format="%Y") %}
90+
{%- set current_year = '<span id="year">' ~ current_year ~ '</span>' %}
91+
92+
{%- if config.extra.copyright_override -%}
93+
{%- if lang != config.default_language %}
94+
{%- set copyright_string = '© $CURRENT_YEAR $SITE_TITLE' | replace(from="$CURRENT_YEAR", to=current_year) | replace(from="$SITE_TITLE", to=config.title) %}
95+
{% else %}
96+
{%- set copyright_string = config.extra.copyright_override | replace(from="$CURRENT_YEAR", to=current_year) | replace(from="$SITE_TITLE", to=config.title) %}
97+
{% endif -%}
98+
{%- else -%}
99+
{%- set copyright_string = "&copy;" ~ current_year ~ " " ~ config.title %}
100+
{%- endif %}
101+
<p> {{ copyright_string | safe }}. Powered by <a href="https://www.getzola.org/" target="_blank">Zola</a>.</p> </div>
102+
</footer>
103+
{%- endblock footer %}
104+
{%- block gotop %}
105+
{%- endblock gotop %}
106+
</body>
107+
</html>

website/templates/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{% extends "base.html" %}
2+
{%- block content %}
3+
<div class="content">
4+
{{ section.content | safe }}
5+
</div>
6+
{%- endblock content %}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/* set variables for light and dark mode*/
2+
:root {
3+
--layout-max-width: 50rem;
4+
--background-color: #fffff4;
5+
--header-color: aliceblue;
6+
--text-color: black;
7+
--link-color: #0366d6;
8+
--link-visited-color: #5a3bb1;
9+
--separator-color: #eaecef;
10+
}
11+
12+
@media (prefers-color-scheme: dark) {
13+
:root {
14+
--background-color: #1c1919;
15+
--header-color: #252431;
16+
--text-color: #f5f5f5;
17+
--link-color: #3e8df2;
18+
--link-visited-color: #9a76ff;
19+
--separator-color: #373644;
20+
}
21+
}
22+
23+
body {
24+
margin: 0;
25+
background: var(--background-color);
26+
color: var(--text-color);
27+
}
28+
29+
h2 {
30+
border-bottom: 1px solid var(--separator-color);
31+
padding-bottom: 0.3rem;
32+
}
33+
34+
a {
35+
color: var(--link-color);
36+
}
37+
38+
a:visited {
39+
color: var(--link-visited-color);
40+
}
41+
42+
.content {
43+
max-width: var(--layout-max-width);
44+
margin: auto;
45+
}
46+
47+
/* Navigation/Top bar*/
48+
49+
.navigation-container {
50+
background-color: var(--header-color);
51+
}
52+
53+
nav {
54+
display: flex;
55+
flex-direction: column;
56+
justify-content: center;
57+
align-items: center;
58+
flex-grow: space-between;
59+
padding: 0.4rem;
60+
margin: auto;
61+
max-width: var(--layout-max-width);
62+
}
63+
64+
.top-bar--title {
65+
flex: 1;
66+
}
67+
68+
.top-bar--title>a[href] {
69+
font-size: 2rem;
70+
text-decoration: none;
71+
font-weight: bold;
72+
color: var(--text-color);
73+
}
74+
75+
.top-bar--links a {
76+
color: var(--text-color);
77+
font-size: 1.4rem;
78+
text-decoration: none;
79+
}
80+
81+
.top-bar--links a:hover {
82+
text-decoration: underline;
83+
}
84+
85+
/* Hide the first heading to avoid double headings */
86+
.content h1:first-child {
87+
display: none;
88+
}
89+
90+
footer .c {
91+
display: flex;
92+
justify-content: center;
93+
}

0 commit comments

Comments
 (0)