Skip to content

Commit

Permalink
Added categories to post.html.
Browse files Browse the repository at this point in the history
  • Loading branch information
Because789 committed Nov 13, 2023
1 parent 1d546c9 commit e2d4ede
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 25 deletions.
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ minima:
date_format: "%d. %b %Y"
header_pages:
- about.md
- categories.md
- categories.html
# Generate social links in footer:
social_links:
- { platform: github, user_url: "https://github.com/Because789" }
Expand Down
51 changes: 51 additions & 0 deletions _layouts/post.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
layout: base
---
<article class="post h-entry" itemscope itemtype="http://schema.org/BlogPosting">

<header class="post-header">
<h1 class="post-title p-name" itemprop="name headline">{{ page.title | escape }}</h1>
<p class="post-meta">
{%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%}
<time class="dt-published" datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">
{{ page.date | date: date_format }}
</time>
{%- if page.modified_date -%}
~
{%- assign mdate = page.modified_date | date_to_xmlschema -%}
<time class="dt-modified" datetime="{{ mdate }}" itemprop="dateModified">
{{ mdate | date: date_format }}
</time>
{%- endif -%}
{%- if page.author -%}
• {% for author in page.author %}
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
<span class="p-author h-card" itemprop="name">{{ author }}</span></span>
{%- if forloop.last == false %}, {% endif -%}
{% endfor %}
{%- endif -%}
</p>
</header>

<div class="post-content e-content" itemprop="articleBody">
{{ content }}

<div class="post-categories">
{% if post %}
{% assign categories = post.categories %}
{% else %}
{% assign categories = page.categories %}
{% endif %}
{% for category in categories %}
<a href="{{site.baseurl}}/categories/#{{category|slugize}}">{{category}}</a>
{% unless forloop.last %}&nbsp;{% endunless %}
{% endfor %}
</div>
</div>

{%- if site.disqus.shortname -%}
{%- include disqus_comments.html -%}
{%- endif -%}

<a class="u-url" href="{{ page.url | relative_url }}" hidden></a>
</article>
12 changes: 0 additions & 12 deletions _posts/2023-11-13-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,6 @@ categories: Test
# published: false
---

<div class="post-categories">
{% if post %}
{% assign categories = post.categories %}
{% else %}
{% assign categories = page.categories %}
{% endif %}
{% for category in categories %}
<a href="{{site.baseurl}}/categories/#{{category|slugize}}">{{category}}</a>
{% unless forloop.last %}&nbsp;{% endunless %}
{% endfor %}
</div>

# Welcome

**Hello world**, this is my first Jekyll blog post.
Expand Down
12 changes: 0 additions & 12 deletions _posts/2023-11-13-test1.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,6 @@ categories: [Test, Whatever]
# published: false
---

<div class="post-categories">
{% if post %}
{% assign categories = post.categories %}
{% else %}
{% assign categories = page.categories %}
{% endif %}
{% for category in categories %}
<a href="{{site.baseurl}}/categories/#{{category|slugize}}">{{category}}</a>
{% unless forloop.last %}&nbsp;{% endunless %}
{% endfor %}
</div>

# My second post

**Hello world**, this is my first Jekyll blog post.
Expand Down
File renamed without changes.

0 comments on commit e2d4ede

Please sign in to comment.