Error creating a new section on panel “Invalid section type (“articles”)”

I’m currently trying to extend the starter kit site, and running into issues creating a new section in the Panel.

I’ve made a new section type called ‘articles’, which is essentially a clone of the ‘notes’ section. The .yml file is attached, as is my ‘site.yml’.

The error I get is “Invalid section type (“articles”)”

The following section types are available
– info
– pages
– files
– fields"

However, the ‘notes’ section does not throw this error, despite both notes and articles being included in ‘sections’, and having ‘page’ as a type.

I don’t believe this is the same issue as an earlier question on this topic, as the template type I am trying to create is not a field. Moreover, I’m able to add this new ‘articles’ type as a template to the ‘pages’ section, and it displays fine, so I don’t think there’s a problem with the php template.

Thanks!

sections/articles.yml:

type: pages
headline: Articles
parent: kirby.page("articles")
info: "{{ page.date.toDate('d.m.Y') }}"
template: article
empty: No articles yet
sortBy: date desc

pages/articles.yml:

title: articles
icon: 
columns:
  - width: 1/2
    sections:
      drafts:
        extends: sections/articles
        headline: Drafts
        status: draft

      unlisted:
        extends: sections/articles
        headline: In Review
        status: unlisted

  - width: 1/2
    sections:
      listed:
        extends: sections/articles
        headline: Published
        status: listed

site.yml (second column)

  - width: 1/2
    sections:
      articles: sections/articles
      notes: sections/notes
      pages:
        type: pages
        templates:
          - about
          - home
          - article
          - default

Hm, everything looks ok.

I assume you have also created a page called articles with an articles.txt file inside?

thanks so much!

Yes, it renders on the main page and works fine, and it works when I create an article manually.

What’s also interesting is if I swap out the parent of Notes, in notes.yml like so:

type: pages
headline: Notes
parent: kirby.page("articles")
info: "{{ page.date.toDate('d.m.Y') }}"
template: article
empty: No notes yet
sortBy: date desc

Then I’m able to add articles rather than notes through the CMS. So it’s not an issue with the parent.

What do you mean with the main page? It works in the “Dashboard”, the view rendered with site.yml? Or it works on the articles page?

ah apologies for being unclear.

On the ‘articles’ page on the front end of the site, it works (+ I can click on this etc, it takes me to ‘articles’):

But on the Dashboard, I still see the error:

(+ here’s my file tree). Apologies for the many posts, I’m not allowed to add multiple images!

Weird. Have you cleared the browser cache, logged out and in again?

yeah, even changed browser and changed port! It’s so strange. I might try downloading the blank starter kit and see if I get the same issues

Initially I thought it might be a PHP thing but I’m pretty sure it’s not as I’m able to manipulate the ‘notes’ section fine…

Maybe an issue with the articles.yml section file. What editor are you using?

I’m using sublime text! (and yeah that seems likely, I can see that the server’s making a successful get request to it)

If I replace the contents of sections/articles.yml with the contents of sections/notes.yml, I get the same error.

However, if I replace the contents of sections/notes.yml with the contents of sections/articles.yml (see image below), it renders the ‘articles’ section in site.yml, under the section type ‘notes’ (e.g. the issue seems to be with site.yml and the section type articles). Could it be that articles is some kind of reserved word?

@agnescameron:

Hint:
If your blueprint /site/blueprint/site.yml shows this code:

  - width: 1/2
    sections:
      articles: sections/articles

… then your blueprint /site/blueprint/sections/articles.yml is not correct or is missing.

Hi @HeinerEF, thanks for your reply, but could you explain what you mean a little further?

articles.yml is definitely there in my file tree, and, while the file itself might be incorrect I’m at a loss to what might be wrong with it (because if I swap it with the content of a ‘correct’ file, notes.yml, it continues not to work)

Screen Shot 2020-05-25 at 12.09.22

oh wait, oh my god. It had saved as ‘articles.yaml’

I am so, so sorry, it works now! Thank you all for your help

1 Like