diff --git a/.build.yml b/.build.yml new file mode 100644 index 0000000..ace1441 --- /dev/null +++ b/.build.yml @@ -0,0 +1,19 @@ +image: alpine/edge +packages: + - nodejs +sources: + - https://git.sr.ht/~stfn/vegan-prestwich-11ty +secrets: + - b56325c2-cd2c-4a22-b5e9-8c43db571721 +tasks: + - setup: | + npm install + - build: | + cd vegan-prestwich + npm run build + - deploy: | + cd vegan-prestwich + set +x + export NEOCITIES_API_KEY=$(cat ~/.neocities_api_key) + set -x + neocities push --prune _site diff --git a/.eleventy.js b/.eleventy.js index 02f069f..917b2d4 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -1,27 +1,38 @@ +const fg = require('fast-glob'); + +const placeImages = fg.sync(['places/*/*.jpg', '!**/_site']); + module.exports = function(config) { - if (process.env.NOWATCH) { - config.setBrowserSyncConfig({ - snippetOptions: { - blacklist: ["**/*.html"], - } - }) + // Aliases are in relation to the _includes folder + config.addLayoutAlias('default', 'layouts/default.liquid'); + config.addLayoutAlias('home', 'layouts/home.liquid'); + config.addLayoutAlias('page', 'layouts/page.liquid'); + config.addLayoutAlias('place', 'layouts/place.liquid'); + config.addLayoutAlias('tag', 'layouts/tag.liquid'); + config.addLayoutAlias('tags', 'layouts/tags.liquid'); + + let getAllSorted = (api) => { + return api.getAll().sort((a, b) => { a.name - b.name }); } - // Aliases are in relation to the _includes folder - config.addLayoutAlias('default', 'layouts/default.html'); - config.addLayoutAlias('home', 'layouts/home.html'); - config.addLayoutAlias('page', 'layouts/page.html'); - config.addLayoutAlias('place', 'layouts/place.html'); - config.addLayoutAlias('tag', 'layouts/tag.html'); - config.addLayoutAlias('tags', 'layouts/tags.html'); + config.addCollection("shops", (api) => + getAllSorted(api).filter((a) => a.data.permalink && a.data.shop)); + + config.addCollection("restaurants", (api) => + getAllSorted(api).filter((a) => a.data.permalink && a.data.restaurant)); + + config.addCollection("deliveries", (api) => + getAllSorted(api).filter((a) => a.data.permalink && a.data.delivery)); + + config.addWatchTarget("./style/style.scss"); + + config.addCollection("place_images", (collection) => placeImages);; + config.addPassthroughCopy("places/*/*.jpg"); - config.addCollection("shops", (api) => api.getAll().filter((a) => a.data.shop)); - config.addCollection("restaurants", (api) => api.getAll().filter((a) => a.data.restaurant)); - config.addCollection("deliveries", (api) => api.getAll().filter((a) => a.data.delivery)); return { dir: { - input: "./", // Equivalent to Jekyll's source property - output: "./_site" // Equivalent to Jekyll's destination property + input: "./", + output: "./_site" } }; -}; +}; \ No newline at end of file diff --git a/.gitignore b/.gitignore index 3b1f009..870740d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,10 @@ .bundle .DS_Store -.jekyll-metadata .sass-cache _site Cache vendor Gemfile.lock -.jekyll-cache +.eleventy.js.swp .neocities node_modules diff --git a/_deleted_places/_deleted_places.json b/_deleted_places/_deleted_places.json new file mode 100644 index 0000000..727d5c2 --- /dev/null +++ b/_deleted_places/_deleted_places.json @@ -0,0 +1,3 @@ +{ + "permalink": false +} \ No newline at end of file diff --git a/_filters/11ty_contains.js b/_filters/11ty_contains.js deleted file mode 100644 index 8adaeeb..0000000 --- a/_filters/11ty_contains.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = function (arr, key, value) { - return arr.filter(item => { - const keys = key.split('.'); - const reduce = keys.reduce((object, key) => { - return object[key]; - }, item); - const str = String(reduce); - return (str.includes(value) ? item : false); - }); -}; - diff --git a/_includes/head.html b/_includes/head.html index 2be6ddf..93d91d4 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -2,17 +2,22 @@ - + {% capture styles %} + {% include "../_site/style/style.css" %} + {% endcapture %} + - {% if page.metaTitle %} - {{ page.metaTitle | escape }} - {% else if page.name %} - {{ page.name | escape }}, Prestwich - {% else if page.title %} - {{page.title | escape }}, Prestwich + {% if metaTitle %} + {{ metaTitle | escape }} + {% else if name %} + {{ name | escape }}, Prestwich + {% else if title %} + {{ title | escape }}, Prestwich {% else %} {{ site.title | escape }} {% endif %} - + diff --git a/_includes/header.html b/_includes/header.html index 89585b9..88670fb 100644 --- a/_includes/header.html +++ b/_includes/header.html @@ -16,10 +16,10 @@
- {% assign top-links = site.pages | sort: "order" %} + {% assign top-links = collections.pages | sort: "order" %} {% for link-page in top-links %} - {% if link-page.link-text %} - {{ link-page.link-text | escape }} + {% if link-page.data.link-text %} + {{ link-page.data.link-text | escape }} {% endif %} {% endfor %}
diff --git a/_includes/layouts/default.html b/_includes/layouts/default.liquid similarity index 100% rename from _includes/layouts/default.html rename to _includes/layouts/default.liquid diff --git a/_includes/layouts/home.html b/_includes/layouts/home.liquid similarity index 77% rename from _includes/layouts/home.html rename to _includes/layouts/home.liquid index 9a81678..90cb7cc 100644 --- a/_includes/layouts/home.html +++ b/_includes/layouts/home.liquid @@ -28,9 +28,9 @@ layout: default

Recent updates: - {% assign recently_updated = site.places | sort: "last_modified_at" | reverse | slice: 0, 10 %} + {% assign recently_updated = collections.places | sort: "last_modified_at" | reverse | slice: 0, 10 %} {% for place in recently_updated %} - {{ place.name | escape }}{% unless forloop.last %}, {% endunless %} + {{ place.data.name | escape }}{% unless forloop.last %}, {% endunless %} {% endfor %}

diff --git a/_includes/layouts/page.html b/_includes/layouts/page.html deleted file mode 100644 index 9b0a35f..0000000 --- a/_includes/layouts/page.html +++ /dev/null @@ -1,17 +0,0 @@ ---- -layout: default ---- - -

{{ page.title | escape }}

- -
- {{ content }} - - {% if page.show %} -
- {% include "filtered-places.html", show=page.show, detailed=true %} -
- {% endif %} - - {% include "contribute.html" %} -
diff --git a/_includes/layouts/page.liquid b/_includes/layouts/page.liquid new file mode 100644 index 0000000..63f181b --- /dev/null +++ b/_includes/layouts/page.liquid @@ -0,0 +1,17 @@ +--- +layout: default +--- + +

{{ title | escape }}

+ +
+ {{ content }} + {{ foo | json }} + {% if show %} +
+ {% include "filtered-places", show: collections[show], detailed: true %} +
+ {% endif %} + + {% include "contribute.html" %} +
diff --git a/_includes/layouts/place.html b/_includes/layouts/place.html deleted file mode 100644 index 54fa5ab..0000000 --- a/_includes/layouts/place.html +++ /dev/null @@ -1,43 +0,0 @@ ---- -layout: default ---- - -{% include "place-json-ld.html" %} - -

{{ page.name | escape }}

- -
- {% include "place-meta.html" %} - {{ content }} - -

- - Last Updated: {{ page.last_modified_at | date: "%-d %B %Y" }} - -

- -
- {% assign place_images = site.static_files | where: "place_image", true | reverse %} - {% for image in place_images %} - {% assign end_image_index = image.path.size | minus: 22 %} - {% assign search_image = image.path | slice: 15, end_image_index %} - - {% assign end_page_index = page.path.size | minus: 11 %} - {% assign search_page = page.path | slice: 8, end_page_index %} - - {% if search_image == search_page %} - - {% endif %} - {% endfor %} -
- -

- - Tags: - {% assign tags = page.tags | sort %} - {% for tag in tags %}{% unless forloop.first %}, {% endunless %} - {% assign tag_page = site.tags | where: "slug", tag | first %} - {% if tag_page %}{% endif %}{{ tag }}{% if tag_page %}{% endif %}{% endfor %} - -

-
diff --git a/_includes/layouts/place.liquid b/_includes/layouts/place.liquid new file mode 100644 index 0000000..bb670b7 --- /dev/null +++ b/_includes/layouts/place.liquid @@ -0,0 +1,45 @@ +--- +layout: default +--- + +{% include "place-json-ld.html" %} + +

{{ name | escape }}

+ +
+ {% include "place-meta.html" %} + {{ content }} + +

+ + Last Updated: {{ last_modified_at | date: "%-d %B %Y" }} + +

+ + +
+ {% assign place_images = collections.place_images | reverse %} + {% for image in place_images %} + {% capture absolute_url %}/{{image}}{% endcapture %} + {% assign folder_size = absolute_url.size | minus: 6 %} + {% capture absolute_folder %}{{ absolute_url | slice: 0, folder_size }}{% endcapture %} + {% if absolute_folder == page.url %} + + {% endif %} + {% endfor %} +
+ +

+ + Tags: + {% assign tags = tags | sort | remove: "places" %} + {% for tag in tags %}{% unless forloop.first %}, {% endunless %} + {% assign tag_page = site.tags | where: "slug", tag | first %} + {% if tag_page %}{% endif %}{{ tag }}{% if tag_page %}{% endif %}{% endfor %} + +

+
diff --git a/_includes/layouts/tag.html b/_includes/layouts/tag.liquid similarity index 84% rename from _includes/layouts/tag.html rename to _includes/layouts/tag.liquid index ee7efa2..e226091 100644 --- a/_includes/layouts/tag.html +++ b/_includes/layouts/tag.liquid @@ -2,13 +2,13 @@ layout: default --- -

{{ page.title | escape }}

+

{{ title | escape }}

{{ content }} {% if chains.size > 0 %} -

{{ page.non_chain_intro }}

+

{{ non_chain_intro }}

{% endif %}