Twig header function #1332
I-Valchev
started this conversation in
Ideas / Feature requests
Replies: 1 comment
-
I think you can already do this: Make a Widget extension with target 'nowhere', and in it's https://github.com/bolt/core/blob/master/src/Widget/BoltHeaderWidget.php |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Have a
header
function, either within Bolt or as an extension, that will set an HTTP header.Example use cases incldue:
custom cache header
different response type (e.g. for serving json properly)
If it's an extension, the response type can be used to show the page in json at its own slug, for example:
/page/1 -> html (as is)
/page/1.json -> json
With a bit of imagination, this could also be used to create custom API endpoints in Twig, rather than having to extend and work with api-platform itself.
What do you think @bobdenotter ?
Beta Was this translation helpful? Give feedback.
All reactions