Where to edit {{{body}}} in Dawn

So I’m making progress with my website but I’ve hit another issue. I want to edit/ play around with the style of the default way the dawn theme lists articles (shown in the image below). I’m pretty new to using JavaScript and can’t seem to locate where or how I can make changes to it. If anyone can help I’d massively apreciate it.

The body is dynamically populated with content from other files depending on the route.

The code to show the list of posts for most themes will be in index.hbs using the {{#foreach posts}} helper.

For each post It will probably reference a component in the partials folder (I haven’t looked at Dawn itself but this is the usual pattern as discussed here).

The component is most likely where you want to make changes.

Inside that component you will be in a posts context which means you can access the title, url, created at date etc…you can see what other attributes exist here.

Hope this helps :slightly_smiling_face:

1 Like

Thanks so much for the answer. This might sound like a very stupid and basic question but when you say the component is where I’m likely going to need to make changes, what exactly do you mean by component?

Not a stupid question! I should have been more clear.

By component, I actually mean partial.

With Ghost themes, a partial isolates some code so that you can use it across your theme by using the import syntax. Below shows the usual syntax that you find in index.hbs files using a partial (found in partials/post-card.hbs) for each post.

This would loop through each post, and display it using the html that is found in the post-card partial.

{{#foreach posts}}

  {{> "post-card"}}

{{/foreach}}

This makes it easy to change the html and data as you just have to go to that one file. I also find it makes it more readable because you don’t have to understand its context.

Let me know if you need any more help!

1 Like

Ah thanks so much! I’ve found it now so I’ll start playing around with the file. For anyone who searches for a similar issue in the future, in the Dawn theme the file for the posts is loop.hbs

1 Like

Hi, so I’ve tried to follow what you’ve said with limited success. I’ve made a new question which is related to this one if you wouldn’t mind taking a look :) Help with {{body}} tag on homepage