Skip to content

Commit 7c0cd4b

Browse files
alianzaascorbickodiakhq[bot]
authored
chore: improve docs ISR with local files (#1353)
* Update isr.md Added additional documentation for Incremental Static Regeneration with local data. See #1252 for an example * Update docs/isr.md Co-authored-by: Matt Kane <[email protected]> * Update docs/isr.md Co-authored-by: Matt Kane <[email protected]> * Update docs/isr.md Co-authored-by: Matt Kane <[email protected]> Co-authored-by: Matt Kane <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent ec5ce76 commit 7c0cd4b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/isr.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,28 @@ request is made for stale content, the page will be regenerated in the backgroun
2121
but it can take up to 60 seconds before the new content is then updated in all CDN nodes if they already had a cached
2222
copy.
2323

24+
If the static regeneration relies on local files in your repository they need to be bundled with the handler functions.
25+
This can be done by modifying your [file based configuration](https://docs.netlify.com/configure-builds/file-based-configuration).
26+
An entry to the `included_files` option needs to be added under the `functions` option. You should be careful to not include unnecessary files, particularly large files such as images or videos, because there is a 50MB size limit for each handler function.
27+
See [Functions Configuration Docs](https://docs.netlify.com/configure-builds/file-based-configuration/#functions) for more info.
28+
Update your `netlify.toml` file to include the following (assuming local content is located in the /content directory):
29+
```toml
30+
[functions]
31+
included_files = ["content/**"]
32+
```
33+
34+
If you only need the content for DSG pages, then you can target only that function like this:
35+
36+
```toml
37+
[functions.__dsg]
38+
included_files = ["content/**"]
39+
```
40+
or, for SSR pages:
41+
42+
```toml
43+
[functions.__ssr]
44+
included_files = ["content/**"]
45+
```
2446
If a new deploy is made, all persisted pages and CDN cached pages will be invalidated so that conflicts are avoided. If
2547
this did not happen, a stale HTML page might make a request for an asset that no longer exists in the new deploy. By
2648
invalidating all persisted pages, you can be confident that this will never happen and that deploys remain atomic.

0 commit comments

Comments
 (0)