{{item.author.name}} how did this work

I understood that if I have an “authors” subfolder containing Markdown files with the same name as the author specified in the post’s Markdown file, then {{item.author.name}} would automatically retrieve the “name” value from that author’s Markdown file.

However, this doesn’t seem to work in the Appleseed Daily example.

Did I misunderstand something?

No, that still works…

I’ve just tested it with a local copy of the project and it’s all working as expected.

:backhand_index_pointing_right: Open simple blog project in Elements

Jonny or Jonny Appleseed?

the filename needs to match the author in the post markdown file.

So /cms/posts/my-post.md should have:

---
author: jonny
---

then there should be the following file: /cms/authors/jonny.md with:

---
name: Jonny Appleseed
---

I was doing exactly this just yesterday and it worked as expected.

If you have this setup and it’s not working for you, could you send me over the project? :slight_smile:

Just had another quick look at this and it could be a bug with the author markdown file and only having the first name, so jonny.md instead of jonny-appleseed.md — I’m going to file this one as a bug and investigate ASAP :slight_smile:

2 Likes

I open you demo, pressed CMD-P and took the two screenshots.

i changed Jonny to jonny

???

In German we say: Ich stehe auf der Leitung. :wink:

in the filename?

Are you saying this is now working as expected?

No, sadly not. Just have a look at you demo project. In the authors MD-File the name is Jonny Appleseed. Should it print out only Jonny or Jonny Appleseed?

It should be “Jonny Appleseed”.

From my testing shows only “Jonny” in the example project, so I’ll get that fixed ASAP :slight_smile:

2 Likes

Fixed with 1.3.2 - thanks.

2 Likes

Hi, is it just me or is this broken again in 1.5.2? I’m following the video tutorial and neither the author name nor the author image pull through as shown in the video.

What I don’t understand is the demo shows the authors in a folder ‘authors’. How does {{item.author.name}} know to look up the author details in that folder? Is there a step that I’ve missed?

There’s no additional steps, the authors will be hooked up automatically (so long as there is an authors folder at the same level as your collection items).

The CMS will then automatically try and find an author markdown file that matches the author name set in the collection item’s frontmatter.

If you could share your project with us, using Elements Cloud, we can take a look and see why it’s not working for you :slight_smile:

1 Like

It works on my side.

pages

header of one md-file

ulrich.md

image

1 Like

Thanks very much for your reply Ulrich.

I found your examples really helpful. It turns out that I’d missed the '“.md” extension on the author file and therefore it wasn’t picked up. Adding that fixed things.

And thanks @ben for the explanation of how it works.

The image file in the author file gave me some problems but I’ve just realised that the link wasn’t using the correct syntax. All good now!

1 Like