diff --git a/_data/theme.yml b/_data/theme.yml index f48c31c2..53f2f5ca 100644 --- a/_data/theme.yml +++ b/_data/theme.yml @@ -112,6 +112,7 @@ font-cdn: # add font stylesheet, e.g. {%- assign icon_template = child.display_template | default: item.format -%} - + {{ child.title | escape }} - {{ child.format }} {% endif %} diff --git a/_includes/item/child/item-thumb.html b/_includes/item/child/item-thumb.html index 74ac59cd..22432be8 100644 --- a/_includes/item/child/item-thumb.html +++ b/_includes/item/child/item-thumb.html @@ -9,7 +9,7 @@ {% else %} {{ child.title | escape }} - {{ child.format }} {% endif %} diff --git a/_includes/item/item-markdown.html b/_includes/item/item-markdown.html new file mode 100644 index 00000000..ff183d4c --- /dev/null +++ b/_includes/item/item-markdown.html @@ -0,0 +1,22 @@ +{% comment %} + + Display the contents of object_location using markdownify. + +{% endcomment %} + +{% if page.object_location %} +
+
+ {% assign object_type = page.object_location | slice: 0,1 %} + {% if object_type == '/' %} + {% assign object_location = page.object_location | remove_first: '/' %} + {% assign object = site.pages | where: 'path', object_location | first %} + {{ object.content | markdownify }} + {% else %} + {{ page.object_location | markdownify }} + {% endif %} +
+
+ {{ page.title | escape }} - {{ page.format }} +{% endif %} + diff --git a/_includes/item/item-thumb.html b/_includes/item/item-thumb.html index f70d3d92..4a6cbbfd 100644 --- a/_includes/item/item-thumb.html +++ b/_includes/item/item-thumb.html @@ -9,7 +9,7 @@ {% else %} {{ page.title | escape }} - {{ page.format }} {% endif %} diff --git a/_layouts/item/markdown.html b/_layouts/item/markdown.html new file mode 100644 index 00000000..ce1baa6e --- /dev/null +++ b/_layouts/item/markdown.html @@ -0,0 +1,22 @@ +--- +# derived from item.html, for objects with `display_template` of "markdown" +# displays object_location content in Markdown form +layout: item/item-page-base +--- + + +
+
+ +

+ {% include item/item-markdown.html %} +

+
+ + {% include item/download-buttons.html %} + +
+ +
+
+ diff --git a/_layouts/timeline.html b/_layouts/timeline.html index 5889f3b7..f903f660 100644 --- a/_layouts/timeline.html +++ b/_layouts/timeline.html @@ -58,7 +58,7 @@

{{ year }}

{{ item.title }}
diff --git a/_plugins/cb_helpers.rb b/_plugins/cb_helpers.rb index 645ccbd9..a69bb8e0 100644 --- a/_plugins/cb_helpers.rb +++ b/_plugins/cb_helpers.rb @@ -130,6 +130,9 @@ def generate(site) if !theme_icons['icon-record'] theme_icons['icon-record'] = "file-text" end + if !theme_icons['icon-markdown'] + theme_icons['icon-markdown'] = "filetype-md" + end if !theme_icons['icon-panorama'] theme_icons['icon-panorama'] = "image-alt" end diff --git a/docs/icons.md b/docs/icons.md index 2d13f1ef..f98497a2 100644 --- a/docs/icons.md +++ b/docs/icons.md @@ -68,6 +68,7 @@ icons: icon-pdf: file-pdf icon-record: file-text icon-panorama: image-alt + icon-markdown: filetype-md icon-compound-object: collection icon-multiple: postcard icon-default: file-earmark # fall back icon diff --git a/docs/item_pages.md b/docs/item_pages.md index 678c41d2..5afa5b4a 100644 --- a/docs/item_pages.md +++ b/docs/item_pages.md @@ -18,7 +18,7 @@ Look for comments in each layout's front matter for information. Each display_template layout is typically constructed of modular item page components (found in "_includes/item/") and arranged using Bootstrap. This simplifies customization and creation of different item pages depending on collection needs. -Default supported options include: `image`,`pdf`, `video`, `audio`, `panorama`, `record`, `item`, `multiple`, and `compound_object`. +Default supported options include: `image`,`pdf`, `video`, `audio`, `panorama`, `record`, `item`, `markdown`, `multiple`, and `compound_object`. - `image`: Displays image_small if available, with fall back to object_location. Adds gallery view to open images full screen using object_location, with fall back to image_small. - `pdf`: Displays image_small if available, with fall back to image_thumb, or a pdf icon. @@ -27,6 +27,7 @@ Default supported options include: `image`,`pdf`, `video`, `audio`, `panorama`, - `panorama`: a 360 degree image. Item pages will use the Javascript based panorama viewer, [Panellum](https://pannellum.org/) to display the image in a 360 degree view. - `record`: metadata only record. - `item`: generic fallback item page, displays image or icon depending on "image_thumb" +- `markdown`: Uses "markdownify" template function to display the contents of a valid [Markdown](https://en.wikipedia.org/wiki/Markdown) document - `compound_object`: a record for a object that includes multiple file instances that are described/managed separately in the metadata. Compound objects use their own set of conventions, see "docs/compound_objects.md" for details. - `multiple`: a record for a object that includes multiple images (such as a postcard) that are listed separately in the metadata. Multiples use their own set of conventions, see "docs/compound_objects.md" for details. diff --git a/docs/metadata.md b/docs/metadata.md index 73dc2d45..3735ba81 100644 --- a/docs/metadata.md +++ b/docs/metadata.md @@ -36,5 +36,5 @@ Do not include the `baseurl` value that you set in "_config.yml", since this wil ## Display Template -- `display_template`: a template type used in logic to set up different Item page features. If blank the object will default to a generic item page. Default supported options: `image`,`pdf`, `video`, `audio`, `panorama`, `record`, `item`, `multiple`, and `compound_object`. See docs/item-pages.md for details. +- `display_template`: a template type used in logic to set up different Item page features. If blank the object will default to a generic item page. Default supported options: `image`,`pdf`, `video`, `audio`, `panorama`, `record`, `item`, `markdown`, `multiple`, and `compound_object`. See docs/item-pages.md for details. - `parentid`: used to designate child items in the "multiple" and "compound_object" templates, a unique string matching the objectid of the parent item. See docs/compound_objects.md for details.