Closed jamestagal closed 2 years ago
Just make sure you check if the field exists (i.e. {#if dateModified}
) before using it in a template: https://github.com/jamestagal/edtechdesigner/blob/main/layouts/content/posts.svelte#L43. Once you do that you should be able to remove the key from your content source without errors.
Hi Jim, ok thanks. I quickly added the following but still get an error. See below how I did it.
2022/01/02 11:59:50 errs.go:57: Can't render htmlComponent: TypeError: Cannot read property 'dateModified' of undefined /home/runner/work/plenti/plenti/cmd/build/data_source.go on line 321
{#if dateModified}
<li class="px-1 inline-flex">Updated : {dateModified}</li>
{/if}
What you did looks right for layouts/content/posts.svelte
, but it appears that dateModified
is also used in:
themes/compendium/layouts/components/featured.svelte
themes/compendium/layouts/components/post_meta.svelte
themes/compendium/layouts/scripts/openGraph.svelte
themes/compendium/layouts/scripts/catgs_tags.svelte
themes/compendium/layouts/scripts/SEO.svelte
So you'd have to copy those templates and modify them as well. Here's a working example: https://github.com/jamestagal/edtechdesigner/pull/12
hi Jim. ok thanks.. to start with should I merge what you have modified from this pull request? https://github.com/jamestagal/edtechdesigner/pull/12 So just to check, when doing a "Merge pull request" green button, that modifies and updates my repo with your changes., is that correct? If so, then how to I update my local repo on my machine to be in sync with Gitbub? Sorry I am still very new to git and Github :)
Yeah you can merge that pull request to add my changes to your repo. Couple of things to note:
layouts/components/featured.svelte
file from the theme so I accidentally overrode your modifications to this file:
<div class="col-lg-8 bg-white bg-opacity-5 mx-auto shadow-xl">
class="feature w-full absolute top-40 m-0 px-16"
dateModified
key/value from content/posts/post-10.json
as an exampleThat's correct, using the "Merge pull request" will modify this repo. To get your local machine sync'd up, after you merge on Github go to your local project and pull in those changes: git pull origin main
Wow that's really cool! I think i need to learn more about these features in Git/Github. I was able to merge your changes and then pull them down to my local repo and push back to Github really quickly :) Thanks Jim. I really appreciate all your assistance with this. I still have to finalise my content to be added and make change to the about page but thanks to you, Plenti and this theme I'm getting there. I need to swap out some images and write a few posts... etc but I'm happy with the development. I am finding it's a little hard work styling the html in the .json file particularly list items but i can see that your CMS will make this much easier :) Happy new year to you and your family.
Great glad you're making progress :). I agree there's a lot to be desired when it comes to maintaining content, especially unstructured WYSIWYG type fields (e.g. alternative between a blurb of text and a bulleted list). We're working on it, so it should get better with some time. Happy new year to you as well!!
Hi Jim, The field dateModified in the posts.json files seems to be required because If I remove it I get an error. However I was thinking that when posts haven't been modified it would better not to display this field. How could I optionally display the dateModified field? I tried using "false" as a value but that just displayed 'false' on the page... :) Any suggestions here would be appreciated.