Bug: Structure entry display, field with dashes or underscores not rendered

The following code doesn’t work:

footer-links:
    type: structure
    limit: 3
    entry: >
      {{link-text}}<br />
      {{link-url}}
    fields:
      link-text:
        label: Link Text
        type: text
      link-url:
        label: Link Destination
        type: url

In the panel I just see literally this, so the templating isn’t working:

{{link-text}}
{{link-url}}

This works fine:

footer-links:
    type: structure
    limit: 3
    entry: >
      {{linkText}}<br />
      {{linkUrl}}
    fields:
      linkText:
        label: Link Text
        type: text
      linkUrl:
        label: Link Destination
        type: url

Let me know if a github issue would be more appropriate for this sort of thing.

You can’t use dashes in field names, see the docs. I don’t know why it does not work with underscores, though.

Oh thanks!

It actually does work with underscores - I see now that it didn’t work when I changed to underscore because the .txt file’s fieldnames weren’t updated for some reason. Changed those manually and now it works.

I think the reason I ended up using dashes in fieldnames was because I saw the names were being conformed to contain dashes in the .txt files. Wondering if there is a reason .txt needs to have dashes, rather than keeping it consistent.

Off-topic - it would be nice if when doing an “Edit” to data in a structure field, the modal fields were populated with the existing data. Since you can’t copy and paste the existing data from the panel easily, it’s kind of troublesome to make an edit to a field that has a long url, for example.

I’m afraid I don’t understand what you mean?

You know what, I was seeing some weird behavior but I think it was an artifact of my earlier mistake.

Sorry, thanks for your time!

Glad that everything works as expected now :slight_smile: