Skip to content

Commit

Permalink
testing content for blog
Browse files Browse the repository at this point in the history
  • Loading branch information
nic-hartley committed Jul 27, 2022
1 parent 5d41f43 commit ca6cafd
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 4 deletions.
14 changes: 14 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# These are supported funding model platforms

github:
- nic-hartley
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
6 changes: 6 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ defaults:
path: ""
values:
layout: "default"
- scope:
path: ""
type: "posts"
values:
layout: post
author: Nic Hartley
2 changes: 1 addition & 1 deletion docs/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<a href="/ide">IDE</a>
<a href="/blog">Blog</a>
<a href="/donate">Donate</a>
<a class="listen" href="/listen">Listen<img src="/listen.png" alt=""></a>
<a class="listen" href="/listen">Listen <img src="/listen.png" alt="&#x1F50A;"></a>
</div>
<div id="content">
{{ content }}
Expand Down
8 changes: 8 additions & 0 deletions docs/_layouts/post.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
layout: default
---

<h1>{{ page.title }}</h1>
<p id="byline">{{ page.author }} &ndash; {{ page.date | date: "%B %e, %Y" }}</p>
<hr>
{{ content }}
9 changes: 9 additions & 0 deletions docs/_posts/2022-01-01-happy-new-year.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Happy 2022!
tags:
- foo
- bar
- test
---

testing blog post for testing purposes
8 changes: 8 additions & 0 deletions docs/_posts/2022-01-02-unfortunate-news.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Unfortunate News
tags:
- baz
- test
---

testing blog post for testing purposes (part 2)
53 changes: 53 additions & 0 deletions docs/blog/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: Blog
---

<h1>Blog index</h1>

<div id="search">
<p>Filter posts by tag:
{% for tag in site.tags %}
<label><input type="checkbox" data-tag="{{ tag[0] }}"> {{ tag[0] }}</label>
{% endfor %}
</p>
</div>

<ul id="blogposts">
{% for post in site.posts %}
<li data-tags="{% for tag in post.tags %}{{ tag }} {% endfor %}">
<a href="{{ post.url }}">{{ post.title }}</a>
<ul class="tags">
{% for tag in post.tags %}
<li>{{ tag }}</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>

<p id="noresults">No results.</p>

<script>
function updateSearch() {
let tags = [...document.querySelectorAll("#search input[type=checkbox]")]
.filter(e => e.checked)
.map(e => e.dataset.tag);

let any_shown = false;
for (let item of document.querySelectorAll("#blogposts > li")) {
console.log(item.dataset);
let item_tags = item.dataset.tags.split(/\s+/g);
let include = true;
if (tags.length > 0 && !tags.every(t => item_tags.includes(t))) {
include = false;
}
item.style.display = include ? "" : "none";
any_shown ||= include;
}
document.querySelector("#noresults").style.display = any_shown ? "none" : "";
}

document.querySelectorAll("#search input[type=checkbox]").forEach(input => input.addEventListener('change', updateSearch));

updateSearch();
</script>
3 changes: 0 additions & 3 deletions docs/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ p {
a {
color: inherit;
}
a[href="/listen"]::after {
content: ' \1F50A'; /* speaker U+1F50A */
}

/* header and footer */
#nav, #footer {
Expand Down

0 comments on commit ca6cafd

Please sign in to comment.