The template:list
enables a very flexible way to add content from a list YAML list. This parses a local data file, gives you access to the list (specified by the path
) and then loops over the content using Jinja style templates (see Nunjucks docs for syntax).
For example, if you have a series of blog articles, people or news, you might have a simple YAML file like:
news:
- title: Launch of Elemental Microscopy covered in Nature
url: https://www.nature.com/articles/d41586-024-02577-1
date: August 2024
image: https://media.nature.com/lw767/magazine-assets/d41586-024-02577-1/d41586-024-02577-1_27432946.jpg
description: |
Elemental Microscopy, a publication focused on reviews and methods tutorials, leverages an authoring and
publishing platform called Curvenote to create rich, interactive, digital papers
with coding and data analysis at their heart.
tags:
- journal
- interactive
- title: Curvenote Sponsors SciPy 2024 and supports the SciPy Proceedings
url: https://curvenote.com/news/curvenote-sponsors-scipy-proceedings-2024
date: April 8, 2024
image: ./images/scipy-2024-thumbnail.webp
description: |
Curvenote is hosting the SciPy proceedings and is a Gold-level sponsor of the SciPy 2024 conference.
The new proceedings, hosted by Curvenote, are web-first and interactive.
Curvenote is supporting the 2024 proceedings from automated submission, through to hosting and
metadata preparation including submission to scholarly infrastructure providers like CrossRef and ORCID.
tags:
- conference
- community
List of Items¶
The default for the template:list
is a bullet list, and for example, you can show the title using {{ title }}
:
::::{template:list} news.yml
:path: news
{{ title }}
::::
Which creates:
Launch of Elemental Microscopy covered in Nature
Curvenote Sponsors SciPy 2024 and supports the SciPy Proceedings
The available template options that you can use are the ones that are defined in your object. If something is not available in all objects, use the {% if date %}{{ date }}{% endif %}
syntax.
List of Links¶
A slightly more complicated example, might limit
the number of elements shown, puts the title in a markdown link ([title](url)
) and adds an optional date. In this example, there is also a different final element to see more news. You can add whatever markdown you wish, it is parsed as normal!
::::{template:list} news.yml
:limit: 3
:last: [More News](https://curvenote.com/news) ...
:path: news
[{{title}}{% if date %} - [{{date}}]{% endif %}]({{url}})
::::
Which creates:
Launch of Elemental Microscopy covered in Nature - [August 2024]
Curvenote Sponsors SciPy 2024 and supports the SciPy Proceedings - [April 8, 2024]
More News ...
List of Blogs¶
You can also change the parent
element that is used, away from a list item and into, for example, grid
. If you want to supply options to that parent element, you can use JSON and it will be used as the AST directly. In this case we are using that grid with each child being rendered as a card:blog
to show a appealing blog-like list of cards.
::::{template:list} news.yml
:path: news
:parent: {"type": "grid", "columns": [1,2,2,2]}
:::{card:blog} {{title}}
:link: {{url}}
:image: {{image}}
:date: {% if date %}{{date}}{% endif %}
:tags: {% if tags %}{{tags.join(',')}}{% endif %}
{% if description -%}{{description}}{%- endif %}
:::
::::
Elemental Microscopy, a publication focused on reviews and methods tutorials, leverages an authoring and publishing platform called Curvenote to create rich, interactive, digital papers with coding and data analysis at their heart.
Curvenote is hosting the SciPy proceedings and is a Gold-level sponsor of the SciPy 2024 conference. The new proceedings, hosted by Curvenote, are web-first and interactive. Curvenote is supporting the 2024 proceedings from automated submission, through to hosting and metadata preparation including submission to scholarly infrastructure providers like CrossRef and ORCID.