diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/_macros.html | 20 | ||||
-rw-r--r-- | templates/_variables.html | 15 | ||||
-rw-r--r-- | templates/index.html | 154 | ||||
-rw-r--r-- | templates/page.html | 15 | ||||
-rw-r--r-- | templates/section.html | 1 | ||||
-rw-r--r-- | templates/shortcodes/issue.html | 1 |
6 files changed, 206 insertions, 0 deletions
diff --git a/templates/_macros.html b/templates/_macros.html new file mode 100644 index 0000000..88a2f47 --- /dev/null +++ b/templates/_macros.html @@ -0,0 +1,20 @@ +{% macro render_header() %} +{% set section = get_section(path="_index.md") %} +<a href="{{ section.permalink }}"> + <div class="logo"> + <img src="{{ get_url(path=config.extra.juice_logo_path) }}" alt="logo"> + {{ config.extra.juice_logo_name }} + </div> +</a> + +<nav> + {% for page in section.pages %} + <a class="nav-item subtitle-text" href="{{ page.permalink }}">{{ page.title }}</a> + {% endfor %} + {% if config.extra.juice_extra_menu %} + {% for menu in config.extra.juice_extra_menu %} + <a class="nav-item subtitle-text" href="{{ menu.link }}">{{ menu.title }}</a> + {% endfor %} + {% endif %} +</nav> +{% endmacro render_header %}
\ No newline at end of file diff --git a/templates/_variables.html b/templates/_variables.html new file mode 100644 index 0000000..8480408 --- /dev/null +++ b/templates/_variables.html @@ -0,0 +1,15 @@ +<style> + :root { + /* Primary theme color */ + --primary-color: #ea596e; + /* Primary theme text color */ + --primary-text-color: #543631; + /* Primary theme link color */ + --primary-link-color: #d45063; + /* Secondary color: the background body color */ + --secondary-color: #fcfaf6; + --secondary-text-color: #303030; + /* Highlight text color of table of content */ + --toc-highlight-text-color: #6e2a34; + } +</style> diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..3afc311 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,154 @@ +{% import "_macros.html" as macros %} +<!DOCTYPE html> +<html lang="en"> + +<head> + <meta charset="UTF-8"> + <title>{% block title %}{{ config.title }}{% endblock title %}</title> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + {% block favicon %} + <link rel="icon" type="image/png" href="/favicon.ico"> + {% endblock favicon %} + {% include "_variables.html" %} + <link href="https://fonts.googleapis.com/css?family=Alfa+Slab+One&display=swap" rel="stylesheet"> + <link href="https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600&display=swap" rel="stylesheet"> + <link rel="stylesheet" href="/normalize.css"> + <link rel="stylesheet" href="{{ get_url(path="juice.css") }}"> + {% block head %} + {% endblock head %} +</head> + +<body> + {% block header %} + <header class="box-shadow"> + {{ macros::render_header() }} + </header> + + {#<header class="pos-absolute" style="background-color: transparent"> + {{ macros::render_header() }} + </header>#} + + {#<div class="hero"> + {% block hero %} + <script async defer src="https://buttons.github.io/buttons.js"></script> + <section class="text-center"> + <h1 class="heading-text" style="font-size: 50px"> + Build your static website + </h1> + <h3 class="title-text"> + <b>Juice</b> is an intuitive, elegant, and lightweight Zola theme for product websites. + </h3> + <div> + <a class="github-button" href="https://github.com/huhu/juice" data-size="large" data-show-count="true" + aria-label="Star huhu/juice on GitHub">Star</a> + <a class="github-button" href="https://github.com/huhu/juice/fork" data-size="large" + data-show-count="true" aria-label="Fork huhu/juice on GitHub">Fork</a> + </div> + </section> + <img class="hero-image" style="width: 50%" src="{{ get_url(path="juice.svg") }}"> + + <div class="explore-more text" + onclick="document.getElementById('features').scrollIntoView({behavior: 'smooth'})"> + Explore More ⇩ + </div> + <style> + .hero section { + padding: 0 5rem; + } + @media screen and (max-width: 768px) { + .hero section { + padding: 0 2rem; + } + + .hero-image { + display: none + } + } + </style> + {% endblock hero %} + </div> + #} + {% endblock header %} + + <main> + {% block toc %} + {% if section.toc %} + {% set toc = section.toc %} + {% elif page.toc %} + {% set toc = page.toc %} + {% endif %} + {% if toc %} + <div class="toc"> + <div class="toc-sticky"> + {% for h in toc %} + <div class="toc-item"> + <a class="subtext" href="{{h.permalink | safe}}">{{ h.title }}</a> + </div> + {% if h.children %} + {% for h2 in h.children %} + <div class="toc-item-child"> + <a class="subtext" href="{{h2.permalink | safe}}"><small>- {{ h2.title }}</small></a> + </div> + {% endfor %} + {% endif %} + {% endfor %} + </div> + </div> + {% endif %} + {% endblock toc %} + + <div class="content text"> + {% block content %} + <div id="features" class="heading-text">Overview</div> + {{ section.content | safe }} + {% endblock content %} + </div> + + {% block sidebar %} + {% endblock sidebar %} + </main> + + {% block footer %} + <footer> + <small class="subtext"> + <a href="https://huhu.io">Huhu.io</a> © 2021 + </small> + </footer> + {% endblock footer %} +</body> +<script> + function highlightNav(heading) { + let pathname = location.pathname; + document.querySelectorAll(".toc a").forEach((item) => { + item.classList.remove("active"); + }); + document.querySelector(".toc a[href$='" + pathname + "#" + heading + "']").classList.add("active"); + } + + let currentHeading = ""; + window.onscroll = function () { + let h = document.querySelectorAll("h1,h2,h3,h4,h5,h6"); + let elementArr = []; + + h.forEach(item => { + if (item.id !== "") { + elementArr[item.id] = item.getBoundingClientRect().top; + } + }); + elementArr.sort(); + for (let key in elementArr) { + if (!elementArr.hasOwnProperty(key)) { + continue; + } + if (elementArr[key] > 0 && elementArr[key] < 300) { + if (currentHeading !== key) { + highlightNav(key); + currentHeading = key; + } + break; + } + } + } +</script> + +</html> diff --git a/templates/page.html b/templates/page.html new file mode 100644 index 0000000..c6d8610 --- /dev/null +++ b/templates/page.html @@ -0,0 +1,15 @@ +{% import "_macros.html" as macros %} +{% extends "index.html" %} + +{% block title %}{{ page.title }} | {{ super() }} {% endblock title %} + +{% block header %} +<header class="box-shadow"> + {{ macros::render_header() }} +</header> +{% endblock header %} + +{% block content %} +<div class="heading-text">{{ page.description }}</div> +{{ page.content | safe }} +{% endblock content %}
\ No newline at end of file diff --git a/templates/section.html b/templates/section.html new file mode 100644 index 0000000..09763b9 --- /dev/null +++ b/templates/section.html @@ -0,0 +1 @@ +{% extends "index.html" %} diff --git a/templates/shortcodes/issue.html b/templates/shortcodes/issue.html new file mode 100644 index 0000000..3006d9b --- /dev/null +++ b/templates/shortcodes/issue.html @@ -0,0 +1 @@ +<a href="{{ config.extra.repository_url }}/issues/{{ id }}">#{{ id }}</a>
\ No newline at end of file |