diff --git a/exampleSite/data/properties/demo.yaml b/exampleSite/data/properties/demo.yaml new file mode 100644 index 0000000..ea21dfc --- /dev/null +++ b/exampleSite/data/properties/demo.yaml @@ -0,0 +1,32 @@ +--- +properties: + - name: prop1 + type: string + description: Dummy description of the prop1 string property. + required: true + + - name: prop2 + type: int + defaultValue: 10 + description: Another description for the integer property called prop2. + required: false + tags: + - tag1 + - tag2 + + - name: prop3 + type: bool + defaultValue: false + description: | + A `bool` property with a complex multiline description and embedded Markdown: + + - List item 1 + - List item 2 + + More description how to use this property. + required: false + + - name: a-prop + type: string + description: Property to demonstrate sorting. + required: true diff --git a/exampleSite/data/properties/shortcode-propertylist.yaml b/exampleSite/data/properties/shortcode-propertylist.yaml new file mode 100644 index 0000000..4fe0fb2 --- /dev/null +++ b/exampleSite/data/properties/shortcode-propertylist.yaml @@ -0,0 +1,15 @@ +--- +properties: + - name: name + type: string + description: Name of the file from the `data/properties/` directory. + required: true + - name: sort + type: string + description: Field name to use for sorting. + required: false + - name: order + type: string + description: Sort order, only applied if `sort` is set. Supported values are `asc|desc`. + required: false + defaultValue: asc diff --git a/layouts/shortcodes/propertylist.html b/layouts/shortcodes/propertylist.html new file mode 100644 index 0000000..090e941 --- /dev/null +++ b/layouts/shortcodes/propertylist.html @@ -0,0 +1,52 @@ +{{- $name := .Get "name" -}} +{{- $sort := .Get "sort" -}} +{{- $order := default "asc" (.Get "order") -}} +{{- $showAnchor := (and (default true .Page.Params.geekblogAnchor) (default true .Page.Site.Params.geekblogAnchor)) -}} + +{{- if .Site.Data.properties }} +