Skip to content

Commit 46c3d2a

Browse files
author
aryan
committed
Added Related Questions as partial
1 parent 4e09ca6 commit 46c3d2a

File tree

7 files changed

+63
-11
lines changed

7 files changed

+63
-11
lines changed

content/exercises/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: "Exercises"
33
width : full
4+
math: true
45
cascade:
56
width: normal
67
math: true

layouts/exercises/list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ <h1 class="hx-text-center">Blog with featured tag</h1>
2727

2828
{{/* {{ partial "exercise-cards.html" . }} */}}
2929

30-
{{ partial "question-cards.html" . }}
30+
{{ partial "questions-list.html" . }}
3131

3232
</main>
3333
</article>

layouts/exercises/single.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
{{- .Scratch.Set "reversePagination" true -}}
5353
{{- partial "components/pager.html" . -}}
5454
{{ end }}
55+
{{- partial "related-question-cards.html" . -}}
5556
{{- partial "components/comments.html" . -}}
5657
</main>
5758
</article>

layouts/partials/question-cards.html

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
<div class="blogs-wrapper">
2-
{{- $pages := partial "utils/sort-pages" (dict "page" . "by"
3-
site.Params.blog.list.sortBy "weight" site.Params.blog.list.sortOrder) -}} {{-
4-
range $pages }}
1+
52
<a href="{{ .RelPermalink }}">
63
<div class="question-card hx-mb-10">
7-
<div class="question-header mona-sans">
4+
<div class="question-header mona-sans fireship-tag tag-cloud-functions">
85
<h3>
96
<a
107
style="color: inherit; text-decoration: none"
@@ -48,8 +45,7 @@ <h3>
4845
</div>
4946
</div>
5047
</a>
51-
{{ end -}}
52-
</div>
48+
5349

5450
<style>
5551
.question-tag {
@@ -68,8 +64,8 @@ <h3>
6864
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
6965
}
7066
.question-header {
67+
display: block;
7168
overflow: hidden;
72-
background-color: #b3e5fc;
7369
border-radius: 8px 8px 8px 8px;
7470
padding: 20px;
7571
}
@@ -112,7 +108,6 @@ <h3>
112108

113109
html:is([class~="dark"], [class*="theme-dark"]) {
114110
.question-card {
115-
background: #181a1b;
116111
border-color: #4d4d4d;
117112
}
118113
.question-card h3 {
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<div class="blogs-wrapper">
2+
{{- $pages := partial "utils/sort-pages" (dict "page" . "by"
3+
site.Params.blog.list.sortBy "weight" site.Params.blog.list.sortOrder) -}} {{-
4+
range $pages }} {{ partial "question-cards.html" . }} {{ end -}}
5+
</div>
6+
7+
<style>
8+
.blogs-wrapper {
9+
display: flex;
10+
flex-wrap: wrap;
11+
gap: 12px;
12+
padding: 0 18px;
13+
}
14+
</style>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{{- $relatedQuestions := (T "relatedQuestions") | default "More Questions"}}
2+
{{- $borderClass := "hx-mt-8 hx-border-t" -}}
3+
4+
{{ if .Params.showRelatedContent | default (.Site.Params.blog.article.showRelatedContent | default false)}}
5+
{{ $related := .Site.RegularPages.Related . | first .Site.Params.blog.article.relatedContentLimit }}
6+
{{ with $related }}
7+
<div class="related-articles">
8+
<hr class="{{$borderClass}} dark:hx-border-neutral-800 contrast-more:hx-border-t contrast-more:hx-border-neutral-400 contrast-more:hx-shadow-none contrast-more:dark:hx-border-neutral-400">
9+
{{/* <h2 class="mt-8 text-2xl font-extrabold mb-10">{{ i18n "article.related_articles" | emojify }}</h2> */}}
10+
<h2 class="hx-mt-8 hx-title ">{{ $relatedQuestions}}</h2>
11+
<hr class="{{$borderClass}} dark:hx-border-neutral-800 contrast-more:hx-border-t contrast-more:hx-border-neutral-400 contrast-more:hx-shadow-none contrast-more:dark:hx-border-neutral-400">
12+
<div class="related-questions-wrapper">
13+
{{ range . }}
14+
{{ partial "question-cards.html" . }}
15+
{{ end }}
16+
</div>
17+
</div>
18+
19+
<hr class="{{$borderClass}} hx-mb-8 dark:hx-border-neutral-800 contrast-more:hx-border-t contrast-more:hx-border-neutral-400 contrast-more:hx-shadow-none contrast-more:dark:hx-border-neutral-400">
20+
21+
{{ end }}
22+
{{ end }}
23+
24+
<style>
25+
.hx-title {
26+
font-size: 1.2rem;
27+
font-weight: bold;
28+
}
29+
.related-questions-wrapper {
30+
margin-top: 40px;
31+
margin-bottom: 80px;
32+
display: grid;
33+
justify-items: center;
34+
35+
/* Optional: Add some padding to the container */
36+
37+
38+
}
39+
40+
41+
</style>

layouts/term/term.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
{{ partial "blog-cards.html" . }}
1717
{{ else }}
1818
{{/* {{ partial "exercise-cards.html" . }} */}}
19-
{{ partial "question-cards.html" . }}
19+
{{ partial "questions-list.html" . }}
2020
{{ end }}
2121
</main>
2222
</article>

0 commit comments

Comments
 (0)