1
0
mirror of https://github.com/avitex/avitex.github.io synced 2025-01-16 04:49:56 +00:00

Compare commits

..

No commits in common. "fbef748bfb37ebd65a9fa90b548294cb9ca81fe9" and "2db949a45cad6cf78a5ba8c319b12dd58a75a166" have entirely different histories.

21 changed files with 86 additions and 81 deletions

View File

@ -9,9 +9,9 @@ script:
- zola build - zola build
after_success: | after_success: |
[ $TRAVIS_BRANCH = source ] && [ $TRAVIS_BRANCH = code ] &&
[ $TRAVIS_PULL_REQUEST = false ] && [ $TRAVIS_PULL_REQUEST = false ] &&
zola build && zola build &&
sudo pip install ghp-import && sudo pip install ghp-import &&
ghp-import -m "build ${TRAVIS_COMMIT}" -c 1bit.pw -n public -b master && ghp-import -c 1bit.pw -n public -b master &&
git push -fq https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git master git push -fq https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git master

View File

@ -9,6 +9,7 @@ generate_rss = true
taxonomies = [ taxonomies = [
{name = "blog/tags", rss = true}, {name = "blog/tags", rss = true},
{name = "blog/categories", rss = true}
] ]
[extra] [extra]
@ -19,6 +20,7 @@ name = "Blog"
url = "/blog" url = "/blog"
sub = [ sub = [
{name = "Latest", url = "/blog"}, {name = "Latest", url = "/blog"},
{name = "Categories", url = "/blog/categories"},
{name = "Tags", url = "/blog/tags"} {name = "Tags", url = "/blog/tags"}
] ]

View File

@ -1,7 +1,6 @@
+++ +++
template = "about.html" template = "about.html"
insert_anchor_links = "right" insert_anchor_links = "right"
description = "Hi! I'm James, a fellow earthling living in Australia."
+++ +++
Hi! I'm James, a fellow earthling living in Australia. Hi! I'm James, a fellow earthling living in Australia.

View File

@ -1,6 +1,5 @@
+++ +++
title = "Social" title = "Social"
description = "Links to my accounts on various social services for identity, code, media, gaming and discussion."
+++ +++
## Identity ## Identity

View File

@ -1 +0,0 @@
*.draft.md

View File

@ -1,8 +1,5 @@
+++ +++
sort_by = "date"
paginate_by = 10 paginate_by = 10
insert_anchor_links = "right" insert_anchor_links = "right"
template = "blog.html" template = "blog.html"
description = "The barren desert... uh... personal blog of avitex."
page_template = "blog/post.html"
+++ +++

View File

@ -2,8 +2,11 @@
title = "Hello World" title = "Hello World"
date = 2018-08-22 date = 2018-08-22
template = "blog/post.html"
[taxonomies] [taxonomies]
"blog/tags" = ["meta", "new"] "blog/tags" = ["new"]
"blog/categories" = ["meta"]
+++ +++
Thought it would be a good idea to have somewhere to put my ramblings, and so I am here. Thought it would be a good idea to have somewhere to put my ramblings, and so I am here.

View File

@ -1,12 +1,10 @@
+++ +++
template = "projects.html" template = "projects.html"
insert_anchor_links = "right" insert_anchor_links = "right"
page_template = "page.html"
description = "Project repositories, along with their associated state. PRs are always welcome, see my about page to contact me."
+++ +++
Project repositories, along with their associated state. Project repositories, along with their associated state.
PRs are always welcome, see my [about page](@/about/_index.md) to contact me. PRs are always welcome, see my [about](@/about/_index.md) to contact me.
## Rust ## Rust
- `arae` - [git](https://github.com/avitex/rust-arae) - `todo`, `v0.1` - `arae` - [git](https://github.com/avitex/rust-arae) - `todo`, `v0.1`

View File

@ -1,6 +1,7 @@
.home-page { .home-page {
width: 100%; width: 100%;
height: 100%; height: 100%;
min-width: 600px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@ -10,9 +11,4 @@
margin: 0; margin: 0;
} }
} }
@media (max-width: $sm-breakpoint) {
text-align: center;
flex-direction: column;
}
} }

View File

@ -5,16 +5,15 @@
} }
html, body { html, body {
width: 100%;
height: 100%; height: 100%;
width: 100%;
} }
.container { .container {
width: 100%; width: 100%;
min-width: 600px;
max-width: 900px; max-width: 900px;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
padding-left: 1rem;
padding-right: 1rem;
padding-bottom: 2rem; padding-bottom: 2rem;
} }

View File

@ -1,4 +1,4 @@
#search { .search-container {
input { input {
padding: 0.5rem 0.75rem; padding: 0.5rem 0.75rem;
border: none; border: none;
@ -7,7 +7,7 @@
border-radius: 4px; border-radius: 4px;
} }
.results-container { .search-results {
display: none; display: none;
} }
} }

View File

@ -12,17 +12,18 @@
li { li {
display: inline-block; display: inline-block;
padding: 0 0.2rem; padding: 0 0.2rem;
color: $grey;
& > a.active {
color: $white;
}
} }
a { a {
display: inline-block; color: inherit;
color: $grey;
border: none; border: none;
text-decoration: none; text-decoration: none;
&:hover, &.active {
color: $white;
}
} }
.main-menu { .main-menu {
@ -30,6 +31,7 @@
} }
.sub-menu { .sub-menu {
color: $grey;
font-size: 0.65rem; font-size: 0.65rem;
} }
} }

View File

@ -95,14 +95,6 @@ small {
font-size: 0.5em; font-size: 0.5em;
} }
ul, ol {
padding-left: 1rem;
li {
padding-bottom: 0.2rem;
}
}
hr { hr {
border: none; border: none;
height: 2px; height: 2px;

View File

@ -1,8 +1,3 @@
// TODO: remove
// <script type="text/javascript" src="{{ get_url(path="elasticlunr.min.js") | safe }}"></script>
// <script type="text/javascript" src="{{ get_url(path="search_index.en.js") | safe }}"></script>
// <script type="text/javascript" src="{{ get_url(path="search.js") | safe }}"></script>
function debounce(func, wait) { function debounce(func, wait) {
var timeout; var timeout;
@ -39,13 +34,13 @@ function makeTeaser(body, terms) {
}); });
var termFound = false; var termFound = false;
var index = 0; var index = 0;
var weighted = []; // contains elements of ['word', weight, index_in_document] var weighted = []; // contains elements of ["word", weight, index_in_document]
// split in sentences, then words // split in sentences, then words
var sentences = body.toLowerCase().split('. '); var sentences = body.toLowerCase().split(". ");
for (var i in sentences) { for (var i in sentences) {
var words = sentences[i].split(' '); var words = sentences[i].split(" ");
var value = FIRST_WORD_WEIGHT; var value = FIRST_WORD_WEIGHT;
for (var j in words) { for (var j in words) {
@ -113,44 +108,40 @@ function makeTeaser(body, terms) {
// add <em/> around search terms // add <em/> around search terms
if (word[1] === TERM_WEIGHT) { if (word[1] === TERM_WEIGHT) {
teaser.push('<b>'); teaser.push("<b>");
} }
startIndex = word[2] + word[0].length; startIndex = word[2] + word[0].length;
teaser.push(body.substring(word[2], startIndex)); teaser.push(body.substring(word[2], startIndex));
if (word[1] === TERM_WEIGHT) { if (word[1] === TERM_WEIGHT) {
teaser.push('</b>'); teaser.push("</b>");
} }
} }
teaser.push('…'); teaser.push("…");
return teaser.join(''); return teaser.join("");
} }
function formatSearchResultItem(item, terms) { function formatSearchResultItem(item, terms) {
return '<div class="result">' return '<div class="search-results__item">'
+ `<a href="${item.ref}">${item.doc.title}</a>` + `<a href="${item.ref}">${item.doc.title}</a>`
+ `<div class="summary">${makeTeaser(item.doc.body, terms)}</div>` + `<div>${makeTeaser(item.doc.body, terms)}</div>`
+ '</div>'; + '</div>';
} }
function initSearch() { function initSearch() {
var $searchComponent = document.getElementById('search'); var $searchInput = document.getElementById("search");
if ($searchComponent === null) { var $searchResults = document.querySelector(".search-results");
return; var $searchResultsItems = document.querySelector(".search-results__items");
}
var $searchInput = $searchComponent.querySelector('input');
var $searchResults = $searchComponent.querySelector('.results-container');
var $searchResultsItems = $searchComponent.querySelector('.results');
var MAX_ITEMS = 10; var MAX_ITEMS = 10;
var options = { var options = {
bool: 'AND', bool: "AND",
fields: { fields: {
title: {boost: 2}, title: {boost: 2},
body: {boost: 1}, body: {boost: 1},
} }
}; };
var currentTerm = ''; var currentTerm = "";
var index = elasticlunr.Index.load(window.searchIndex); var index = elasticlunr.Index.load(window.searchIndex);
$searchInput.addEventListener("keyup", debounce(function() { $searchInput.addEventListener("keyup", debounce(function() {
@ -158,31 +149,32 @@ function initSearch() {
if (term === currentTerm || !index) { if (term === currentTerm || !index) {
return; return;
} }
$searchResults.style.display = term === '' ? 'none' : 'block'; $searchResults.style.display = term === "" ? "none" : "block";
$searchResultsItems.innerHTML = ''; $searchResultsItems.innerHTML = "";
if (term === '') { if (term === "") {
return; return;
} }
var results = index.search(term, options); var results = index.search(term, options);
if (results.length === 0) { if (results.length === 0) {
$searchResults.style.display = 'none'; $searchResults.style.display = "none";
return; return;
} }
currentTerm = term; currentTerm = term;
for (var i = 0; i < Math.min(results.length, MAX_ITEMS); i++) { for (var i = 0; i < Math.min(results.length, MAX_ITEMS); i++) {
var item = document.createElement('li'); var item = document.createElement("li");
item.innerHTML = formatSearchResultItem(results[i], term.split(' ')); item.innerHTML = formatSearchResultItem(results[i], term.split(" "));
$searchResultsItems.appendChild(item); $searchResultsItems.appendChild(item);
} }
}, 150)); }, 150));
} }
if (document.readyState === 'complete' ||
(document.readyState !== 'loading' && !document.documentElement.doScroll) if (document.readyState === "complete" ||
(document.readyState !== "loading" && !document.documentElement.doScroll)
) { ) {
initSearch(); initSearch();
} else { } else {
document.addEventListener('DOMContentLoaded', initSearch); document.addEventListener("DOMContentLoaded", initSearch);
} }

View File

@ -0,0 +1,12 @@
{% extends "content.html" %}
{% block title %}Categories - {{ config.title }}{% endblock %}
{% block content %}
<h1>Categories</h1>
{% if terms %}
<ul>
{% for term in terms %}
<li><a href="{{ term.permalink }}">{{ term.name }}</a> ({{ term.pages | length }})</li>
{% endfor %}
</ul>
{% endif %}
{% endblock content %}

View File

@ -0,0 +1,9 @@
{% extends "content.html" %}
{% import "post_macros.html" as post_macros %}
{% block title %}Category {{ term.name }} - {{ config.title }}{% endblock %}
{% block content %}
<h1>Category: <code>{{ term.name }}</code> <small>(<a href="{{ get_taxonomy_url(kind="blog/categories", name=term.name) }}rss.xml">RSS</a>)</small></h1>
{% for page in term.pages %}
{{ post_macros::page_in_list(page=page) }}
{% endfor %}
{% endblock content %}

View File

@ -18,9 +18,13 @@
{% if config.extra.author %} {% if config.extra.author %}
Published by {{ config.extra.author }} Published by {{ config.extra.author }}
{% endif %} {% endif %}
{% if page.taxonomies | get(key="blog/categories") %}
{% set categories = page.taxonomies | get(key="blog/categories") %}
in <a href="{{ get_taxonomy_url(kind="blog/categories", name=categories[0]) | safe }}">{{ categories[0] }}</a>
{% endif %}
{% set tags = page.taxonomies | get(key="blog/tags") %} {% set tags = page.taxonomies | get(key="blog/tags") %}
{% if tags %} {% if tags %}
with tags and tagged
{% for tag in tags %} {% for tag in tags %}
<a href="{{ get_taxonomy_url(kind="blog/tags", name=tag) | safe }}">{{ tag }}</a> <a href="{{ get_taxonomy_url(kind="blog/tags", name=tag) | safe }}">{{ tag }}</a>
{% if tags | length > 1 %} {% if tags | length > 1 %}

View File

@ -1,6 +1,5 @@
{% extends "content.html" %} {% extends "content.html" %}
{% block title %}Tag - {{ config.title }}{% endblock %} {% block title %}Tag - {{ config.title }}{% endblock %}
{% block meta_description %}Full list of tags used for articles within the blog.{% endblock meta_description %}
{% block content %} {% block content %}
<h1>Tags</h1> <h1>Tags</h1>
{% if terms %} {% if terms %}

View File

@ -15,7 +15,7 @@
{% endmacro is_active_nav %} {% endmacro is_active_nav %}
{% macro meta_desc(ctx) %} {% macro meta_desc(ctx) %}
{%- if ctx.description -%} {%- if ctx.description == "" -%}
{{ ctx.description }} {{ ctx.description }}
{%- else -%} {%- else -%}
{%- if ctx.summary -%} {%- if ctx.summary -%}

View File

@ -1,6 +1,6 @@
<div id="search"> <div class="search-container">
<input type="search" placeholder="🔎 Search"> <input id="search" type="search" placeholder="🔎 Search">
<div class="results-container"> <div class="search-results">
<div class="results"></div> <div class="search-results__items"></div>
</div> </div>
</div> </div>

View File

@ -6,7 +6,7 @@
<meta name="theme-color" content="#111111"/> <meta name="theme-color" content="#111111"/>
<meta name="author" content="{{ config.extra.author }}"> <meta name="author" content="{{ config.extra.author }}">
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{% block meta_description %} <meta name="description" content="{% block meta_description %}
{%- if section -%}{{ macros::meta_desc(ctx=section) }}{%- endif -%} {%- if section -%}{{ macros::meta_desc(ctx=section) }}{%- endif -%}
{%- if page -%}{{ macros::meta_desc(ctx=page) }}{%- endif -%} {%- if page -%}{{ macros::meta_desc(ctx=page) }}{%- endif -%}
@ -19,5 +19,8 @@
</head> </head>
<body> <body>
{% block body %}{% endblock body %} {% block body %}{% endblock body %}
<script type="text/javascript" src="{{ get_url(path="elasticlunr.min.js") | safe }}"></script>
<script type="text/javascript" src="{{ get_url(path="search_index.en.js") | safe }}"></script>
<script type="text/javascript" src="{{ get_url(path="search.js") | safe }}"></script>
</body> </body>
</html> </html>