Skip to content

Commit

Permalink
changing from post to recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
agates4 committed Nov 24, 2022
1 parent 63e8a53 commit a2c1db4
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 34 deletions.
1 change: 1 addition & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(require("./_11ty/apply-csp.js"));
eleventyConfig.setDataDeepMerge(true);
eleventyConfig.addLayoutAlias("post", "layouts/post.njk");
eleventyConfig.addLayoutAlias("recipe", "layouts/recipe.njk");
eleventyConfig.addNunjucksAsyncFilter(
"addHash",
function (absolutePath, callback) {
Expand Down
14 changes: 7 additions & 7 deletions _data/metadata.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"title": "Title of the website. Update me.",
"title": "Csillagok Receptek",
"url": "https://update-me.com",
"domain": "update-me.com",
"description": "Description of the website. Update me.",
"genre": "Insert a schema.org genre",
"googleAnalyticsId": "GA ID. Update me. Note, that this is not compatible with the not-yet-commonly used version 4 of Google Analytics",
"description": "All you can eat recipes created by Geczy Csilla!",
"genre": "Recipe",
"googleAnalyticsId": "GA ID. Update me",
"sendWebVitals": false,
"feed": {
"subtitle": "Subtitle. Update me.",
Expand All @@ -17,10 +17,10 @@
"url": "https://update-me.com/feed/feed.json"
},
"author": {
"name": "Author Name. Update me.",
"name": "Geczy, Csilla",
"twitterHandle": "update_me"
},
"publisher": {
"name": "Publisher name. Update me."
"name": "Geczy, Csilla"
}
}
}
4 changes: 1 addition & 3 deletions about/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ eleventyNavigation:
order: 3
---

I am a person that writes stuff.

This blog template is based on [eleventy-high-performance-blog](https://www.industrialempathy.com/posts/eleventy-high-performance-blog/) which itself is based on [eleventy-base-blog](https://github.com/11ty/eleventy-base-blog).
I am a person that loves to cook.
20 changes: 10 additions & 10 deletions feed/feed.njk
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ eleventyExcludeFromCollections: true
<name>{{ metadata.author.name }}</name>
<email>{{ metadata.author.email }}</email>
</author>
{%- for post in collections.recipes %}
{% set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset %}
{%- for recipe in collections.recipes %}
{% set absoluteRecipeUrl %}{{ recipe.url | url | absoluteUrl(metadata.url) }}{% endset %}
<entry>
<title>{{ post.data.title }}</title>
<link href="{{ absolutePostUrl }}"/>
<updated>{{ post.date | rssDate }}</updated>
<id>{{ absolutePostUrl }}</id>
<title>{{ recipe.data.title }}</title>
<link href="{{ absoluteRecipeUrl }}"/>
<updated>{{ recipe.date | rssDate }}</updated>
<id>{{ absoluteRecipeUrl }}</id>
<content type="html">
{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) }}
{{ recipe.templateContent | htmlToAbsoluteUrls(absoluteRecipeUrl) }}
{% if googleanalytics %}
{% set titleUrlEncoded = post.data.title|encodeURIComponent %}
{% set urlUrlEncoded = post.url | encodeURIComponent %}
{{'<img src="' + metadata.url + '/api/ga?v=1&_v=j83&t=pageview&dr=https%3A%2F%2Frss-feed-reader.com&_s=1&dh=' + metadata.domain + '&dp=' + urlUrlEncoded + '&ul=en-us&de=UTF-8&dt=' + titleUrlEncoded + '&tid=' + googleanalytics + '" width="1" height="1" style="display:none" alt="">'}}
{% set titleUrlEncoded = recipe.data.title|encodeURIComponent %}
{% set urlUrlEncoded = recipe.url | encodeURIComponent %}
{{'<img src="' + metadata.url + '/.netlify/functions/ga?v=1&_v=j83&t=pageview&dr=https%3A%2F%2Frss-feed-reader.com&_s=1&dh=' + metadata.domain + '&dp=' + urlUrlEncoded + '&ul=en-us&de=UTF-8&dt=' + titleUrlEncoded + '&tid=' + googleanalytics + '" width="1" height="1" style="display:none" alt="">'}}
{% endif %}
</content>
</entry>
Expand Down
14 changes: 7 additions & 7 deletions feed/json.njk
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ eleventyExcludeFromCollections: true
"url": "{{ metadata.author.url }}"
},
"items": [
{%- for post in collections.recipes | reverse %}
{%- set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset -%}
{%- for recipe in collections.recipes | reverse %}
{%- set absoluteRecipeUrl %}{{ recipe.url | url | absoluteUrl(metadata.url) }}{% endset -%}
{
"id": "{{ absolutePostUrl }}",
"url": "{{ absolutePostUrl }}",
"title": "{{ post.data.title }}",
"content_html": {% if post.templateContent %}{{ post.templateContent | dump | safe }}{% else %}""{% endif %},
"date_published": "{{ post.date | rssDate }}"
"id": "{{ absoluteRecipeUrl }}",
"url": "{{ absoluteRecipeUrl }}",
"title": "{{ recipe.data.title }}",
"content_html": {% if recipe.templateContent %}{{ recipe.templateContent | dump | safe }}{% else %}""{% endif %},
"date_published": "{{ recipe.date | rssDate }}"
}
{%- if not loop.last -%}
,
Expand Down
40 changes: 33 additions & 7 deletions index.njk
Original file line number Diff line number Diff line change
@@ -1,18 +1,44 @@
---
title: Title. Update me.
title: Csillagok Receptek
layout: layouts/home.njk
description: Description. Update me.
description: All you can eat recipes created by Geczy Csilla!
image: https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg
date: Last Modified
pagination:
data: collections.recipes
size: 9
alias: recipes
reverse: true
---

<p>
This is a demo website based on
<a href="https://www.industrialempathy.com/recipes/eleventy-high-performance-blog/">eleventy-high-performance-blog</a>.
This is a recipe website of Csilla's original recipes. These were first posted on
<a target="_blank" href="https://cookpad.com/hu/felhasznalok/6659384">cookpad.hu</a>
</p>

<div id="recipes">
<h2>recipes</h2>
{% set recipeslist = collections.recipes %}
<h2>Recipes</h2>
<p align="center">
<a href="{{ pagination.href.next }}" style="margin-right: 1.5em;">Previous</a>
{%- for pageEntry in pagination.pages %}
<a style="margin-right: 0.25em;" href="{{ pagination.hrefs[ loop.index0 ] }}"{% if page.url == pagination.hrefs[ loop.index0 ] %} aria-current="page"{% endif %}>{{ loop.index }}</a>
{%- endfor %}
<a href="{{ pagination.href.next }}" style="margin-left: 1.25em;">Next</a>
</p>
{% set recipeslist = recipes %}
{% include "recipeslist.njk" %}
</div>
<p align="center">
<a href="{{ pagination.href.next }}" style="margin-right: 1.5em;">Previous</a>
{%- for pageEntry in pagination.pages %}
<a style="margin-right: 0.25em;" href="{{ pagination.hrefs[ loop.index0 ] }}"{% if page.url == pagination.hrefs[ loop.index0 ] %} aria-current="page"{% endif %}>{{ loop.index }}</a>
{%- endfor %}
<a href="{{ pagination.href.next }}" style="margin-left: 1.25em;">Next</a>
</p>
</div>

<style>
[aria-current] {
font-weight: bold;
font-size: 130%;
}
</style>

0 comments on commit a2c1db4

Please sign in to comment.