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

Tidbits of additions, bit of issue-cleanup #632

Merged
merged 1 commit into from
Jul 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pages/01.basics/05.grav-configuration/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ The **Pages** section of the `system/config/system.yaml` file is where you set a
* **types**: List of valid page types. For example: `[txt,xml,html,htm,json,rss,atom]`
* **append_url_extension**: Append page's extension in Page URLs (e.g. `.html` results in **/path/page.html**).
* **expires**: Page expires time in seconds (604800 seconds = 7 days) (`no cache` is also possible).
* **cache_control**: Can be blank for no setting, or a valid `cache-control` text value
* **cache_control**: Can be blank for no setting, or a [valid](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) `cache-control` text value
* **last_modified**: Set the last modified date header based on file modification timestamp. Can be set `true` or `false`.
* **etag**: Set the etag header tag. Can be set to `true` or `false`.
* **vary_accept_encoding**: Add `Vary: Accept-Encoding` header. Can be set to `true` or `false`.
Expand Down Expand Up @@ -205,7 +205,7 @@ The **Cache** section is where you can configure the site's caching settings. Yo
- **method**: Method to check for updates in pages. Options: `file`, `folder`, `hash` and `none`. [more details](../../advanced/performance-and-caching#grav-core-caching)
* **driver**: Select a cache driver. Options are: `auto`, `file`, `apc`, `xcache`, `redis`, `memcache`, and `wincache`.
* **prefix**: Cache prefix string (prevents cache conflicts). Example: `g`.
* **clear_images_by_default**: By default grav will include processed images in cache clear, this can be disabled
* **clear_images_by_default**: By default grav will include processed images when cache clears, this can be disabled by setting this to `false`
* **cli_compatibility**: Ensures only non-volatile drivers are used (file, redis, memcache, etc.)
* **lifetime**: Lifetime of cached data in seconds (`0` = infinite). `604800` is 7 days.
* **gzip**: GZip compress the page output. Can be set to `true` or `false`.
Expand Down
10 changes: 9 additions & 1 deletion pages/02.content/02.headers/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,19 @@ Optional field, but can provide a date to automatically trigger publication. Val
### Expires

```ruby
Expires: 604800
expires: 604800
```

Page expires time in seconds (604800 seconds = 7 days) (`no cache` is also possible).

### Cache-control

```ruby
cache_control: max-age=604800
```

Can be blank for no setting, or a [valid](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) `cache-control` text value

### Unpublish Date

```ruby
Expand Down
20 changes: 15 additions & 5 deletions pages/02.content/03.collections/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,7 @@ Each level in the hierarchy adds two whitespaces before the variable. YAML will

### Complex Collections

With Grav **0.9.41** you can now provide multiple complex collection definitions and the resulting collection will be the sum of all the pages found from each of the collection definitions.

for example:
You can also provide multiple complex collection definitions and the resulting collection will be the sum of all the pages found from each of the collection definitions. For example:

```ruby
content:
Expand All @@ -264,6 +262,16 @@ content:
category: [blog, featured]
```

Additionally, you can filter the collection by using `filter: type: value`. The type can be any of the following: `published`, `non-published`, `visible`, `non-visible`, `modular`, `non-modular`, `routable`, `non-routable`, `type`, `types`, `access`. These correspond to the [Collection-specific methods](#collection-object-methods), and you can use several to filter your collection. They are all either `true` or `false`, except for `type` which takes a single template-name, `types` which takes an array of template-names, and `access` which takes an array of access-levels. For example:

```ruby
content:
items: '@self.siblings'
filter:
published: true
type: 'blog'
```

### Ordering Options

```ruby
Expand Down Expand Up @@ -372,6 +380,7 @@ Also has several useful Collection-specific methods:
* `Collection::key()` - Returns the current slug of the the current item
* `Collection::remove($path)` - Removes a specific page in the collection, or current if `$path = null`
* `Collection::order($by, $dir, $manual)` - Orders the current collection
* `Collection::intersect` - Merge two collections, keeping items that occur in both collections (like an "AND" condition)
* `Collection::isFirst($path)` - Determines if the page identified by path is first
* `Collection::isLast($path)` - Determines if the page identified by path is last
* `Collection::prevSibling($path)` - Returns the previous sibling page if possible
Expand All @@ -380,7 +389,8 @@ Also has several useful Collection-specific methods:
* `Collection::dateRange($startDate, $endDate, $field)` - Filters the current collection with dates
* `Collection::visible()` - Filters the current collection to include only visible pages
* `Collection::nonVisible()` - Filters the current collection to include only non-visible pages
* `Collection::modular()` - Filters the current collection to include only modular pages
* `Collection::merge()` - Merge two collections, keeping items that occur in either collection (like an "OR" condition)
* `Collection::modular()` - Filters the current collection to include only modular pages
* `Collection::nonModular()` - Filters the current collection to include only non-modular pages
* `Collection::published()` - Filters the current collection to include only published pages
* `Collection::nonPublished()` - Filters the current collection to include only non-published pages
Expand Down Expand Up @@ -442,7 +452,7 @@ foreach ($collection as $page) {
}
```

You can also use the same `evaluate()` method that the frontmatter-based page collections make use of:
The `order()`-function can also, in addition to the `by`- and `dir`-parameters, take a `manual`- and `sort_flags`-parameter. These are [documented above](#ordering-options). You can also use the same `evaluate()` method that the frontmatter-based page collections make use of:

```
$page = Grav::instance()['page'];
Expand Down
12 changes: 5 additions & 7 deletions pages/03.themes/04.twig-filters-functions/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,19 +430,17 @@ Similar to evaluate, but will evaluate and process with Twig

##### EXIF

Output a the EXIF data on an image base on it's filepath. This requires that `media.auto_metadata_exif:` is enabled in `system.yaml`
Output the EXIF data from an image based on its filepath. This requires that `media: auto_metadata_exif: true` is set in `system.yaml`. For example, in a Twig-template:

```
{% verbatim %}
{% set image = page.find('/content/media').media['sample-image.jpg'] %}
{% set data = exif(image.filepath, true) %}
{{ print_r(data)}}
{% set image = page.media['sample-image.jpg'] %}
{% set exif = exif(image.filepath, true) %}
{{ exif.MaxApertureValue }}
{% endverbatim %}
```


{% set data = exif(image.filepath, false) %}
Outputs **{{ dump(data)}}**
This would write the `MaxApertureValue`-value set in the camera, for example "40/10". You can always use `{% verbatim %}{{ dump(exif)}}{% endverbatim %}` to show all the available data in the debugger.

##### Get Cookie

Expand Down
2 changes: 2 additions & 0 deletions pages/10.cookbook/01.general-recipes/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ Basically, this extends the standard `partials/base.html.twig` (assuming your th

The next section simply loops over all the media of the page that are **images**. We are outputting these in an unordered list to make the output semantic, and easy to style with CSS. we are assigning each image the variable name `image` and then we are able to perform a simple `cropResize()` method to resize the image to something suitable, and then below it, we provide an information section with the `title` and `description`.

You could make a more advanced gallery-implementation by using creating filters for camera-data, with the [EXIF](/themes/twig-filters-functions#exif)-function.

### Render content in columns

##### Problem:
Expand Down