Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seo opengrah settings #253

Merged
merged 19 commits into from
Jun 28, 2023
4 changes: 2 additions & 2 deletions snippets/snippets.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
Generate image
{% endcomment %}
{% if image %}
{% render 'image.liquid',
{% render 'image/image.liquid',
file: image,
alt: title,
sizes: "(min-width: 30em) 50vw, 100vw",
Expand All @@ -30,7 +30,7 @@
{% endif %}

{% if image %}
{% render 'image.liquid', file: image, widths: "400" %}
{% render 'image/image.liquid', file: image, widths: "400" %}
{% endif %}

{% include "linklist/linklist.liquid", collection : collections.allPages, url: url %}
Expand Down
3 changes: 3 additions & 0 deletions snippets/variables.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@ Content:
Debug data
{% for item in collection.all limit: 2 %}
{{ item | debug }}
{{ item.data.templateContent }}
{% endfor %}



3 changes: 0 additions & 3 deletions src/_custom/collection/allProducts.js

This file was deleted.

3 changes: 0 additions & 3 deletions src/_custom/collection/allSkills.js

This file was deleted.

3 changes: 0 additions & 3 deletions src/_custom/collection/allWork.js

This file was deleted.

10 changes: 8 additions & 2 deletions src/_custom/decapcms/collections.liquid
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% comment %}
- name: custom
label: "💜 Custom contenttypes"
label_singular: 💜 Custom contenttype
Expand Down Expand Up @@ -30,6 +31,11 @@
required: true,
hint: "Title"
%}

{% include "_system/_decapcms/fields/opengraph.liquid" %}

{% include "_system/_decapcms/fields/seo.liquid" %}

{% include "_system/_decapcms/widgets/code",
name: "code",
label: "code",
Expand Down Expand Up @@ -59,7 +65,7 @@
{% include "_system/_decapcms/widgets/select",
name: "select",
label: "select",
options: " 'one' ,'two dfgdjfklgd','three'"
options: " 'one' ,'two','three'"
default: "one",
multiple: true,
required: true,
Expand Down Expand Up @@ -136,7 +142,6 @@
hint: "Set to false if you want to hide this page"
%}


- name: test
label: "🔥test"
label_singular: 💜 test
Expand Down Expand Up @@ -169,3 +174,4 @@
required: true,
hint: "Title"
%}
{% endcomment %}
4 changes: 1 addition & 3 deletions src/_system/11ty/shortcode/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ const fs = require("fs");
const Image = require("@11ty/eleventy-img");

module.exports = async function (file, widths, format, alttext, sizes, loading, css) {
// src = "src" + file;
if (fs.existsSync("src" + file)) {
src = "src" + file;
} else if (file.indexOf("http://") === 0 || file.indexOf("https://") === 0) {
src = file;
} else {
console.log(` missing src: ${file} - ${src}`);
console.log(`missing file: ${file} - src ${src}`); 
}

const theCss = css || "";
Expand All @@ -18,7 +17,6 @@ module.exports = async function (file, widths, format, alttext, sizes, loading,
const theLoading = loading || "lazy";
const theWidths = widths || ["640", "1024", "1563"];


let metadata = await Image(src, {
widths: theWidths,
formats: theFormat ,
Expand Down
73 changes: 37 additions & 36 deletions src/_system/11ty/shortcode/imageurl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,44 @@ const path = require("path");
const fs = require("fs");
const Image = require("@11ty/eleventy-img");

// Returns an url for an image
module.exports = async function (image, width, format) {
const src = "src" + image;
const widths = width || ["750"];;
const formats = format || ["jpeg"];
module.exports = async function (file, width, format) {
if (fs.existsSync("src" + file)) {
src = "src" + file;
} else if (file.indexOf("http://") === 0 || file.indexOf("https://") === 0) {
src = file;
} else {
console.log(`🚨 missing file: ${file} - src ${src}`);
}

const theFormat = format || "webp";
const theWidth = width || ["1024"];

// console.log(`🎈 imageurl generate: ${src}`);
//does the image exist - we dont want to break the build.
if (fs.existsSync(src)) {
let options = {
widths : widths,
formats: formats,
urlPath: "/img/",
outputDir: "./_site/img/",
// sensible filenames:
// filenameFormat: function (src, width, format) {
// const extension = path.extname(src);
// const name = path.basename(src, extension);
// return `${name}-${width}w.${format}`;
// },
};
// console.log(`🎈 imageurl next: ${options}`);
// Generate the image
Image(src, options);
metadata = Image.statsSync(src, options);
let options = await Image(src, {
widths: theWidth,
formats: theFormat ,
urlPath: "/img/",
outputDir: "_site/img/",
cacheOptions: {
duration: "1d",
directory: ".cache",
removeUrlQueryParams: false,
},
filenameFormat: function (id, src,theWidth, formats) {
return `${id}-${theWidth}w.${formats}`;
},
});

let filename;
if (formats == "jpeg") {
filename = metadata.jpeg[0].url;
} else if (format == "png") {
filename = metadata.png[0].url;
} else if (format == "gif") {
filename = metadata.gif[0].url;
} else {
filename = metadata.webp[0].url;
}
// console.log(`🎈 filename: ${filename}`);
return filename;
// console.log("🦐 Object: %o", options)
let filename;
if (theFormat == "jpeg") {
filename = options.jpeg[0].url;
} else if (format == "png") {
filename = options.png[0].url;
} else if (format == "gif") {
filename = options.gif[0].url;
} else {
filename = options.webp[0].url;
}

return filename;
};
2 changes: 1 addition & 1 deletion src/_system/_decapcms/contenttypes/menuitem.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
editor:
preview: false
# Overview
summary: "{% raw %}{{title}} | Url: {{eleventyNavigation.url}} | Parent: {{eleventyNavigation.parent}}{% endraw %}"
summary: " 🍔 {% raw %} {{title}} | Url: {{eleventyNavigation.url}} | Parent: {{eleventyNavigation.parent}}{% endraw %}"
sortable_fields: ["title"]
view_filters:
- label: Drafts
Expand Down
2 changes: 1 addition & 1 deletion src/_system/_decapcms/contenttypes/notification.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
editor:
preview: false
# Overview
summary: "{% raw %}{{title}} Status: {{status}} Draft: {{eleventyExcludeFromCollections}}{% endraw %}"
summary: "{% raw %}📣 {{title}} Status: {{status}} Draft: {{eleventyExcludeFromCollections}}{% endraw %}"
sortable_fields: ["title", "date"]
view_filters:
- label: Drafts
Expand Down
14 changes: 9 additions & 5 deletions src/_system/_decapcms/contenttypes/page.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
delete: true
editor:
preview: true
summary: "{% raw %}{{title}} | url: {{url}} | {{permalink}}{% endraw %} "
summary: "{% raw %}🏩 {{title}} | url: {{url}} | {{permalink}}{% endraw %} "
sortable_fields: ["url", "title", "order"]
view_filters:
- label: collection
Expand Down Expand Up @@ -43,10 +43,6 @@
hint: ""
%}

{% include "_system/_decapcms/fields/card.liquid" %}

{% include "_system/_decapcms/fields/component.liquid" %}

{% include "_system/_decapcms/widgets/image",
name: "image",
label: "Image",
Expand All @@ -65,6 +61,10 @@
hint: ""
%}

{% include "_system/_decapcms/fields/component.liquid" %}

{% include "_system/_decapcms/fields/card.liquid" %}

{% include "_system/_decapcms/fields/tags.liquid" %}

{% include "_system/_decapcms/widgets/number",
Expand All @@ -88,4 +88,8 @@

{% include "_system/_decapcms/fields/menu.liquid" %}

{% include "_system/_decapcms/fields/opengraph.liquid" %}

{% include "_system/_decapcms/fields/seo.liquid" %}

{% include '_system/_decapcms/widgets/template-relation.liquid', collection: 'pagetemplates', folder: "page" %}
25 changes: 17 additions & 8 deletions src/_system/_decapcms/contenttypes/post.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
required: "false",
hint: "image"
%}
{% include "_system/_decapcms/fields/card.liquid" %}

{% include "_system/_decapcms/widgets/markdown",
name: "body",
label: "Body",
Expand All @@ -57,8 +57,10 @@
hint: "help text"
%}

{% include "_system/_decapcms/fields/card.liquid" %}

{% include "_system/_decapcms/fields/tags.liquid" %}

{% include "_system/_decapcms/widgets/number",
name: "order",
label: "order",
Expand All @@ -69,19 +71,26 @@
required: false,
hint: "optional order"
%}

{% include "_system/_decapcms/widgets/boolean",
name: "eleventyExcludeFromCollections",
label: "Collection Hide",
default: "false",
required: "false",
hint: "Hide from collections"
%}

{% include "_system/_decapcms/widgets/datetime",
name: "date",
label: "Date",
default: "true",
required: "false",
hint: "help text"
%}

{% include "_system/_decapcms/fields/opengraph.liquid" %}

{% include "_system/_decapcms/fields/seo.liquid" %}

{% include '_system/_decapcms/widgets/template-relation.liquid', collection: 'posttemplates', folder: "post" %}

{% include "_system/_decapcms/widgets/boolean",
name: "eleventyExcludeFromCollections",
label: "Collection Hide",
default: "false",
required: "false",
hint: "Hide from collections"
%}
7 changes: 6 additions & 1 deletion src/_system/_decapcms/contenttypes/tag.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
- name: tags
label_singular: 🏷 Tag
label: 🏷 Tags
description: "Tags used to catagorize content"
description: "Tagging to generate content for collections"
folder: "src/content/tag"
slug: "{% raw %}{{title}}{% endraw %}"
summary: "{% raw %}🏷 {{title}} {% endraw %} "
hide: false
create: true
delete: false
Expand All @@ -29,6 +30,10 @@
hint: "help text"
%}

{% include "_system/_decapcms/fields/opengraph.liquid" %}

{% include "_system/_decapcms/fields/seo.liquid" %}

{% include "_system/_decapcms/fields/menu.liquid" %}

{% include '_system/_decapcms/widgets/template-relation.liquid', collection: 'tagtemplates', folder: "tag" %}
3 changes: 1 addition & 2 deletions src/_system/_decapcms/fields/card.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
label: 🏙 card
widget: object
collapsed: true
summary: "{% raw %}{{fields.image}} {{fields.teaser}}{% endraw %}"
summary: "{% raw %}Title: '{{fields.title}}' | Image: {{fields.image}} | Text: '{{fields.text}}'{% endraw %}"
fields:
- { label: "title", name: "title", widget: "string", required: false }
- { label: "Image", name: "image", widget: "image", required: false, choose_url: true }
- { label: "Image alt", name: "alt", widget: "string", required: false }
- { label: "Text", name: "text", widget: "text", required: false }
4 changes: 2 additions & 2 deletions src/_system/_decapcms/fields/menu.liquid
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
- name: eleventyNavigation
label: 🍔 Navigation
label: 🍔 Menu
widget: object
collapsed: true
summary: "{% raw %}{{fields.key}} | {{fields.parent}} {% endraw %}"
summary: "{% raw %} Title: {{fields.title}} | Parent: {{fields.parent}} | Text: {{fields.text}} | Key: {{fields.key}} | Order: {{fields.order}} | {% endraw %}"
fields:
- { label: "title", name: "title", widget: "string", required: false}
- name: "parent"
Expand Down
9 changes: 9 additions & 0 deletions src/_system/_decapcms/fields/opengraph.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- name: opengraph
label: 👋 Opengraph
widget: object
collapsed: true
summary: "{% raw %}Title: '{{fields.title}}' | Image: {{fields.image}} | Description: '{{fields.description}}'{% endraw %}"
fields:
- { label: "Image", name: "image", widget: "image", required: false, choose_url: true }
- { label: "Title", name: "title", widget: "string", required: false, hint: 'Opengraph Card title' }
- { label: "Description", name: "description", widget: "text", required: false }
27 changes: 27 additions & 0 deletions src/_system/_decapcms/fields/seo.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
- name: seo
label: 🔍 SEO & Sharing
widget: object
collapsed: true
summary: "{% raw %} Title: '{{fields.title}}' | Description: '{{fields.content}}' | Robots: {{fields.index}}, {{fields.follow}} {% endraw %}"
fields:
- { label: "title", name: "title", widget: "string", required: false, hint: 'seo title' }
- { label: "Meta Description", name: "description", widget: "text", required: false }
- label: "Show this page in search Engines"
name: "index"
widget: "select"
default: "index"
required: false
options:
- { label: "Yes", value: "index" }
- { label: "No dont show", value: "noindex" }
- label: "Search Engines follow the links"
name: "follow"
widget: "select"
default: "nofollow"
required: false
options:
- { label: "Yes", value: "follow" }
- { label: "No", value: "nofollow" }



2 changes: 1 addition & 1 deletion src/_system/_decapcms/settings/globalcontent.liquid
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- label: "Global Content"
- label: "🌐 Global Content"
name: "Global"
file: "src/content/_data/global.json"
fields:
Expand Down
Loading