Skip to content

Commit

Permalink
fix: minor fixes, feat: new toc
Browse files Browse the repository at this point in the history
  • Loading branch information
papierkorp committed Sep 26, 2023
1 parent 2b89351 commit 9fbec3d
Show file tree
Hide file tree
Showing 9 changed files with 206 additions and 112 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ footer_links:
### Layouts

In here you can define the amount of columns used to display all tags/categories/years via the `_config`.
Available values are `1-5`.
Available values are `0-5`.

```yaml
layouts:
Expand Down Expand Up @@ -411,32 +411,32 @@ footer_sidebar:
- recentposts # will be displayed last
description:
enabled: true # default: true
coluns: 2 # default: 2 - if you include a list
columns: 2 # default: 0 - if you include a list
categories:
enabled: true # default: false
count: 100 # default: 100
columns: 5 # default: 5
columns: 5 # default: 0
tags:
enabled: true # default: false
count: 100 # default: 100
columns: 5 # default: 5
columns: 5 # default: 0
recentposts:
enabled: true # default: true
count: 10 # default: 10
columsn: 2 # default: 2
count: 10 # default: 5
columns: 2 # default: 0
custom_content:
enabled: true
data: >-
<h3>EXTRACONTENT</h3>
<p>not really content though...</p>
columns: 2 # default: 2 - if you include a list
columns: 2 # default: 0 - if you include a list
custom_content2:
enabled: false
data: "<h3>mhm</h3>"
columns: 2 # default: 2 - if you include a list
columns: 2 # default: 0 - if you include a list
```


The default of `0` stands for automatic alignment.


### Table of Contents
Expand Down Expand Up @@ -536,6 +536,7 @@ This theme offers the following Front-Matter:
|--------|------------------|-----------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------|
| `post` | subtitle | Adds a subtitle to the post (optional) | ---<br>subtitle: "You're going to love this." <br>--- |
| `post` | display_toc | true or false, shows the toc button on the bottom right (default: true) | ---<br>display_toc: false <br>--- |
| `post` | display_toc2 | true or false, shows another toc on the right side permanently (default: false) | ---<br>display_toc2: true <br>--- |
| `post` | last_modified_at | Add extra meta-data when the post was last modified. It takes the date as you write it like a string. | ---<br>last_modified_at: 10.09.2023 <br>--- |
| `post` | search_keywords | Add extra data to the [search.json](#layout-:-search) file | ---<br>search_keywords: "words i didnt use in the tags" <br>--- |
| `post` | toTop | true or false, shows the "To the Top" button on the bottom left (default: true) | ---<br>toTop: false <br>--- |
Expand Down
7 changes: 0 additions & 7 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,10 @@ footer_sidebar:
enabled: true
categories:
enabled: true
count: 100
columns: 2
tags:
enabled: true
count: 100
columns: 4
recentposts:
enabled: true
columns: 1
count: 5

footer_links:
- title: Feed
Expand Down Expand Up @@ -116,7 +110,6 @@ defaults:
scope:
path: "_posts"
values:
toc: yes
display_toc: true

paginate: 3
Expand Down
20 changes: 10 additions & 10 deletions _includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
<aside class="footer_sidebar">
{% for section in site.footer_sidebar.arrangement %}
{% if section == 'description' and site.footer_sidebar.description.enabled %}
<section class="footer_sitedescription footer_sitedescription{% if site.footer_sidebar.description.columns and site.footer_sidebar.description.columns >= 1 and site.footer_sidebar.description.columns <= 5 %}{{site.footer_sidebar.description.columns}}{% else %}2{% endif %}">
<section class="footer_sitedescription footer_sitedescription{% if site.footer_sidebar.description.columns and site.footer_sidebar.description.columns >= 0 and site.footer_sidebar.description.columns <= 5 %}{{site.footer_sidebar.description.columns}}{% else %}0{% endif %}">
{{ site.description }}
</section>
{% elsif section == 'customcontent' and site.footer_sidebar.customcontent.enabled %}
<section class="footer_customcontent footer_customcontent{% if site.footer_sidebar.customcontent.columns and site.footer_sidebar.customcontent.columns >= 1 and site.footer_sidebar.customcontent.columns <= 5 %}{{site.footer_sidebar.customcontent.columns}}{% else %}2{% endif %}">
<section class="footer_customcontent footer_customcontent{% if site.footer_sidebar.customcontent.columns and site.footer_sidebar.customcontent.columns >= 0 and site.footer_sidebar.customcontent.columns <= 5 %}{{site.footer_sidebar.customcontent.columns}}{% else %}0{% endif %}">
{{ site.footer_sidebar.customcontent.data }}
</section>
{% elsif section == 'customcontent2' and site.footer_sidebar.customcontent2.enabled %}
<section class="footer_customcontent2 footer_customcontent2{% if site.footer_sidebar.customcontent2.columns and site.footer_sidebar.customcontent2.columns >= 1 and site.footer_sidebar.customcontent2.columns <= 5 %}{{site.footer_sidebar.customcontent2.columns}}{% else %}2{% endif %}">
<section class="footer_customcontent2 footer_customcontent2{% if site.footer_sidebar.customcontent2.columns and site.footer_sidebar.customcontent2.columns >= 0 and site.footer_sidebar.customcontent2.columns <= 5 %}{{site.footer_sidebar.customcontent2.columns}}{% else %}0{% endif %}">
{{ site.footer_sidebar.customcontent2.data }}
</section>
{% elsif section == 'categories' and site.footer_sidebar.categories.enabled %}
<section class="footer_categories footer_categories{% if site.footer_sidebar.categories.columns and site.footer_sidebar.categories.columns >= 1 and site.footer_sidebar.categories.columns <= 5 %}{{site.footer_sidebar.categories.columns}}{% else %}5{% endif %}">
<section class="footer_categories footer_categories{% if site.footer_sidebar.categories.columns and site.footer_sidebar.categories.columns >= 0 and site.footer_sidebar.categories.columns <= 5 %}{{site.footer_sidebar.categories.columns}}{% else %}0{% endif %}">
<h3>Categories</h3>
<ul>
{% assign all_categories = "" %}
Expand All @@ -46,7 +46,7 @@ <h3>Categories</h3>
</ul>
</section>
{% elsif section == 'tags' and site.footer_sidebar.tags.enabled %}
<section class="footer_tags footer_tags{% if site.footer_sidebar.tags.columns and site.footer_sidebar.tags.columns >= 1 and site.footer_sidebar.tags.columns <= 5 %}{{site.footer_sidebar.tags.columns}}{% else %}5{% endif %}">
<section class="footer_tags footer_tags{% if site.footer_sidebar.tags.columns and site.footer_sidebar.tags.columns >= 0 and site.footer_sidebar.tags.columns <= 5 %}{{site.footer_sidebar.tags.columns}}{% else %}0{% endif %}">
<h3>Tags</h3>
<ul>
{% assign all_tags = "" %}
Expand All @@ -67,12 +67,12 @@ <h3>Tags</h3>
</ul>
</section>
{% elsif section == 'recentposts' and site.footer_sidebar.recentposts.enabled %}
<section class="footer_recentposts footer_recentposts{% if site.footer_sidebar.recentposts.columns and site.footer_sidebar.recentposts.columns >= 1 and site.footer_sidebar.recentposts.columns <= 5 %}{{site.footer_sidebar.recentposts.columns}}{% else %}2{% endif %}">
<section class="footer_recentposts footer_recentposts{% if site.footer_sidebar.recentposts.columns and site.footer_sidebar.recentposts.columns >= 0 and site.footer_sidebar.recentposts.columns <= 5 %}{{site.footer_sidebar.recentposts.columns}}{% else %}0{% endif %}">
<h3>Recent Posts</h3>
<ul>
{% assign recentposts_count = site.footer_sidebar.recentposts.count | default: 10 %}
{% assign recent_posts = site.posts | reverse | limit: recentposts_count %}
{% for post in recent_posts %}
{% assign recentposts_count = site.footer_sidebar.recentposts.count | default: 5 %}
{% assign recent_posts = site.posts | reverse %}
{% for post in recent_posts limit:recentposts_count %}
<li><a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
Expand Down Expand Up @@ -101,4 +101,4 @@ <h3>Recent Posts</h3>
</div>
{% endif %}

</footer>
</footer>
111 changes: 58 additions & 53 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<main id="post">
<article>

{% if page.display_toc %}
<div class="toc">
<input type="checkbox" id="tocMenuButton">
Expand All @@ -16,65 +17,69 @@ <h1>TOC</h1>
</div>
</div>
{% endif %}
{% if page.display_toc2 %}
<div class="toc2">
<div id="tocContainer2">
{% include toc.html html=content %}
</div>
</div>
{% endif %}
{% if page.no_header != true %}
<div class="post_header">
<h1>{{page.title}}</h1>
<h3>{{page.subtitle}}</h3>


<div class="grid">

{% if page.show_supplements != false %}
<p class="supplements">
<span>
<i class="fa fa-calendar"></i> {{ page.date | date: "%B %d, %Y" }}
</span>
<span class="supplements-sep"></span>
<span class="reading-time" title="Estimated read time">
{% include read_time.html %}
</span>
{% if page.categories != nil and page.categories.size > 0 %}
<span class="supplements-sep"></span>
<span class="supplements-category">
<i class="fa fa-bars"></i>
{% for category in page.categories %}
<a href="{{ site.baseurl }}/categories#{{ category | slugify }}">{{ category }}</a>{% if forloop.last == false %},{% endif %}
{% endfor %}
</span>
{% endif %}
{% if page.tags != nil and page.tags.size > 0 %}
<span class="supplements-sep"></span>
<span>
<i class="fa fa-tags"></i>
{% for tag in page.tags %}
<a href="{{ site.baseurl }}/tags#{{ tag | slugify }}">{{ tag }}</a>{% if forloop.last == false %},{% endif %}
{% endfor %}
</span>
{% endif %}
{%- if page.last_modified_at -%}
<br /> <br />
<span class="last_modified_at">{% if site.data.configurable_lables.last_modified_at %}{{site.data.configurable_lables.last_modified_at}}{% else %}Last Modified at:{% endif %} {{ page.last_modified_at }}</span>
{% endif %}
</p>

{% if page.no_header != true %}
<div class="post_header">
<h1>{{page.title}}</h1>
<h3>{{page.subtitle}}</h3>


{% if page.show_supplements != false %}
<p class="supplements">
<span>
<i class="fa fa-calendar"></i> {{ page.date | date: "%B %d, %Y" }}
</span>
<span class="supplements-sep"></span>
<span class="reading-time" title="Estimated read time">
{% include read_time.html %}
</span>
{% if page.categories != nil and page.categories.size > 0 %}
<span class="supplements-sep"></span>
<span class="supplements-category">
<i class="fa fa-bars"></i>
{% for category in page.categories %}
<a href="{{ site.baseurl }}/categories#{{ category | slugify }}">{{ category }}</a>{% if forloop.last == false %},{% endif %}
{% endfor %}
</span>
{% endif %}
{% if page.tags != nil and page.tags.size > 0 %}
<span class="supplements-sep"></span>
<span>
<i class="fa fa-tags"></i>
{% for tag in page.tags %}
<a href="{{ site.baseurl }}/tags#{{ tag | slugify }}">{{ tag }}</a>{% if forloop.last == false %},{% endif %}
{% endfor %}
</span>
{% endif %}
{%- if page.last_modified_at -%}
<br /> <br />
<span class="last_modified_at">{% if site.data.configurable_lables.last_modified_at %}{{site.data.configurable_lables.last_modified_at}}{% else %}Last Modified at:{% endif %} {{ page.last_modified_at }}</span>
{% endif %}
</p>
{% endif %}
</div>
{% endif %}

<div class ="post_content">
{{content}}
{% if page.toTop != false %}
<a href="#" id="toTopButton">
<i class="fa fa-arrow-circle-o-up"></i>
</a>
{% endif %}
</div>

</div>
{% endif %}
<div class ="post_content">
{{content}}
{% if page.toTop != false %}
<a href="#" id="toTopButton">
<i class="fa fa-arrow-circle-o-up"></i>
</a>
{% if page.display_toc2 %}
<div id="toc2">
{% include toc.html html=content %}
</div>
{% endif %}


</div>


</article>
</main>
2 changes: 2 additions & 0 deletions _posts/2023-07-13-title-for-champions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ subtitle: "You're going to love this."
categories: rest
last_modified_at: 10.09.202
display_toc2: true
display_toc: false
toTop: false
---
# Code Block tests

Expand Down
21 changes: 21 additions & 0 deletions _sass/default/_footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ footer aside section:first-child {
padding: 0;
}

.footer_sitedescription0,
.footer_customcontent0,
.footer_customcontent20,
.footer_recentposts0,
.footer_categories0,
.footer_tags0 {
@include footer_elements_auto();
}

.footer_sitedescription1,
.footer_customcontent1,
.footer_customcontent21,
Expand Down Expand Up @@ -147,16 +156,28 @@ footer aside section:first-child {
}

.footer_recentposts,
.footer_recentposts0,
.footer_recentposts1,
.footer_recentposts2,
.footer_recentposts3,
.footer_recentposts4,
.footer_recentposts5 {
ul li a {
text-transform: none;
border: none;
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
}

.footer_recentposts0, .footer_recentposts1 {
ul li {
flex-basis: 100%;
}
ul li a {
border: none;
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
}

@media (width >= $small) and (max-width: $large) {
footer {
Expand Down
40 changes: 40 additions & 0 deletions _sass/functions/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,46 @@
}
}

.archive_linktitle {
flex: 1;
}
}
}
}

@mixin footer_elements_auto() {
ul {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-wrap: wrap;
row-gap: 0;
column-gap: 0;
width: fit-content;

li {
display: flex;
justify-content: space-between;
align-items: left;
cursor: pointer;
overflow-wrap: break-word;
a {
text-decoration: none;
color: $background-color;
text-transform: lowercase;
letter-spacing: -1px;
width: 100%;
display: flex;
justify-content: space-between;
padding: 0.5em;
text-align: left;

&:hover {
@include hover();
}
}

.archive_linktitle {
flex: 1;
}
Expand Down
10 changes: 6 additions & 4 deletions _sass/functions/_values.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ $secondary-color: #1c768f;
$background-color: #fbf3f2;
$accent-color: #fa991c;

// $primary-color: #fbf3f2;
// $secondary-color: #1c768f;
// $background-color: #032539;
// $accent-color: #fa991c;
@media (prefers-color-scheme: dark) {
$primary-color: #fbf3f2;
$secondary-color: #1c768f;
$background-color: #032539;
$accent-color: #fa991c;
}
Loading

0 comments on commit 9fbec3d

Please sign in to comment.