Skip to content

Commit 4e5767b

Browse files
committed
fix: don't search generated pages plus minor updates
1 parent a38a2f5 commit 4e5767b

File tree

5 files changed

+39
-27
lines changed

5 files changed

+39
-27
lines changed

content/_static/placeholder.webp

-1.27 KB
Binary file not shown.

content/main/chickpea_salad.dj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Based on [https://downshiftology.com/recipes/mediterranean-chickpea-salad](https
1616
- [ ] 4 ounces Feta Cheese, crumbled
1717
- [ ] 1/4 cup Parsely, finely chopped
1818
- [ ] (Optional) Avocado, medium diced
19-
- [ ] Lemon Vinaigrette or Olive Oil, to taste
19+
- [ ] 1 Tbsp Lemon Vinaigrette or Olive Oil and Lemon Juice, to taste
2020

2121
## Recipe
2222

content/styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ img.fullsize {
113113
.wrapped-images-container {
114114
display: grid;
115115
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
116-
gap: 10px;
116+
gap: 15px;
117117
}
118118

119119
.wrapped-images-container figcaption {

goBuild/templates.templ

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
package goBuild
22

3-
templ page(title string, contents templ.Component, showSearchBar bool) {
3+
const (
4+
GENERATED_PAGE = "gen"
5+
CONTENT_PAGE = "content"
6+
SEARCH_PAGE = "search"
7+
)
8+
9+
templ page(title string, contents templ.Component, pageType string) {
410
<!DOCTYPE html>
511
<html lang="en">
612
<head>
@@ -9,7 +15,7 @@ templ page(title string, contents templ.Component, showSearchBar bool) {
915
<link rel="stylesheet" href="/styles.css"/>
1016
<title>{ title }</title>
1117
<meta name="description" content="Kyle and Alex's Personal Recipes"/>
12-
if showSearchBar {
18+
if pageType == SEARCH_PAGE {
1319
<link href="/pagefind/pagefind-ui.css" rel="stylesheet"/>
1420
<script src="/pagefind/pagefind-ui.js"></script>
1521
}
@@ -22,10 +28,10 @@ templ page(title string, contents templ.Component, showSearchBar bool) {
2228
<a href="/search.html"><i><strong>Search</strong></i></a>
2329
</div>
2430
</nav>
25-
<main data-pagefind-body?={ !showSearchBar }>
31+
<main data-pagefind-body?={ pageType == CONTENT_PAGE }>
2632
@contents
2733
</main>
28-
if showSearchBar {
34+
if pageType == SEARCH_PAGE {
2935
<script>
3036
window.addEventListener("DOMContentLoaded", (event) => {
3137
new PagefindUI({
@@ -41,15 +47,15 @@ templ page(title string, contents templ.Component, showSearchBar bool) {
4147
}
4248

4349
templ recipePage(title string, content string) {
44-
@page(title, templ.Raw(content), false)
50+
@page(title, templ.Raw(content), CONTENT_PAGE)
4551
}
4652

4753
templ searchContents() {
4854
<div style="margin-top: 10px" id="search"></div>
4955
}
5056

5157
templ searchPage() {
52-
@page("Search Recipes", searchContents(), true)
58+
@page("Search Recipes", searchContents(), SEARCH_PAGE)
5359
}
5460

5561
templ notFoundContents() {
@@ -59,7 +65,7 @@ templ notFoundContents() {
5965
}
6066

6167
templ notFoundPage() {
62-
@page("Page Not Found", notFoundContents(), false)
68+
@page("Page Not Found", notFoundContents(), GENERATED_PAGE)
6369
}
6470

6571
templ dirIndexContent(title string, recipes []Recipe) {
@@ -79,7 +85,7 @@ templ dirIndexContent(title string, recipes []Recipe) {
7985
}
8086

8187
templ dirIndexPage(title string, recipes []Recipe) {
82-
@page(title, dirIndexContent(title, recipes), false)
88+
@page(title, dirIndexContent(title, recipes), GENERATED_PAGE)
8389
}
8490

8591
templ homeContent(subdirectories []Subdir) {
@@ -93,5 +99,5 @@ templ homeContent(subdirectories []Subdir) {
9399
}
94100

95101
templ homePage(subdirectories []Subdir) {
96-
@page("Recipes", homeContent(subdirectories), false)
102+
@page("Recipes", homeContent(subdirectories), GENERATED_PAGE)
97103
}

goBuild/templates_templ.go

Lines changed: 22 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)