Is there any way to get all internal tags in Ghost using the api and the get
helper?
In my post.hbs
template I can do this and it works:
{{#post}}
{{#foreach tags visibility="internal"}}
{{name}}
{{/foreach}}
{{/post}}
But in my page.hbs
I tried this and it only shows tags with public visibility.
{{#get "tags" limit="all"}}
{{#foreach tags}}
{{name}}
{{/foreach}}
{{/get}}
I also tried
{{#get "tags" filter="visibility:internal"}}
and
{{#get "tags" visibility="internal"}}
but it does not return any tags.
Is this not implemented and if so why not? This would be super useful for my use case.
I did read the docs and https://themes.ghost.org/docs/get#section--fields- says that valid fields for tags are id, uuid, name, slug, description, image, created_at, created_by, updated_at, updated_by
. Visibility is notably missing, does anyone know why?
You have to specify the visibility
attribute when you access the tags, not when you retrieve them, in this case, it's in the foreach
:
{{#get "tags" limit="all"}}
{{#foreach tags visibility="internal"}}
{{name}}
{{/foreach}}
{{/get}}
This will loop over the internal tags only. Apparently you have to get all the tags and then filter this way, I didn't find a way to get only the internal tags from the begining.