picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.81k stars 615 forks source link

Set mime type for template #544

Closed raspbeguy closed 4 years ago

raspbeguy commented 4 years ago

Hello,

I would like to know if there is a way to specify some HTTP properties, like the mime type.

AFAIC, I have a feed template that generates a RSS feed (I know there is a plugin for that, but I prefer the template way, mainly because I use a theme that does it that way). I with there would be a way to indicate that this template should use the header Content-Type: application/rss+xml.

PhrozenByte commented 4 years ago

You can't modify headers using Twig, you'll have to write a Pico plugin for that.

raspbeguy commented 4 years ago

I can imagine a dictionnary in the configuration enabling to specify various settings relative to certain templates, not only HTTP headers. For instance, title levels shift could be defined that way (see issue #543). This could be like this:

templatevars:
    post:
        type: text/html
        titleshift: 2
    feed:
        type: application/rss+xml
    default:
        [...]
stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two days if no further activity occurs. Thank you for your contributions! :+1: