more updates to children shortcode

pull/819/head
Scott Anderson 2020-03-11 11:21:49 -06:00
parent e2581d0ba3
commit eb8fcbfdfa
2 changed files with 8 additions and 3 deletions

View File

@ -73,6 +73,7 @@ related: # Creates links to specific internal and external content at the bottom
- /path/to/related/article
- https://external-link.com, This is an external link
external_url: # Used in children shortcode type="list" for page links that are external
list_image: # Image included with article descriptions in children type="articles" shortcode
list_note: # Used in children shortcode type="list" to add a small note next to listed links
```
@ -413,7 +414,8 @@ The following table shows which children types use which frontmatter properties:
|:----------- |:--------:|:----:|:---------:|
| `list_title` | ✓ | ✓ | ✓ |
| `description` | ✓ | | |
| `external_url` | | ✓ | |
| `external_url` | ✓ | ✓ | |
| `list_image` | ✓ | | |
| `list_note` | | ✓ | |
### Inline icons

View File

@ -15,7 +15,10 @@
{{ if eq $type "articles" }}
{{ range $pages.ByWeight }}
<h3><a href="{{ .RelPermalink }}" >{{ if .Params.list_title }}{{ .Params.list_title }}{{ else }}{{ .Title }}{{ end }}</a></h3>
{{ $title := cond ( isset .Params "list_title" ) .Params.list_title .Title }}
{{ $url := cond ( isset .Params "external_url" ) .Params.external_url .RelPermalink }}
{{ $target := cond ( isset .Params "external_url" ) "_blank" "" }}
<h3><a href="{{ $url }}" target="{{ $target }}">{{ $title }}</a></h3>
<p>
{{- if .Description }}{{- .Description | markdownify -}}
{{ else }}{{- .Summary | markdownify -}}
@ -51,7 +54,7 @@
{{ $url := cond ( isset .Params "external_url" ) .Params.external_url .RelPermalink }}
{{ $target := cond ( isset .Params "external_url" ) "_blank" "" }}
{{ $note := cond ( isset .Params "list_note" ) (print "<span class='list-note'>" .Params.list_note "</span>") "" }}
<li><a href="{{ $url }}">{{ $title }}</a> {{ $note | markdownify }}</li>
<li><a href="{{ $url }}" target="{{ $target }}">{{ $title }}</a> {{ $note | markdownify }}</li>
{{ end }}
<ul>