Skip to content

Commit

Permalink
added stuffs
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewPla committed Feb 4, 2024
1 parent fd82d42 commit 078e495
Show file tree
Hide file tree
Showing 50 changed files with 3,042 additions and 0 deletions.
1 change: 1 addition & 0 deletions _includes/button.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a class="button" href="{{ include.link | default: '#' }}"{% if include.color %} style="background: {{ include.color }}"{% endif %}>{{ include.text | default: "Button" }}{% if include.icon %}&nbsp; {% include icon.html id=include.icon title=include.icon %}{% endif %}</a>
4 changes: 4 additions & 0 deletions _includes/figure.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<figure class="figure figure--{{ include.position | default: 'center' }}">
<img class="image" src="{{ include.image }}" alt="{{ include.alt | default: include.caption }}" {{ include.width ? include.width | prepend: 'width="' | append: '"' }} {{ include.height ? include.height | prepend: 'height="' | append: '"' }}>
{% if include.caption %}<figcaption class="caption">{{ include.caption }}</figcaption>{% endif %}
</figure>
1 change: 1 addition & 0 deletions _includes/icon.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<svg width="{{ include.width | default: "16" }}" height="{{ include.height | default: "16" }}" class="icon icon--{{ include.id | default: "link" }}" role="img" alt="{{ include.title | default: include.id }}"><title>{{ include.title | default: include.id }}</title><use xlink:href="#{{ include.id | default: "link" }}" fill="{{ include.color | default: 'CurrentColor' }}"></use></svg>
1 change: 1 addition & 0 deletions _includes/map.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div class="map"><iframe src="https://www.google.com/maps/d/u/0/embed?mid={{ include.id }}" title="{{ include.title | default: 'Map' }}"></iframe></div>
9 changes: 9 additions & 0 deletions _includes/nav-categories.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<nav class="nav nav--categories">
<ul class="list list--categories">
{% for item in site.categories %}
<li class="item item--category">
<a href="#{{ item | first | slugify }}">{{ item | first }}</a>
</li>
{% endfor %}
</ul>
</nav>
23 changes: 23 additions & 0 deletions _includes/nav-default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<nav class="nav">
<ul class="list list--nav">
{% for item in site.html_pages %}
{% unless item.title == false or item.url contains "/page" or item.url contains "/404.html" %}
<li class="item item--nav{% if item.url == page.url %} item--current{% endif %}">

{% if item.url contains '://' %}
{% assign url = item.url %}
{% else %}
{% assign url = item.url | relative_url %}
{% endif %}

{% if item.collectionpage %}
{% assign collectiondata = site.collections | where: "label", item.collectionpage | first %}
<a href="{{ url }}">{{ collectiondata.title }}</a>
{% else %}
<a href="{{ url }}">{{ item.title }}</a>
{% endif %}
</li>
{% endunless %}
{% endfor %}
</ul>
</nav>
20 changes: 20 additions & 0 deletions _includes/nav-footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{% if site.navigation_footer %}
<nav class="nav nav--footer">
<ul class="list list--nav">
{% for item in site.navigation_footer %}

{% if item.url contains '://' %}
{% assign url = item.url %}
{% else %}
{% assign url = item.url | relative_url %}
{% endif %}

<li class="item item--nav{% if item.url == page.url %} item--current{% endif %}">
<a href="{{ url }}">{{ item.title }}</a>
</li>
{% endfor %}
</ul>
</nav>
{% else %}
{% include nav-default.html %}
{% endif %}
54 changes: 54 additions & 0 deletions _includes/nav-header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{% if site.navigation_header %}
<nav class="nav nav--header">
<ul class="list list--nav">
{% for item in site.navigation_header %}

{% if item.url contains '://' %}
{% assign url = item.url %}
{% else %}
{% assign url = item.url | relative_url %}
{% endif %}

<li class="item item--nav{% if item.url == page.url %} item--current{% endif %}">
<a href="{{ url }}">{{ item.title }}</a>
</li>
{% endfor %}
</ul>
<button class="button button--nav" aria-label="Menu toggle">
{% include icon.html id="nav" title="Menu" %}
</button>
</nav>
{% else %}
{% include nav-default.html %}
{% endif %}

<script type="text/javascript">
// Get list and button
const navList = document.querySelector('.header .list--nav')
const button = document.querySelector('.header .button--nav')

// Hide nav and apply toggle
const collapseNav = () => {
if (document.body.clientWidth < 640) {
navList.style.setProperty('--listHeight', `-${navList.offsetHeight}px`)
} else {
navList.removeAttribute('style')
}

button.onclick = () => {
navList.style.setProperty('transition', `margin .1s`)
if (navList.style.getPropertyValue('--listHeight')) {
navList.style.removeProperty('--listHeight')
} else {
navList.style.setProperty('--listHeight', `-${navList.offsetHeight}px`)
}
}
}

collapseNav()

// Check on resize if to collapse nav
window.addEventListener('resize', () => {
collapseNav()
})
</script>
24 changes: 24 additions & 0 deletions _includes/nav-share.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<div class="share">
{% for network in site.sharing_links %}
{% if network[1] != blank %}
{% assign name = network[0] %}
{% assign id = network[0] | downcase | remove: " " %}
{% assign url = site.url | append: site.baseurl | append: page.url %}
{% assign color = network[1] %}

{% capture share_link %}
{%- if id contains "twitter" %}https://twitter.com/intent/tweet/?url={{ url }}&text={{ page.title | uri_escape }}{% if site.twitter.username %}&via={{ site.twitter.username }}{% endif %}{% endif -%}
{%- if id contains "facebook" %}https://facebook.com/sharer/sharer.php?u={{ url }}{% endif -%}
{%- if id contains "pinterest" %}https://pinterest.com/pin/create/button/?url={{ url }}&description={{ page.title }}&media={{ page.image }}{% endif -%}
{%- if id contains "linkedin" %}https://www.linkedin.com/shareArticle?url={{ url }}&title={{ page.title }}&source={{ site.title }}&mini=true{% endif -%}
{%- if id contains "tumblr" %}https://tumblr.com/widgets/share/tool?canonicalUrl={{ url }}&tags={{ page.category }}&caption={{ page.title }}{% endif -%}
{%- if id contains "reddit" %}https://reddit.com/submit?url={{ url }}&title={{ page.title }}&resubmit=true{% endif -%}
{%- if id contains "hackernews" %}https://news.ycombinator.com/submitlink?u={{ url }}&t={{ page.title }}{% endif -%}
{%- if id contains "designernews" %}https://www.designernews.co/submit?url={{ url }}&title={{ page.title }}{% endif -%}
{%- if id contains "email" %}mailto:?subject={{ page.title }}&body={{ url | prepend: "Hey, check out this: "}}{% endif -%}
{% endcapture %}

{% include button.html text=name icon=id link=share_link color=color %}
{% endif %}
{% endfor %}
</div>
10 changes: 10 additions & 0 deletions _includes/nav-social.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<nav class="nav nav--social">
{% for link in site.social_links %}
{% if link[1] != blank %}
{% assign id = link[0] | downcase %}
<a href="{{ link[1] }}">
{% include icon.html id=id title=id %}
</a>
{% endif %}
{% endfor %}
</nav>
25 changes: 25 additions & 0 deletions _includes/post-categories.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{% for category in site.categories %}
{% assign category_name = category | first %}
<section class="section typeset">
<h2 id="{{ category_name | slugify }}">{{ category_name }}</h2>
<ul class="list list--posts">
{% for page in site.categories[category_name] %}
{% assign has_categories = true %}
<li class="item item--post">
<article class="article article--post typeset">
<h3><a href="{{ site.baseurl }}{{ page.url }}">{{ page.title }}</a></h3>
{% include post-meta.html %}
{{ page.excerpt | truncatewords: 60 | markdownify }}
</article>
</li>
{% endfor %}
</ul>
{% unless forloop.last %}<hr/>{% endunless %}
</section>
{% endfor %}

{% if has_categories != true %}
<section class="section typeset">
<p>There are no categorised posts</p>
</section>
{% endif %}
17 changes: 17 additions & 0 deletions _includes/post-comments.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% if site.disqus and page.comments != false %}
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = "{{ site.url }}{{ site.baseurl }}{{ page.url }}";
this.page.identifier = "{{ site.baseurl }}{{ page.url }}";
};

(function() {
var d = document, s = d.createElement('script');
s.src = '//{{ site.disqus }}.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
{% endif %}
34 changes: 34 additions & 0 deletions _includes/post-list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{% if paginator.posts %}
<section class="section typeset">
<ul class="list list--posts">
{% for page in paginator.posts %}
<li class="item item--post">
<article class="article article--post">

<h2><a href="{{ site.baseurl }}{{ page.url }}">{{ page.title }}</a></h2>
{% include post-meta.html %}
{{ page.excerpt | markdownify | truncatewords: 60 }}

</article>
</li>
{% endfor %}
</ul>
{% include post-pagination.html %}
</section>
{% else %}
<section class="section typeset">
<ul class="list list--posts">
{% for page in site.posts %}
<li class="item item--post">
<article class="article article--post">

<h2><a href="{{ site.baseurl }}{{ page.url }}">{{ page.title }}</a></h2>
{% include post-meta.html %}
{{ page.excerpt | markdownify | truncatewords: 60 }}

</article>
</li>
{% endfor %}
</ul>
</section>
{% endif %}
16 changes: 16 additions & 0 deletions _includes/post-meta.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% if page.categories %}
{% capture categories %}
{% for category in page.categories %}
<span class="label label--category"><a href="{{ site.baseurl }}/categories/#{{ category | downcase | slugify }}">{{ category }}</a></span>{% if forloop.last == false %},{% endif %}
{% endfor %}
{% endcapture %}
{% elsif page.category %}
{% capture categories %}
<span class="label label--category"><a href="{{ site.baseurl }}/categories/#{{ page.category | downcase | slugify }}">{{ page.category }}</a></span>
{% endcapture %}
{% endif %}

<small class="small post-meta">
{% assign date_format = site.date_format | default: "%d %b %Y" %}
{{ categories | append: "&nbsp;&middot;&nbsp;" }}<time datetime="{{ page.date | date_to_xmlschema }}" class="time">{{ page.date | date: date_format }}</time>
</small>
17 changes: 17 additions & 0 deletions _includes/post-pagination.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<nav class="nav nav--paginator">

{% if paginator.previous_page %}
<a href="{{ site.baseurl }}{{ paginator.previous_page_path }}" class="pagination pagination--previous">&larr; Newer</a>
{% else %}
<span class="pagination pagination--previous">&larr; Newer</span>
{% endif %}

<span class="pagination pagination--counter">Page: {{ paginator.page }} of {{ paginator.total_pages }}</span>

{% if paginator.next_page %}
<a href="{{ site.baseurl }}{{ paginator.next_page_path }}" class="pagination pagination--next">Older &rarr;</a>
{% else %}
<span class="pagination pagination--next">Older &rarr;</span>
{% endif %}

</nav>
19 changes: 19 additions & 0 deletions _includes/post-related.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<h3>Related posts</h3>
<ul class="list list--posts">
{% for page in site.related_posts limit: 3 %}
{% assign has_related = true %}
<li class="item item--post">
<article class="article article--post typeset">

<h4><a href="{{ site.baseurl }}{{ page.url }}">{{ page.title }}</a></h4>
{% include post-meta.html %}
{{ page.excerpt | markdownify | truncatewords: 20 }}

</article>
</li>
{% endfor %}

{% if has_related != true %}
<p>There are no related posts</p>
{% endif %}
</ul>
12 changes: 12 additions & 0 deletions _includes/site-analytics.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', '{{ site.google_analytics }}');
gtag('config', '{{ site.google_analytics }}', {
'anonymize_ip': {{ site.google_analytics_anonymize_ip | default: "true" }}
});
</script>
23 changes: 23 additions & 0 deletions _includes/site-aside.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<aside class="aside typeset aside--{{ include.align | default: 'right' }}">

{% if page.layout == "post" %}
<section class="section section--related-posts">
{% include post-related.html %}
</section>

{% elsif page.layout == "page" or page.layout == "home" or page.layout == "blog" %}
<section class="section section--description">
<h3>About this site</h3>
<p>{{ site.description }}</p>
{% include nav-social.html %}
</section>

{% elsif page.layout == "categories" %}
<section class="section section--category-index">
<h3>Index</h3>
{% include nav-categories.html %}
</section>

{% endif %}

</aside>
1 change: 1 addition & 0 deletions _includes/site-before-end.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- Overwrite this file with code you want before the closing body tag -->
1 change: 1 addition & 0 deletions _includes/site-before-start.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- Overwrite this file with code you want before the closing head tag -->
7 changes: 7 additions & 0 deletions _includes/site-favicons.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% if site.favicons %}
{% for icon in site.favicons %}
<link rel="icon" type="image/png" href="{{ icon[1] | relative_url }}" sizes="{{ icon[0] }}x{{ icon[0] }}">
<link rel="apple-touch-icon" sizes="{{ icon[0] }}x{{ icon[0] }}" href="{{ icon[1] | relative_url }}">
{% endfor %}
{% endif %}
<link rel="shortcut icon" href="{{ site.avatarurl + '?s=32' | default: site.logo | relative_url }}">
15 changes: 15 additions & 0 deletions _includes/site-feature.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% assign feature_text = page.feature_text %}
{% assign feature_image = page.feature_image %}
{% if page.collectionpage %}
{% assign collectiondata = site.collections | where: "label", page.collectionpage | first %}
{% assign feature_text = collectiondata.feature_text %}
{% assign feature_image = collectiondata.feature_image %}
{% endif %}

{% if feature_text or feature_image %}
<div class="feature"{% if feature_image %} style="background-image: url({{ feature_image }})"{% endif %}>
<div class="container typeset">
{{ feature_text | markdownify }}
</div>
</div>
{% endif %}
11 changes: 11 additions & 0 deletions _includes/site-fonts.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% if site.fonts.font_urls %}
{% for font in site.fonts.font_urls %}
<link rel="preload" as="style" href="{{ font }}" />
<link href="{{ font }}" rel="stylesheet" media="print" onload="this.media='all'" />
{% endfor %}
<noscript>
{% for font in site.fonts.font_urls %}
<link href="{{ font }}" rel="stylesheet" />
{% endfor %}
</noscript>
{% endif %}
9 changes: 9 additions & 0 deletions _includes/site-footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<footer class="footer">
<div class="container">
<div class="copyright typeset">
<small class="small">&copy; {{ site.title }} {{ site.time | date: '%Y' }}</small>
</div>

{% include nav-footer.html %}
</div>
</footer>
Loading

0 comments on commit 078e495

Please sign in to comment.