diff --git a/src/components/documents/Design.js b/src/components/documents/Design.js index 0bd667b3..b5afae88 100755 --- a/src/components/documents/Design.js +++ b/src/components/documents/Design.js @@ -74,6 +74,8 @@ export default class Design extends Component { const { loading } = this.global; let openBracket = "{{"; let closedBracket = "}}"; + let tripleOpenBracket = "{{{"; + let tripleClosedBracket = "}}}"; if(this.state.post === true) { return( @@ -88,7 +90,7 @@ export default class Design extends Component {

Graphite Publishing supports full Handlebars syntax, including conditionals. Here is an example that uses all variables and a conditional if block:

@@ -148,7 +150,7 @@ export default class Design extends Component { diff --git a/src/components/documents/SinglePost.js b/src/components/documents/SinglePost.js index ce633795..0418483c 100755 --- a/src/components/documents/SinglePost.js +++ b/src/components/documents/SinglePost.js @@ -45,7 +45,7 @@ export default class SinglePost extends Component { render() { let postUrl = `${window.location.origin}/sites/${loadUserData().username}/public/${window.location.href.split('posts/')[1]}`; - const { save, onboardingComplete, status, loading, content, featuredImg, publishPost, initialLoad, title } = this.global; + const { save, onboardingComplete, status, loading, content, featureImg, publishPost, initialLoad, title } = this.global; const dropzoneStyle = {}; let saveBtn; let saveBtnClass; @@ -109,7 +109,7 @@ export default class SinglePost extends Component { Featured Image - {featuredImg === "" ? + {featureImg === "" ?
:
- featured + featured
@import url('https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css')
{{#posts}}
{{author}}

{{title}}

{{lastUpdated}}

This is a wider card with supporting text below as a natural lead-in to additional content.

Continue reading
{{/posts}}
", - "postCode": "

{{title}}

{{author}}

{{#if featureImg}}{{/if}}
" + "postCode": "

{{title}}

{{author}}

{{#if featureImg}}{{/if}}
" }, { "name": "Minimal", "previewLink": "", "imageUrl": "https://i.imgur.com/2KG8ukM.png", "code": "

Minimal

A simple, elegant, fun blogging template
{{#posts}}

{{title}}


{{/posts}}

", - "postCode": "

{{title}}

Posted by {{author}} on{{published}}

" + "postCode": "

{{title}}

Posted by {{author}} on{{published}}

" }, { "name": "Medium Lite", "previewLink": "", "imageUrl": "https://i.imgur.com/gmpHxj0.png", "code": "
{{#posts}}
{{#if featureImg}}Article without cover 01{{/if}}

{{title}}

Kepler-186f is an exoplanet orbiting the red dwarf Kepler-186,about 490 light-years (151 pc) from the Earth. It is the first planetwith a radius similar to Earth's to be discovered in the habitable zone ofanother star. NASA's Kepler spacecraft detected it using the transitmethod, along ...

{{/posts}}
", - "postCode": "
{{#if featureImg}}{{/if}}

{{title}}

" + "postCode": "
{{#if featureImg}}{{/if}}

{{title}}

" } ] } \ No newline at end of file diff --git a/src/components/helpers/design.js b/src/components/helpers/design.js index 02fe0284..e7454973 100755 --- a/src/components/helpers/design.js +++ b/src/components/helpers/design.js @@ -14,11 +14,11 @@ let html; export function setTheme(name) { if(name === 'card') { - setGlobal({ pageHTML: "
\n\n
\n{{#posts}}\n
\n
\n
\n{{#if featureImg}}\n\n{{/if}}\n\n{{title}}\n\n
\n
\n

Published: {{lastUpdated}}

\n

By: {{author}}

\n
\n\n
\n
\n{{/posts}}\n
\n
" }) + setGlobal({ pageHTML: "
\n\n
\n{{#posts}}\n
\n
\n
\n{{#if featureImg}}\n\n{{/if}}\n\n{{title}}\n\n
\n
\n

Published: {{lastUpdated}}

\n

By: {{author}}

\n
\n\n
\n
\n{{/posts}}\n
\n
" }) } else if(name === 'clean') { - setGlobal({ pageHTML: "
\n
\n{{#posts}}\n

{{title}}

\n{{#if featureImg}}\n{{title}}\n{{/if}}\n
{{author}}
\n
{{lastUpdated}}
\n\n
\n{{/posts}}\n
\n
" }) + setGlobal({ pageHTML: "
\n
\n{{#posts}}\n

{{title}}

\n{{#if featureImg}}\n{{title}}\n{{/if}}\n
{{author}}
\n
{{lastUpdated}}
\n\n
\n{{/posts}}\n
\n
" }) } else if(name === 'night') { - setGlobal({ pageHTML: "
\n
\n

Your Site Name

\n
\n
\n{{#posts}}\n
\n
\n

{{lastUpdated}}

\n

{{title}}

\n{{#if featureImg}}\n{{title}}\n{{/if}}\n

Written by {{author}}

\n\n{{/posts}}\n
\n
\n
" }) + setGlobal({ pageHTML: "
\n
\n

Your Site Name

\n
\n
\n{{#posts}}\n
\n
\n

{{lastUpdated}}

\n

{{title}}

\n{{#if featureImg}}\n{{title}}\n{{/if}}\n

Written by {{author}}

\n\n{{/posts}}\n
\n
\n
" }) } } @@ -111,7 +111,7 @@ export async function publicLoadMainHtml() { } else { await setGlobal({ pageHTML: `
\n

Your Blog Title (Don't forget to update this on the Design page

\n{{#posts}}\n
\n

{{title}}

\n

A post by {{author}}

\n

Published {{lastUpdated}}

\n\n
\n{{/posts}}\n
`, - postHTML: `
\n

{{title}}

\n
Published: {{published}}
\n{{#if featuredImg}}\npost feature\n{{/if}}\n
\n
\n
\n
`, + postHTML: `
\n

{{title}}

\n
Published: {{published}}
\n{{#if featureImg}}\npost feature\n{{/if}}\n
\n
\n
\n
`, loading: false }) loadPublicSitePosts(); @@ -133,7 +133,7 @@ export async function loadMainHtml() { console.log(getGlobal().accountName) setGlobal({ pageHTML: `
\n

${getGlobal().accountName}

\n{{#posts}}\n
\n

{{title}}

\n

A post by {{author}}

\n

Published {{lastUpdated}}

\n\n
\n{{/posts}}\n
`, - postHTML: `
\n

{{title}}

\n
Published: {{published}}
\n{{#if featuredImg}}\npost feature\n{{/if}}\n
\n
\n
\n
`, + postHTML: `
\n

{{title}}

\n
Published: {{published}}
\n{{#if featureImg}}\npost feature\n{{/if}}\n
\n
\n
\n
`, loading: false }) } @@ -230,7 +230,7 @@ export function loadPostHtml() { console.log(getGlobal().postHTML) if(getGlobal().postHTML === undefined || getGlobal().postHTML === "") { setGlobal({ - postHTML: "
\n

{{title}}

\n
Published: {{published}}
\n{{#if featuredImg}}\npost feature\n{{/if}}\n
\n
\n
\n
" + postHTML: "
\n

{{title}}

\n
Published: {{published}}
\n{{#if featureImg}}\npost feature\n{{/if}}\n
\n
\n
\n
" }) } }) diff --git a/src/components/helpers/posts.js b/src/components/helpers/posts.js index 9ba541e3..638f1dcd 100755 --- a/src/components/helpers/posts.js +++ b/src/components/helpers/posts.js @@ -245,7 +245,7 @@ export async function loadPostPreview() { author: thisPost.author, published: thisPost.lastUpdated , postURL: thisPost.url, - featuredImg: thisPost.featureImg + featureImg: thisPost.featureImg } } @@ -323,7 +323,7 @@ export async function loadPublicPostsCollection() { // "content" : JSON.parse(fileContents).content || "", // "author" : JSON.parse(fileContents).author || "", // "published" : JSON.parse(fileContents).lastUpdated || "", - // "featuredImg" : JSON.parse(fileContents).featureImg || "", + // "featureImg" : JSON.parse(fileContents).featureImg || "", // "link" : window.location.origin + '/public/' + getGlobal().ownerBlockstackId + '/posts/' + JSON.parse(fileContents).id // } // }) diff --git a/src/components/helpers/singlepost.js b/src/components/helpers/singlepost.js index 4e914388..b78f2ea6 100755 --- a/src/components/helpers/singlepost.js +++ b/src/components/helpers/singlepost.js @@ -34,7 +34,7 @@ export async function loadSingle() { content: thisPost.content || "", createdDate: thisPost.createdAt || "", postURL: thisPost.url || "", - featuredImg: thisPost.featureImg || "", + featureImg: thisPost.featureImg || "", publishPost: thisPost.publishPost || false, status: thisPost.status || "Draft", convergence: thisPost.convergence @@ -91,7 +91,7 @@ export function handleFeaturedDrop(files) { this.handleDropRejected(); console.log("file too large") }else { - setGlobal({featuredImg: object.link, editing: true}); + setGlobal({featureImg: object.link, editing: true}); } }; reader.readAsDataURL(file); @@ -110,7 +110,7 @@ export async function handleSavePost() { content: getGlobal().content, tags: getGlobal().tags, lastUpdated: getDate(), - featureImg: getGlobal().featuredImg, + featureImg: getGlobal().featureImg, status: getGlobal().publishPost ? "Published" : "Draft", convergence: getGlobal().convergence } @@ -134,7 +134,7 @@ export async function handleSavePost() { link: `${window.location.origin}/sites/${loadUserData().username}/public/${window.location.href.split('posts/')[1]}`, lastUpdated: getDate(), publishedDate: getDate(), - featureImg: getGlobal().featuredImg, + featureImg: getGlobal().featureImg, convergence: getGlobal().convergence } await thisPublic.update(newPublicAttrs) @@ -149,7 +149,7 @@ export async function handleSavePost() { link: `${window.location.origin}/sites/${loadUserData().username}/public/${window.location.href.split('posts/')[1]}`, lastUpdated: getDate(), publishedDate: getDate(), - featureImg: getGlobal().featuredImg, + featureImg: getGlobal().featureImg, convergence: getGlobal().convergence }) await publicPost.save(); @@ -179,7 +179,7 @@ export async function loadSinglePublic() { content: post.attrs.content, author: post.attrs.author, createdDate: post.attrs.createdDate, - featuredImg: post.attrs.featureImg || "", + featureImg: post.attrs.featureImg || "", lastUpdated: post.attrs.lastUpdated }) var data, template; @@ -189,7 +189,7 @@ export async function loadSinglePublic() { "content" : getGlobal().content, "author" : getGlobal().author, "published" : getGlobal().lastUpdated, - "featuredImg" : getGlobal().featuredImg + "featureImg" : getGlobal().featureImg } console.log(data) template = await window.Handlebars.compile(getGlobal().postHTML); diff --git a/src/index.js b/src/index.js index 66652ef7..9281d7c4 100755 --- a/src/index.js +++ b/src/index.js @@ -72,7 +72,7 @@ setGlobal({ redirect: false, index: 0, postLoadingDone: false, - featuredImg: "", + featureImg: "", postURL: "", postLoading: false, publishPost: false,