Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set headers by page #1591

Closed
jrivero opened this issue Jul 24, 2017 · 4 comments
Closed

set headers by page #1591

jrivero opened this issue Jul 24, 2017 · 4 comments
Labels

Comments

@jrivero
Copy link

jrivero commented Jul 24, 2017

Hi, I need set the cache-control header by page, and I think it would be interesting to have an option on page frontmatter to set any other headers, similar than meta settings

@flaviocopes
Copy link
Contributor

You can set the expires property in the page frontmatter, and it will be used by Grav:


        // Calculate Expires Headers if set to > 0
        $expires = $page->expires();

        if ($expires > 0) {
            $expires_date = gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT';
            header('Cache-Control: max-age=' . $expires);
            header('Expires: ' . $expires_date);
        }

@rhukster
Copy link
Member

Oh that's embarrassing! It's my code too! We definitely need to document that as I had forgotten about it :)

@jrivero
Copy link
Author

jrivero commented Jul 26, 2017

It's fantastic news to be able to define an expiration time, I have to try it!

However I think it is also important to be able to define if the page is cachable (public, private, etc). @rhukster could make us a little patch :)

rhukster added a commit that referenced this issue Jul 26, 2017
@rhukster rhukster added the fixed label Jul 26, 2017
@rhukster
Copy link
Member

done!

OleVik added a commit to OleVik/grav-learn that referenced this issue Jul 15, 2018
- [x] Document optional collection ordering PHP flags getgrav/grav#1640
	- Added under /content/collections#php-collections
- [x] Added cache_control system and page override getgrav/grav#1591
	- Added reference-link to /basics/grav-configuration#pages
	- Added /content/headers#cache-control
- [x] clear_images_by_default cache option getgrav/grav#1481
	- Clarified description in /basics/grav-configuration#pages
- [x] Collection::intersect() getgrav/grav#1605
	- Added under /content/collections#collection-object-methods
- [x] Collection::merge() method
	- Added under /content/collections#collection-object-methods
- [x] Page::collection() filtering
	- Added under /content/collections#complex-collections, with a bit of cleanup
- [x] Document EXIF support in Grav (and in capabilities)
	- Clarified /themes/twig-filters-functions#exif
	- Added note at the end of /cookbook/general-recipes#creating-a-simple-gallery
- [x] document not being able to scroll caused by cloudlare. getgrav/grav-plugin-admin#808 (comment)
	- Done in getgrav#397
	- Duplicated under Admin Plugin and Cookbook headers
- [x] Document adding custom form fields with examples..
	- Done in getgrav#401
- [x] Document range field
	- Done in [7e0dcbc](getgrav@7e0dcbc)
- [x] Tutorial on how to create a split menu system (vertical menu?)
	- Duplicated under Cookbook header
- [x] Tutorial walkthrough covering going from and HTML site/design to Grav theme
	- Duplicated under Cookbook header

getgrav#356 needs some cleanup to remove completed tasks, they're not really needed.
rhukster pushed a commit to getgrav/grav-learn that referenced this issue Jul 27, 2018
- [x] Document optional collection ordering PHP flags getgrav/grav#1640
	- Added under /content/collections#php-collections
- [x] Added cache_control system and page override getgrav/grav#1591
	- Added reference-link to /basics/grav-configuration#pages
	- Added /content/headers#cache-control
- [x] clear_images_by_default cache option getgrav/grav#1481
	- Clarified description in /basics/grav-configuration#pages
- [x] Collection::intersect() getgrav/grav#1605
	- Added under /content/collections#collection-object-methods
- [x] Collection::merge() method
	- Added under /content/collections#collection-object-methods
- [x] Page::collection() filtering
	- Added under /content/collections#complex-collections, with a bit of cleanup
- [x] Document EXIF support in Grav (and in capabilities)
	- Clarified /themes/twig-filters-functions#exif
	- Added note at the end of /cookbook/general-recipes#creating-a-simple-gallery
- [x] document not being able to scroll caused by cloudlare. getgrav/grav-plugin-admin#808 (comment)
	- Done in #397
	- Duplicated under Admin Plugin and Cookbook headers
- [x] Document adding custom form fields with examples..
	- Done in #401
- [x] Document range field
	- Done in [7e0dcbc](7e0dcbc)
- [x] Tutorial on how to create a split menu system (vertical menu?)
	- Duplicated under Cookbook header
- [x] Tutorial walkthrough covering going from and HTML site/design to Grav theme
	- Duplicated under Cookbook header

#356 needs some cleanup to remove completed tasks, they're not really needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants