diff --git a/wowchemy/layouts/index.json b/wowchemy/layouts/index.json index 99627fb0..f80568d2 100644 --- a/wowchemy/layouts/index.json +++ b/wowchemy/layouts/index.json @@ -52,8 +52,10 @@ {{- end -}} {{- /* Add page to index. */ -}} - {{- $index = $index | append (dict "objectID" .File.UniqueID "date" .Date.UTC.Unix "publishdate" .PublishDate "lastmod" .Lastmod.UTC.Unix "expirydate" .ExpiryDate.UTC.Unix "lang" .Lang "permalink" $permalink "relpermalink" $rel_permalink "title" $title "summary" (plainify $desc | htmlUnescape) "content" (.Plain | htmlUnescape | truncate 5000) "authors" $authors "kind" .Kind "type" .Type "section" .Section "tags" .Params.Tags "categories" .Params.Categories) -}} - + {{/* Exclude virtual pages which aren't backed by a file */}} + {{ if .File }} + {{- $index = $index | append (dict "objectID" .File.UniqueID "date" .Date.UTC.Unix "publishdate" .PublishDate "lastmod" .Lastmod.UTC.Unix "expirydate" .ExpiryDate.UTC.Unix "lang" .Lang "permalink" $permalink "relpermalink" $rel_permalink "title" $title "summary" (plainify $desc | htmlUnescape) "content" (.Plain | htmlUnescape | truncate 5000) "authors" $authors "kind" .Kind "type" .Type "section" .Section "tags" .Params.Tags "categories" .Params.Categories) -}} + {{ end }} {{- end -}} {{- end -}} diff --git a/wowchemy/layouts/partials/book_layout.html b/wowchemy/layouts/partials/book_layout.html index fe5e9d30..cfe43485 100644 --- a/wowchemy/layouts/partials/book_layout.html +++ b/wowchemy/layouts/partials/book_layout.html @@ -59,10 +59,25 @@ {{end}}
-

{{ .Title }}

+ {{/* Fallback to filename as title (useful for default Obsidian note structure) */}} +

{{ cond (ne .File nil) (.Title | default (title .File.ContentBaseName)) .Title }}

+ + {{/* Only auto-list page children if _index has no content (or if it isn't a .File?) */}} + {{ if and (not .Content) (gt (len $.Page.Pages) 0) }} + + {{end}} + {{ .Content }} +
{{ partial "tags.html" . }} diff --git a/wowchemy/layouts/partials/book_menu.html b/wowchemy/layouts/partials/book_menu.html index 9308f512..3e5f58f8 100644 --- a/wowchemy/layouts/partials/book_menu.html +++ b/wowchemy/layouts/partials/book_menu.html @@ -35,10 +35,10 @@ {{ if $first }}