From 04a868b2eb20a4fe862c16120bcaf7261d5bcc27 Mon Sep 17 00:00:00 2001 From: mortendk Date: Wed, 28 Jun 2023 16:51:26 +0200 Subject: [PATCH 1/4] post and tag pages added as content pages --- src/_system/11ty/collection/blocks.js | 4 --- src/_system/11ty/collection/tags.js | 2 +- .../_decapcms/contenttypes/page.liquid | 8 ++--- src/_system/systempages/tags.liquid | 6 ---- src/content/menuitem/styleguide.md | 2 +- src/content/page/contact.md | 2 +- src/content/page/footer-menu-placeholder.md | 8 ++--- src/content/page/post-overview.md | 17 ++++++++++ src/content/page/tags.md | 21 ++++++++++++ src/content/page/thanks.md | 8 ++--- src/content/tag/saga11.md | 4 +-- src/theme-grunn/includes/card.liquid | 3 +- .../includes/components/form/form.liquid | 6 ++-- .../components/templates/all-pages.liquid | 33 ++++++++++--------- .../components/templates/all-post.liquid | 23 +++++++------ .../components/templates/all-tags.liquid | 22 +++++++++++++ .../components/templates/default.liquid | 6 ---- src/theme-grunn/includes/footer/footer.liquid | 7 +++- src/theme-grunn/layouts/page/page-tags.liquid | 17 ++++++++++ src/theme-grunn/layouts/page/page.liquid | 3 -- src/theme-grunn/layouts/system/tags.liquid | 6 ---- 21 files changed, 134 insertions(+), 74 deletions(-) delete mode 100644 src/_system/11ty/collection/blocks.js delete mode 100644 src/_system/systempages/tags.liquid create mode 100644 src/content/page/post-overview.md create mode 100644 src/content/page/tags.md create mode 100644 src/theme-grunn/includes/components/templates/all-tags.liquid delete mode 100644 src/theme-grunn/includes/components/templates/default.liquid create mode 100644 src/theme-grunn/layouts/page/page-tags.liquid delete mode 100644 src/theme-grunn/layouts/system/tags.liquid diff --git a/src/_system/11ty/collection/blocks.js b/src/_system/11ty/collection/blocks.js deleted file mode 100644 index af4dbe75..00000000 --- a/src/_system/11ty/collection/blocks.js +++ /dev/null @@ -1,4 +0,0 @@ -// looks at all data and for where we have a blockposition -module.exports = function (collection) { - return collection.getAll().filter((item) => item.data.blockposition); -}; diff --git a/src/_system/11ty/collection/tags.js b/src/_system/11ty/collection/tags.js index d723417b..f01f9bfa 100644 --- a/src/_system/11ty/collection/tags.js +++ b/src/_system/11ty/collection/tags.js @@ -1,6 +1,6 @@ // The filter hides the tag from collections function filterTags(tags) { - return (tags || []).filter((tag) => ["rssfeed", "relation"].indexOf(tag) === -1); + return (tags || []).filter((tag) => ["rssfeed"].indexOf(tag) === -1); } module.exports = function (collection) { diff --git a/src/_system/_decapcms/contenttypes/page.liquid b/src/_system/_decapcms/contenttypes/page.liquid index cbe80e4f..1b44ed66 100644 --- a/src/_system/_decapcms/contenttypes/page.liquid +++ b/src/_system/_decapcms/contenttypes/page.liquid @@ -11,8 +11,8 @@ create: true delete: true editor: - preview: true - summary: "{% raw %}🏩 {{title}} | url: {{url}} | {{permalink}}{% endraw %} " + preview: false + summary: "{% raw %}🏩 Title '{{title}}' Url: '{{url}}' {% endraw %} " sortable_fields: ["url", "title", "order"] view_filters: - label: collection @@ -21,10 +21,8 @@ view_groups: - label: Tags field: tags - - label: permalink - field: permalink nested: - depth: 5 # max depth to show in the collection tree + depth: 1 summary: "{% raw %}{{title}}{% endraw %}" fields: {% include "_system/_decapcms/widgets/string", diff --git a/src/_system/systempages/tags.liquid b/src/_system/systempages/tags.liquid deleted file mode 100644 index cea6922d..00000000 --- a/src/_system/systempages/tags.liquid +++ /dev/null @@ -1,6 +0,0 @@ ---- -permalink: tag/index.html -title: "tags" -layout: system/tags.liquid -eleventyExcludeFromCollections: true ---- diff --git a/src/content/menuitem/styleguide.md b/src/content/menuitem/styleguide.md index 23ff8fdf..bf5cdb3e 100644 --- a/src/content/menuitem/styleguide.md +++ b/src/content/menuitem/styleguide.md @@ -5,5 +5,5 @@ eleventyNavigation: target: true parent: main key: Styleguide - order: 10 + order: 100 --- diff --git a/src/content/page/contact.md b/src/content/page/contact.md index 3600da72..5550664a 100644 --- a/src/content/page/contact.md +++ b/src/content/page/contact.md @@ -6,7 +6,7 @@ components: - type: form title: "Contact form " name: contact - action: /submitted + action: /contact/thanx template: components/form/form.liquid elements: - type: text diff --git a/src/content/page/footer-menu-placeholder.md b/src/content/page/footer-menu-placeholder.md index 3388533f..400ef8a6 100644 --- a/src/content/page/footer-menu-placeholder.md +++ b/src/content/page/footer-menu-placeholder.md @@ -1,14 +1,14 @@ --- -title: Footer placeholder +title: Footer menu placeholder url: footer image: "" order: 1 eleventyExcludeFromCollections: true +layout: page/page.liquid +date: 2023-06-25 22:58:55 eleventyNavigation: key: footer title: footer order: 0 -layout: page/page.liquid -date: 2023-06-25 22:58:55 --- -nope +This page is used as a placeholder for the footer menu ... \ No newline at end of file diff --git a/src/content/page/post-overview.md b/src/content/page/post-overview.md new file mode 100644 index 00000000..231eb93b --- /dev/null +++ b/src/content/page/post-overview.md @@ -0,0 +1,17 @@ +--- +title: Blog Posts +url: post +image: "" +components: + - type: njktemplate + template: components/templates/all-post.liquid +order: 1 +eleventyExcludeFromCollections: false +eleventyNavigation: + description: "" + string: "" +seo: + index: index + follow: nofollow +layout: page/page.liquid +--- diff --git a/src/content/page/tags.md b/src/content/page/tags.md new file mode 100644 index 00000000..26039e1c --- /dev/null +++ b/src/content/page/tags.md @@ -0,0 +1,21 @@ +--- +title: tags +url: tag +image: /content/upload/default.png +components: + - type: njktemplate + template: components/templates/all-tags.liquid +order: 1 +eleventyExcludeFromCollections: false +eleventyNavigation: + description: "" + string: "" + title: Tags + parent: main + key: "" + order: 15 +seo: + index: index + follow: nofollow +layout: page/page-tags.liquid +--- diff --git a/src/content/page/thanks.md b/src/content/page/thanks.md index ed58278c..020c4c17 100644 --- a/src/content/page/thanks.md +++ b/src/content/page/thanks.md @@ -1,10 +1,10 @@ --- -title: Form Submitted thanx -image: /content/upload/default.png -url: submitted +title: Thanx +url: contact/thanx +image: "" +eleventyExcludeFromCollections: true eleventyNavigation: excerpt: "" layout: page/page.liquid -eleventyExcludeFromCollections: true --- The message is sent :) diff --git a/src/content/tag/saga11.md b/src/content/tag/saga11.md index 313158ba..5c11d226 100644 --- a/src/content/tag/saga11.md +++ b/src/content/tag/saga11.md @@ -4,8 +4,8 @@ icon: icons/arrow-down-left.svg eleventyExcludeFromCollections: false rssfeed: true eleventyNavigation: - title: Tag page - parent: main + title: "" + parent: "" order: 20 layout: tag/tag.liquid --- diff --git a/src/theme-grunn/includes/card.liquid b/src/theme-grunn/includes/card.liquid index 8dd7c643..3be0acd9 100644 --- a/src/theme-grunn/includes/card.liquid +++ b/src/theme-grunn/includes/card.liquid @@ -41,8 +41,7 @@

{{ title }}

- date: {{ dateLocalize }} - {{ text }} + {{ text }}
{% if date %}
diff --git a/src/theme-grunn/includes/components/form/form.liquid b/src/theme-grunn/includes/components/form/form.liquid index c82820f0..9edb2b14 100644 --- a/src/theme-grunn/includes/components/form/form.liquid +++ b/src/theme-grunn/includes/components/form/form.liquid @@ -13,14 +13,16 @@
-
{% comment %}
{% endcomment %} - +action : {{ component.action }} {% comment %}All the form elements {% endcomment %} {% for item in component.elements %} {% if item.type == "textarea" %} diff --git a/src/theme-grunn/includes/components/templates/all-pages.liquid b/src/theme-grunn/includes/components/templates/all-pages.liquid index 058e508d..5c11bd59 100644 --- a/src/theme-grunn/includes/components/templates/all-pages.liquid +++ b/src/theme-grunn/includes/components/templates/all-pages.liquid @@ -1,21 +1,22 @@ -{%- if env.mode != 'prod' %} - -{%- endif -%} +{%- if env.mode != 'prod' %}{%- endif -%} -
-

All pages

+
-
+ {% for item in collections.allPages %} - {% for item in collections.allPages %} - {% render 'card', - title: item.data.card.title, - text: item.data.card.text, - image: item.data.card.image, - url: item.url, - date: item.date + {% assign title = item.data.card.title | default: item.data.title %} + {% assign image = item.data.card.image | default: item.data.image %} + {% assign text = item.data.card.text | default: item.data.text | truncatewords: "20", " ..." %} + {% + render 'card.liquid', + title: title, + text: text, + image: image, + url: item.url, + date: item.date %} - {% endfor %} -
-
\ No newline at end of file + + {% endfor %} +
+ diff --git a/src/theme-grunn/includes/components/templates/all-post.liquid b/src/theme-grunn/includes/components/templates/all-post.liquid index fe5c6946..8893b38b 100644 --- a/src/theme-grunn/includes/components/templates/all-post.liquid +++ b/src/theme-grunn/includes/components/templates/all-post.liquid @@ -2,19 +2,22 @@ {%- endif -%} -

All Post

-
- {% for item in collections.allPosts %} + {% for item in collections.allPost %} - {% render 'card', - title: item.data.card.title, - text: item.data.card.text, - image: item.data.card.image, - url: item.url, - date: item.date + {% assign title = item.data.card.title | default: item.data.title %} + {% assign image = item.data.card.image | default: item.data.image %} + {% assign text = item.data.card.text | default: item.data.text | truncatewords: "20", " ..." %} + {% + render 'card.liquid', + title: title, + text: text, + image: image, + url: item.url, + date: item.date %} + {% endfor %} -
\ No newline at end of file + diff --git a/src/theme-grunn/includes/components/templates/all-tags.liquid b/src/theme-grunn/includes/components/templates/all-tags.liquid new file mode 100644 index 00000000..6bc64d75 --- /dev/null +++ b/src/theme-grunn/includes/components/templates/all-tags.liquid @@ -0,0 +1,22 @@ +{%- if env.mode != 'prod' %}{%- endif -%} + +
+ + {% for item in collections.allTags %} + {% if item.fileSlug != "rssfeed" %} + {% assign title = item.data.card.title | default: item.data.title %} + {% assign image = item.data.card.image | default: item.data.image %} + {% assign text = item.data.card.text | default: item.data.text | truncatewords: "20", " ..." %} + {% + render 'card.liquid', + title: title, + text: text, + image: image, + url: item.url, + date: item.date + %} + + {% endif %} + {% endfor %} +
+ diff --git a/src/theme-grunn/includes/components/templates/default.liquid b/src/theme-grunn/includes/components/templates/default.liquid deleted file mode 100644 index 6f38f4db..00000000 --- a/src/theme-grunn/includes/components/templates/default.liquid +++ /dev/null @@ -1,6 +0,0 @@ -{%- if env.mode != 'prod' %}{%- endif -%} - -
- This is a default template that can be selected from the pagecomponenet - in a collection from netlifycms -
diff --git a/src/theme-grunn/includes/footer/footer.liquid b/src/theme-grunn/includes/footer/footer.liquid index cd6abb9d..753806c6 100644 --- a/src/theme-grunn/includes/footer/footer.liquid +++ b/src/theme-grunn/includes/footer/footer.liquid @@ -90,7 +90,12 @@ {% include "some/socialmedia.liquid" %} - +
+ Build with ⚔️ + 💜 +
+
Saga11 : {{ saga11version }}
+
{{ eleventy.generator }}
+ diff --git a/src/theme-grunn/layouts/page/page-tags.liquid b/src/theme-grunn/layouts/page/page-tags.liquid new file mode 100644 index 00000000..4e974709 --- /dev/null +++ b/src/theme-grunn/layouts/page/page-tags.liquid @@ -0,0 +1,17 @@ +--- +layout: default.liquid +saga-template-name: Tag overview +--- +{%- if env.mode != 'prod' %}{%- endif -%} + +
+
+ {% include "tag/taglist.liquid" %} +
+ +
+

{{ title }}

+
{{ content }}
+ {% include "components/all.liquid" %} +
+
diff --git a/src/theme-grunn/layouts/page/page.liquid b/src/theme-grunn/layouts/page/page.liquid index b69423e5..4f64db6b 100644 --- a/src/theme-grunn/layouts/page/page.liquid +++ b/src/theme-grunn/layouts/page/page.liquid @@ -9,9 +9,6 @@ saga-template-name: Page default {% include "tag/tags.liquid" %} -{{ page.date | dateformat: dateLocalize, "full" }} -{{ page.date | date: "%H:%M" }} - {% if image %}
{% render 'image/image.liquid', diff --git a/src/theme-grunn/layouts/system/tags.liquid b/src/theme-grunn/layouts/system/tags.liquid deleted file mode 100644 index 5e667641..00000000 --- a/src/theme-grunn/layouts/system/tags.liquid +++ /dev/null @@ -1,6 +0,0 @@ ---- -layout: default.liquid -saga-template-name: tags overview ---- - -{% include "tag/taglist.liquid" %} From 5574e4f7919156108608286d969b2ba5c09a834a Mon Sep 17 00:00:00 2001 From: mortendk Date: Wed, 28 Jun 2023 16:53:34 +0200 Subject: [PATCH 2/4] post + tag page added to the menu --- src/content/page/component.md | 28 +++++++++---------- src/content/page/post-overview.md | 3 ++ .../components/templates/all-post.liquid | 2 +- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/content/page/component.md b/src/content/page/component.md index 262ae595..35647f8a 100644 --- a/src/content/page/component.md +++ b/src/content/page/component.md @@ -1,16 +1,7 @@ --- -title: Components -card: - title: Title from a card - image: /content/upload/default.png - alt: alt text for image - text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod - tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, - quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo - consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse - cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat - non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. - " +title: Components overview +url: component +image: https://images.unsplash.com/photo-1496449903678-68ddcb189a24 components: - type: pagecard template: components/pagecard/pagecard.liquid @@ -279,12 +270,21 @@ components: velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. -image: https://images.unsplash.com/photo-1496449903678-68ddcb189a24 +card: + title: Title from a card + image: /content/upload/default.png + alt: alt text for image + text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat + non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + " tags: - saga11 - rssfeed order: 3 -url: component layout: page/page.liquid date: 2023-06-12 11:58:55 eleventyExcludeFromCollections: false diff --git a/src/content/page/post-overview.md b/src/content/page/post-overview.md index 231eb93b..9e323118 100644 --- a/src/content/page/post-overview.md +++ b/src/content/page/post-overview.md @@ -10,6 +10,9 @@ eleventyExcludeFromCollections: false eleventyNavigation: description: "" string: "" + title: Blog post + parent: main + order: 20 seo: index: index follow: nofollow diff --git a/src/theme-grunn/includes/components/templates/all-post.liquid b/src/theme-grunn/includes/components/templates/all-post.liquid index 8893b38b..c2cfc0b1 100644 --- a/src/theme-grunn/includes/components/templates/all-post.liquid +++ b/src/theme-grunn/includes/components/templates/all-post.liquid @@ -4,7 +4,7 @@
- {% for item in collections.allPost %} + {% for item in collections.allPosts %} {% assign title = item.data.card.title | default: item.data.title %} {% assign image = item.data.card.image | default: item.data.image %} From 0d1cd128a1423918fecc600679d4a026b4a47d88 Mon Sep 17 00:00:00 2001 From: mortendk Date: Wed, 28 Jun 2023 17:09:05 +0200 Subject: [PATCH 3/4] update menu --- .../_decapcms/contenttypes/menuitem.liquid | 15 ++++++++------- src/_system/_decapcms/fields/menu.liquid | 4 ++-- src/content/menuitem/saga11.md | 3 ++- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/_system/_decapcms/contenttypes/menuitem.liquid b/src/_system/_decapcms/contenttypes/menuitem.liquid index 2257d283..80bddfaf 100644 --- a/src/_system/_decapcms/contenttypes/menuitem.liquid +++ b/src/_system/_decapcms/contenttypes/menuitem.liquid @@ -4,7 +4,7 @@ - name: menuitem label: 🍔 Menu Items label_singular: 🍔 Menu Item - description: "Single menu items to be included in the exising navigation structre. | Version: 1.0" + description: "Single menu items to be included in the exising navigation" folder: "src/content/menuitem" slug: "{{title}}" preview_path: notification/{{title}}/ @@ -25,10 +25,10 @@ fields: {% include "_system/_decapcms/widgets/string", name: "title", - label: "title", + label: "Title", default: "", required: true, - hint: "" + hint: "The title is used for admin reference - the menu items title is set in the navigation" %} - name: eleventyNavigation label: 🍔 Navigation @@ -36,11 +36,12 @@ collapsed: false summary: "{{fields.key}} | {{fields.parent}}" fields: - - { label: "key", name: key, widget: "string", required: true, hint: "Title and key"} - - { label: "url", name: url, widget: "string", required: false, hint: "Full url https://saga11.dev"} + - { label: "Title", name: title, widget: "string", required: true, hint: "Title"} + - { label: "Machine key", name: key, widget: "string", required: true, hint: "Title and key"} + - { label: "Url", name: url, widget: "string", required: false, hint: "Full url https://saga11.dev"} - { label: "Open in new window", name: "target", widget: "boolean", default: false, required: false, } - name: "parent" - label: parent menu item + label: Parent menu item widget: relation collection: page default: main @@ -49,6 +50,6 @@ displayFields: ["Title: {% raw %}{{title}} | key: '{{eleventyNavigation.key}} {% endraw %}'"] required: false multiple: false - - { label: "order", name: "order", widget: "number", required: false} + - { label: "Order", name: "order", widget: "number", required: false} - { label: "text", name: "text", widget: "text", required: false} diff --git a/src/_system/_decapcms/fields/menu.liquid b/src/_system/_decapcms/fields/menu.liquid index 0404ed11..52e7abee 100644 --- a/src/_system/_decapcms/fields/menu.liquid +++ b/src/_system/_decapcms/fields/menu.liquid @@ -16,5 +16,5 @@ multiple: false - { label: "Machine key", name: "key", widget: "string", required: false, hint: "The Key is used by the system Main is used for the frontpage - and should always be" } - { label: "Order", name: "order", widget: "number", required: false} - - { label: "Description", name: "description", widget: "text", default : "", required: false } - - { label: "Text string", name: "string", widget: "string", default : "", required: false, hint: "a string that can be used for icon name / color" } + - { label: "Text", name: "text", widget: "text", required: false} + - { label: "String", name: "optional", widget: "string", required: false, hint: "an optional text string that can be used in the theme ala {% raw %}{{ item.optional }}{% endraw %}" } diff --git a/src/content/menuitem/saga11.md b/src/content/menuitem/saga11.md index 56869740..a307155d 100644 --- a/src/content/menuitem/saga11.md +++ b/src/content/menuitem/saga11.md @@ -1,9 +1,10 @@ --- -title: saga11 +title: Saga11 !! eleventyNavigation: url: https://saga11.dev target: true order: 100 key: saga11 parent: component + title: "SAGA " --- From c829869a4fbfe69e58eb0fcca26e644c5061b7d6 Mon Sep 17 00:00:00 2001 From: mortendk Date: Wed, 28 Jun 2023 17:12:33 +0200 Subject: [PATCH 4/4] Update eleventy.config.js --- eleventy.config.js | 1 - 1 file changed, 1 deletion(-) diff --git a/eleventy.config.js b/eleventy.config.js index e9c699c3..e75c4d57 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -63,7 +63,6 @@ module.exports = function (eleventyConfig) { eleventyConfig.addCollection("allNotification", require("./src/_system/11ty/collection/allNotification.js")); eleventyConfig.addCollection("allTags", require("./src/_system/11ty/collection/allTags.js")); eleventyConfig.addCollection("tags", require("./src/_system/11ty/collection/tags.js")); - eleventyConfig.addCollection("blocks", require("./src/_system/11ty/collection/blocks.js")); eleventyConfig.addCollection("styleguide", require("./src/_system/11ty/collection/styleguide.js")); // Transform