1

I am trying to get a Single. But it doesn't seem to work. Does anyone know what I am doing wrong?

I already double checked the slug, and getting normal channels is also no problem.

This is the code I currently have:

{% set aboutUs = craft.entries.section('about-us').one() %}

1 Answer 1

1

You need to use the machine name of the section, not the single's slug. Check Settings -> Sections in the backend to find out the machine name. Machine names can't contain hyphens, so about-us isn't a valid machine name (though it is a valid slug). Maybe you're just mixing up about_us with about-us.

1
  • 1
    Thanks for your answer! It's solved now.
    – user12198
    Commented Jul 19, 2021 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.