Skip to content

Commit

Permalink
add campfood section
Browse files Browse the repository at this point in the history
  • Loading branch information
Reed Nelson committed Jul 8, 2024
1 parent 46d9f34 commit 7bb20b5
Show file tree
Hide file tree
Showing 9 changed files with 215 additions and 0 deletions.
Binary file added src/assets/campfood/pad-thai.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"puzzle_pagination": 6,
"summary_length": 200,
"blog_folder": "blog",
"campfood_folder": "campfood",
"drink_folder": "drinks",
"food_folder": "food",
"puzzle_folder": "puzzles"
Expand Down
4 changes: 4 additions & 0 deletions src/content/campfood/-index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: Camping Food
description: A modest recipe book for camping.
---
22 changes: 22 additions & 0 deletions src/content/campfood/_food.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: ""
description: ""
cover: "@assets/food/.jpg"
author: Reed Nelson
prep_time: 0
servings: 0
diet: ""
draft: true

ingredients:
list:
- Ingredient
qty:
- qty

instructions:
- Step

notes:
- Note
---
53 changes: 53 additions & 0 deletions src/content/campfood/pad-thai.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: Pad Thai
description: This is a test recipe. Pay no mind.
cover: "@assets/campfood/pad-thai.jpg"
author: Reed Nelson
prep_time: 45
servings: 4
diet: Vegan, GF

ingredients:
list:
- Wide rice noodles
- Fresh cilantro
- Green onion
- Garlic (minced)
- Ginger (grated)
- Brown sugar
- Soy sauce (low sodium)
- Peanut butter
- Lime juice
- Sriracha
- Roasted peanuts
qty:
- 14 oz
- 1 bunch
- 6 stalks
- 4 cloves
- 1⁄4 cup
- 1⁄3 cup
- 1⁄2 cup
- 1⁄4 cup
- 1⁄4 cup
- 1 tbsp
- 1⁄4 cup

instructions:
- "Stir fry prep: chop and combine garlic, ginger, cilantro, green onion, and any other desired ingredients*."
- "Noodle prep: cook noodles al dente; rinse and drain well."
- "Sauce prep: combine brown sugar, peanut butter, soy sauce, lime juice, and sriracha in a bowl."
- "Garnish prep: optionally chop peanuts/limes/cilantro and set aside for serving."
- Saute stir fry ingredients in a large pan; account for differences in cook time among ingredients.
- Add noodles to the pan, combine thoroughly.
- Add sauce, combine thoroughly.
- Remove from heat when sauce is cooked in to your liking.
- Serve.

notes:
- "*Other desired ingredients may include spinach, broccoli, bell pepper, baby corn, etc."
- Steps 1-4 can be parallelized, and that's where most of the work is.
- Cilantro is really great.
- I recommend dividing the veggies that will saute quickly from those that will slowly.
- Keep the soy sauce and lime juice handy, you may want more flavor toward the end.
---
1 change: 1 addition & 0 deletions src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,6 @@ export const collections = {
blog: blogCollection,
drinks: drinkCollection,
food: foodCollection,
campfood: foodCollection,
puzzles: puzzleCollection,
};
29 changes: 29 additions & 0 deletions src/pages/campfood/[single].astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
import config from "@/config/config.json";
import Base from "@/layouts/Base.astro";
import FoodSingle from "@/layouts/FoodSingle.astro";
import { getSinglePage } from "@/lib/contentParser.astro";
export async function getStaticPaths() {
const posts = await getSinglePage(config.settings.campfood_folder);
const paths = posts.map((post: any) => ({
params: {
single: post.slug,
},
props: { post },
}));
return paths;
}
const { post } = Astro.props;
const { title, description, image } = post.data;
---

<Base
meta_title={title}
description={description}
image={image}
>
<FoodSingle post={post} />
</Base>
42 changes: 42 additions & 0 deletions src/pages/campfood/index.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
import FoodCard from "@/components/FoodCard.astro";
import Pagination from "@/components/Pagination.astro";
import config from "@/config/config.json";
import Base from "@/layouts/Base.astro";
import { getSinglePage } from "@/lib/contentParser.astro";
import PageHeader from "@/components/PageHeader.astro";
import { getEntryBySlug } from "astro:content";
const { campfood_folder } = config.settings;
const postIndex: any = await getEntryBySlug<any, string>(campfood_folder, "-index");
const posts = await getSinglePage(campfood_folder);
const totalPages: number = Math.ceil(posts.length / config.settings.food_pagination);
const currentPosts = posts.slice(0, config.settings.food_pagination);
---

<Base
meta_title={postIndex.data.title}
image={postIndex.data.image}
description={postIndex.data.description}
>
<PageHeader title={postIndex.data.title} />
<section class="section">
<div class="container">
<!-- food posts -->
<div class="row">
{
currentPosts.map((post) => (
<div class="mb-4 md:mb-8 md:col-6 lg:col-4">
<FoodCard data={post} />
</div>
))
}
</div>
<Pagination
section={campfood_folder}
currentPage={1}
totalPages={totalPages}
/>
</div>
</section>
</Base>
63 changes: 63 additions & 0 deletions src/pages/campfood/page/[slug].astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
import FoodCard from "@/components/FoodCard.astro";
import Pagination from "@/components/Pagination.astro";
import config from "@/config/config.json";
import Base from "@/layouts/Base.astro";
import { getSinglePage } from "@/lib/contentParser.astro";
import { sortByDate } from "@/lib/utils/sortFunctions";
import PageHeader from "@/components/PageHeader.astro";
import { getEntryBySlug } from "astro:content";
const { campfood_folder } = config.settings;
const { slug } = Astro.params;
const postIndex: any = await getEntryBySlug<any, string>(campfood_folder, "-index");
const posts = await getSinglePage(campfood_folder);
const sortedPosts = sortByDate(posts);
const totalPages = Math.ceil(posts.length / config.settings.food_pagination);
const currentPage = slug && !isNaN(Number(slug)) ? Number(slug) : 1;
const indexOfLastPost = currentPage * config.settings.food_pagination;
const indexOfFirstPost = indexOfLastPost - config.settings.food_pagination;
const currentPosts = sortedPosts.slice(indexOfFirstPost, indexOfLastPost);
export async function getStaticPaths() {
const posts = await getSinglePage(config.settings.campfood_folder);
const totalPages = Math.ceil(posts.length / config.settings.food_pagination);
const paths = [];
for (let i = 1; i < totalPages; i++) {
paths.push({
params: {
slug: (i + 1).toString(),
},
});
}
return paths;
}
---

<Base
meta_title={postIndex.data.title}
image={postIndex.data.image}
description={postIndex.data.description}
>
<PageHeader title={postIndex.data.title} />
<section class="section">
<div class="container">
<!-- food posts -->
<div class="row">
{
currentPosts.map((post) => (
<div class="mb-4 md:mb-8 md:col-6 lg:col-4">
<FoodCard data={post} />
</div>
))
}
</div>
<Pagination
section={campfood_folder}
currentPage={currentPage}
totalPages={totalPages}
/>
</div>
</section>
</Base>

0 comments on commit 7bb20b5

Please sign in to comment.