-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Use more standard hook names: - head-start - head-end - body-end - footer-start - toc-start - toc-end 2. Enable multiple files per hook. For example, a starter template may have `hooks/head-end/tpl.html` and a user may have customizations in `hooks/head-end/user.html` custom_head.html -> hooks/head-end/custom.html custom_js.html -> hooks/body-end/custom.html Deprecates custom_head.html and custom_js.html but they remain supported for now.
- Loading branch information
Showing
10 changed files
with
231 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{{/* Function to inject custom code into layouts without overriding files. */}} | ||
{{/* Input: hook folder name (str) */}} | ||
{{/* Output: loaded (bool) */}} | ||
|
||
{{ $loaded := false }} | ||
{{ $partial_dir := printf "hooks/%s/" .hook }} | ||
{{ $hook_dir_path := path.Join "layouts/partials" $partial_dir }} | ||
{{ if fileExists $hook_dir_path }} | ||
{{ range os.ReadDir $hook_dir_path }} | ||
{{ if not .IsDir }} | ||
{{ $partial_path := path.Join $partial_dir .Name }} | ||
{{ partial $partial_path . }} | ||
{{ $loaded = true }} | ||
{{ end }} | ||
{{ end }} | ||
{{ end }} | ||
{{/* The return statement below is for debug purposes only and prevents the above partial(s) being included in the page */}} | ||
{{/* return $loaded */}} |
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.