Skip to content

Commit

Permalink
Support embeds in blog posts
Browse files Browse the repository at this point in the history
  • Loading branch information
AkashBhave committed Sep 17, 2023
1 parent 7cf7425 commit fc71667
Show file tree
Hide file tree
Showing 17 changed files with 337 additions and 133 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -83,3 +83,6 @@ sw.*

# macOS
.DS_Store

# Local Netlify folder
.netlify
2 changes: 2 additions & 0 deletions cms/schema.js
Expand Up @@ -8,6 +8,7 @@ import captionedImage from "./schemas/modular/captioned-image";
import codeBlock from "./schemas/modular/code-block";
import iconLink from "./schemas/modular/icon-link";
import skill from "./schemas/modular/skill";
import embed from "./schemas/modular/embed";
// Collection schemas
import post from "./schemas/collections/post";
import project from "./schemas/collections/project";
Expand All @@ -34,5 +35,6 @@ export default createSchema({
codeBlock,
iconLink,
skill,
embed,
]),
});
4 changes: 2 additions & 2 deletions cms/schemas/collections/post.js
Expand Up @@ -23,7 +23,7 @@ export default {
},
{
name: "mainImage",
title: "Main Image",
title: "Main image",
type: "image",
options: {
hotspot: true,
Expand Down Expand Up @@ -56,7 +56,7 @@ export default {
},
{
name: "publishedAt",
title: "Published At",
title: "Published at",
type: "datetime",
},
{
Expand Down
3 changes: 2 additions & 1 deletion cms/schemas/modular/block-content.js
Expand Up @@ -11,7 +11,7 @@

export default {
name: "blockContent",
title: "Block Content",
title: "Block content",
type: "array",
of: [
{
Expand Down Expand Up @@ -40,5 +40,6 @@ export default {
},
{ type: "captionedImage" },
{ type: "codeBlock" },
{ type: "embed" },
],
};
2 changes: 1 addition & 1 deletion cms/schemas/modular/captioned-image.js
@@ -1,6 +1,6 @@
export default {
name: "captionedImage",
title: "Captioned Image",
title: "Captioned image",
type: "object",
fields: [
{
Expand Down
2 changes: 1 addition & 1 deletion cms/schemas/modular/code-block.js
@@ -1,6 +1,6 @@
export default {
name: "codeBlock",
title: "Code Block",
title: "Code block",
type: "object",
fields: [
{
Expand Down
22 changes: 22 additions & 0 deletions cms/schemas/modular/embed.js
@@ -0,0 +1,22 @@
import React from "react";

export default {
title: "Embed",
name: "embed",
type: "object",
fields: [
{
title: "URL",
name: "url",
type: "url",
},
],
preview: {
select: {
url: "url",
},
component: ({ value }) => (
<iframe src={value.url} width="100%" height="500px" frameBorder={0} />
),
},
};
2 changes: 1 addition & 1 deletion cms/schemas/modular/icon-link.js
@@ -1,6 +1,6 @@
export default {
name: "iconLink",
title: "Icon Link",
title: "Icon link",
type: "object",
fields: [
{
Expand Down
2 changes: 1 addition & 1 deletion cms/schemas/singletons/about.js
Expand Up @@ -43,7 +43,7 @@ export default {
},
{
name: "gpgPublicKey",
title: "Public Key",
title: "Public key",
type: "text",
fieldset: "gpg",
},
Expand Down

0 comments on commit fc71667

Please sign in to comment.