blogcard shortcode

Published

September 14, 2024

The blogcard shortcode makes it easy to create a card-like link.

Instalation

To use the blogcard extension in your Quarto project, run this command in the terminal from the project’s working directory. This will install the extension under the _extensions subdirectory.

quarto add t-arae/blogcard

Then, apply the blogcard filter by adding the following lines to the YAML header of your .qmd file.

filters:
  - t-arae/blogcard

Basic usage

To create a card using the blogcard shortcode, write the shortcode directive like this:

{{< blogcard https://quarto.org >}}
Quarto

An open source technical publishing system for creating beautiful articles, websites, blogs, books, slides, and more. Supports Python, R, Julia, and JavaScript.

https://quarto.org

The first argument of the blogcard shortcode will be used as the URL.

You can also pass the URL through the keyword argument, like this:

{{< blogcard url=https://quarto.org >}}
or 
{{< blogcard url="https://quarto.org" >}}
Quarto

An open source technical publishing system for creating beautiful articles, websites, blogs, books, slides, and more. Supports Python, R, Julia, and JavaScript.

https://quarto.org

Template selection

You can select a template using the tname attribute:

{{< blogcard https://quarto.org tname="mini" >}}

When no open graph protocol tags are found

The blogcard shortcode uses the content of <meta> tag containing the Open Graph Protocol (OGP) to create a card-like link. If no OGP content is found (or if it fails to retrieve the HTML content), it generates a simple card.

{{< blogcard https://example.com >}}

https://example.com

Manually set the data

You can also set the content manually using keyword arguments:

{{< blogcard https://example.com title="This is title" description="No description" image="https://via.placeholder.com/300x200" >}}
This is title

No description

https://example.com