Jinja and permissions?

I am trying to show some blog posts on a Website page (users not required to be logged in).

I have set the context as

    context.posts = frappe.get_list("Blog Post", fields=["title", "blog_intro","meta_image","route"])

The posts load fine for a logged-in user, but when I try to load that page from a non-logged in user, I get “Not Permitted”

if I remove the Jinja code, it loads just fine.

Hi @oguruma,

Please use get_all instead of the get_list and check it.

Thank You!

@NCP Answers is right. Here am adding detail information

  1. get_all fetch all records without applying permissions
  2. get_list fetch all records with applying permissions.

Refer the below link.
https://frappeframework.com/docs/user/en/api/database

Also you can write your own method and needs to be whitelisted using the decorator

@frappe.whitelist(allow_guest=True)