Blueprint, author name instead of ID

I am upgrading my website from version 3 to version 4. I have never used the panel before, and for the first time I’m configuring it with blueprints. I want to learn how to configure it for another project and using my website as an exercise.

In my blog.yml page I have a section like this:

    sections:
      listed:
        sortBy: date desc
        headline: Listed
        type: pages
        layout: cards
        template: note
        info: "{{ page.timestamp }}"
        status: listed
        help: Listed

and I’d like to add also the author name, so I’m trying this:

info: "{{ page.timestamp }} {{ page.author.name }}"

and I get the timestamp and an ID, similar to:

2024-02-04 01:45:00 - user://abcd1234

image

If I print the author name in the post.php template with:

  <?php if($user = $page->author()->toUser()): ?>
  <p>Author: <?= $user->username() ?></p>
  <?php endif ?>

The author name is printed, but I’m wondering if it is possible to have the author name also in the text file, instead of:

Author: user://abcd1234

Ideally I’d like to have the timestamp and the author name on 2 separate lines, but \\ or \n are not

Thanks for any suggestion.

Should be

page.author.toUser.username

Storing the name is not a good idea, as names are not unique.

Thanks! This work on the panel, but not in the text file.
I understand that names are not unique, but I’d like to have in my txt the real name of the author.
If I use a template like:

----
Timestamp: 2024-02-04 00:25:00
----
AuthorID: - user://1a2b3c4d
----
Author: Fabio Sirna
----

how can I print the name in the author field?

A users field doesn’t support storing a user name. You would have to use a simple text field, or a select field where it’s up to you what you store.

1 Like