Skip to content

Commit

Permalink
Categorize posts on home page based on tags
Browse files Browse the repository at this point in the history
  • Loading branch information
peymanslh committed Jan 2, 2024
1 parent 68fa000 commit a98cfce
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 26 deletions.
2 changes: 1 addition & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ paginate = 30
[taxonomies]
tag = "tags"

copyright = "2023"
copyright = "2024"
languageCode = "en-us"

[Author]
Expand Down
2 changes: 1 addition & 1 deletion content/posts/delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Delete"
date: 2024-01-01T20:40:45+03:30
tags:
- manage
- modify
- postgresql
---
With `DELETE` we can delete one or multiple rows from a table.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@ p {
font-weight: 400;
font-size: 1.1rem; }

.post-tags {
margin-left: 0;
padding-left: 0; }
.post-tags li {
list-style: none;
display: inline-block; }
.post-tags li a {
color: #d2d1d1;
background-color: #282e40;
padding: 0 7px;
font-size: 12px; }

.content h1, .content h2, .content h3 {
margin-top: 50px;
margin-bottom: 20px; }
Expand Down Expand Up @@ -173,10 +185,11 @@ p {
font-size: 1rem; }

.dot {
color: var(--highlight-color);
font-size: 3rem;
padding-left: 5px;
font-family: var(--font-family-paragraph); }
background-color: var(--highlight-color);
width: 7px;
height: 7px;
display: inline-block;
margin-left: 6px; }

.row {
display: flex;
Expand Down Expand Up @@ -236,6 +249,14 @@ table {
margin: 20px 0 16px 0;
font-size: 0.9rem; }

.home-posts {
margin-bottom: 50px; }
.home-posts li {
list-style: none; }
.home-posts li a {
color: #FFFFFF;
font-size: 18px; }

ul.pagination {
margin: 0;
padding: 0;
Expand Down
23 changes: 19 additions & 4 deletions themes/blueberry/assets/scss/_content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ p {
font-size: 1.1rem;
}

.post-tags {
margin-left: 0;
padding-left: 0;
li {
list-style: none;
display: inline-block;
a {
color: #d2d1d1;
background-color: #282e40;
padding: 0 7px;
font-size: 12px;
}
}
}

.content {
h1, h2, h3 {
Expand Down Expand Up @@ -108,10 +122,11 @@ p {
}

.dot {
color: var(--highlight-color);
font-size: 3rem;
padding-left: 5px;
font-family: var(--font-family-paragraph);
background-color: var(--highlight-color);
width: 7px;
height: 7px;
display: inline-block;
margin-left: 6px;
}

.row {
Expand Down
12 changes: 12 additions & 0 deletions themes/blueberry/assets/scss/_summary.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,15 @@
font-size: 0.9rem;
}
}

.home-posts {
margin-bottom: 50px;

li {
list-style: none;
a {
color: #FFFFFF;
font-size: 18px;
}
}
}
2 changes: 1 addition & 1 deletion themes/blueberry/layouts/_default/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{ partial "author.html" . }}
{{ end }}
<div class="intro">
<h1>{{ .Title }}{{ if .Site.Params.addDot }}<span class="dot">.</span>{{ end }}</h1>
<h1>{{ .Title }}{{ if .Site.Params.addDot }}<span class="dot"></span>{{ end }}</h1>
<div class="content">
<div class="vertical-content">
{{ if .Params.image }}
Expand Down
2 changes: 1 addition & 1 deletion themes/blueberry/layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{{ define "main" }}
<div class="intro">
<h1>{{ .Title }}{{ if .Site.Params.addDot }}<span class="dot">.</span>{{ end }}</h1>
<h1>{{ .Title }}{{ if .Site.Params.addDot }}<span class="dot"></span>{{ end }}</h1>
{{ if .Params.description }}<p>{{ .Params.description }}</p>{{ end }}
</div>
{{ .Content }}
Expand Down
2 changes: 1 addition & 1 deletion themes/blueberry/layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{{ define "main" }}
<div class="intro">
<h1>{{ .Title }}{{ if .Site.Params.addDot }}<span class="dot">.</span>{{ end }}</h1>
<h1>{{ .Title }}{{ if .Site.Params.addDot }}<span class="dot"></span>{{ end }}</h1>
{{ if .Params.image }}
<img src="{{ .Params.image | relURL }}" />
{{ end }}
Expand Down
43 changes: 33 additions & 10 deletions themes/blueberry/layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,47 @@
{{ end }}

<div class="intro">
<h1>{{ .Title }}{{ if .Site.Params.addDot }}<span class="dot">.</span>{{ end }}</h1>
<h1>{{ .Title }}{{ if .Site.Params.addDot }}<span class="dot"></span>{{ end }}</h1>
<div class="intro-content">{{ .Content }}</div>
</div>

<h3>Featured Posts</h3>
<ul>
{{ range .Site.Taxonomies.tags.postgresql }}
<li><a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a></li>
<h2>Introduction <span class="dot"></span></h2>
<ul class="home-posts">
{{ range sort .Site.Taxonomies.tags.intro.Pages.ByDate }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>

{{ if .Site.Params.showPostsOnHomepage }}
{{ $paginator := .Paginate (where .Site.RegularPages "Type" "posts") }}
{{ range $paginator.Pages.ByDate }}
{{ .Render "summary" }}
<h2>Database and Table Management<span class="dot"></span></h2>
<ul class="home-posts">
{{ range .Site.Taxonomies.tags.manage.Pages.ByDate }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>

<h2>Modifying Data<span class="dot"></span></h2>
<ul class="home-posts">
{{ range .Site.Taxonomies.tags.modify.Pages.ByDate }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>

<h2>Query and Filtering Data<span class="dot"></span></h2>
<ul class="home-posts">
{{ range .Site.Taxonomies.tags.query.Pages.ByDate }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>

<h2>Latest Posts<span class="dot"></span></h2>
<ul class="home-posts">
{{ $paginator := .Paginate (where .Site.RegularPages "Type" "posts") }}
{{ range $paginator.Pages }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
{{ template "_internal/pagination.html" . }}
{{ end }}
</ul>


{{ end }}

Expand Down
2 changes: 1 addition & 1 deletion themes/blueberry/layouts/partials/footer.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="footer">
{{ if .Site.Data.social.links }}
<div class="footer-copy">© 2023 SQL by example.</div>
<div class="footer-copy">© 2024 SQL by example.</div>
<div class="footer-social">
{{ range .Site.Data.social.links }}
<span class="social-icon social-icon-{{ .name | urlize }}">
Expand Down
2 changes: 1 addition & 1 deletion themes/blueberry/layouts/partials/tags.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ $taxonomy := "tags" }} {{ with .Param $taxonomy }}
<ul>
<ul class="post-tags">
{{ range $index, $tag := . }} {{ with $.Site.GetPage (printf "/%s/%s"
$taxonomy $tag) -}}
<li>
Expand Down
2 changes: 1 addition & 1 deletion themes/blueberry/layouts/posts/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{ partial "author.html" . }}
{{ end }}
<div class="intro">
<h1>{{ .Title }}{{ if .Site.Params.addDot }}<span class="dot">.</span>{{ end }}</h1>
<h1>{{ .Title }}{{ if .Site.Params.addDot }}<span class="dot"></span>{{ end }}</h1>
{{ partial "tags.html" .}}
{{ if .Params.image }}
<img src="{{ .Params.image | relURL }}" />
Expand Down

0 comments on commit a98cfce

Please sign in to comment.