How do you place listing location in Quarto blog?

The default placement of listing is in the home page. I read in the documentation that you can set id, then use that id in div to other page to place a copy of that listing, is this right?
id
a

But the listing doesn't show up anywhere. I want to place it on the side, like navigation menu, but not navigation menu, just listing of the posts available. What did I do wrong? What should I do?

That is definitely the general idea - I'm not sure why it isn't working. could you share the contents of the qmd file that you're using? I should be able to get things going if I can see that...

this is the qmd from the main page listing:

---
title: ""
listing:
  id: main-listing
  contents: posts
  sort: "date desc"
  type: default
  categories: true
  sort-ui: false
  filter-ui: false
page-layout: full
title-block-banner: false
---

this is the qmd from the blogpost:

---
title: "Greetings!"
author: "Husada"
date: "2022-09-19"
categories: [blog, cat]
title-block-banner: false
page-layout: article
---

Ahoy\~!,

I had been wondering for a while whether or not to start a blog. I thought a simple [ShinyApp](https://8k2lvx-sasmito0yudha-husada.shinyapps.io/syh_cv/ "my portfolio") is sufficient as portfolio to help my transition into data science.

So far it's not enough and I rarely update that anyway. There are several new projects I've done but not updated in that ShinyApp. I will update it in bulk, later.

Meanwhile, here I am starting a blogging journey with quarto.

Here's a picture of my cat for your wasted time reading this post:

![](bleki.jpg){fig-align="center"}

::: {#main-listing}
:::

I'm not 100% sure what the layout you're trying to accomplish, but the div-id is used to target where on the listing page the listing appears. For example:

---
title: ""
listing:
  id: main-listing
  contents: posts
  sort: "date desc"
  type: default
  categories: true
  sort-ui: false
  filter-ui: false
page-layout: full
title-block-banner: false
---

## Here is my listing

:::{#main-listing}
:::

## This is a heading

And where is some content

This is useful if you'd like place your listing not at the bottom of the content / page, but instead would like to position it very specifically.

If you'd like to move the listing to another page, just create another qmd file with the listing metadata in it and it will populate that page. e.g. blog.qmd which contains:

---
title: ""
listing:
  id: main-listing
  contents: posts
  sort: "date desc"
  type: default
  categories: true
  sort-ui: false
  filter-ui: false
page-layout: full
title-block-banner: false
---

HTH!

1 Like

So, I misunderstood.
Do I have to add listing in every YAML of the blog post,
then use the div-id to place its location on the blog
post,
so if I didn't include listing in the YAML of the blog post, the listing won't show up on that post?

I thought once a listing was declared in the main qmd of the site with an id, then I could use that id on various blogpost with on different qmd.

Am I understanding it right, now? Or is there anything I still miss?

I'm not 100% sure, but I think there is still some confusion. The only role of the 'id' for a listing is to position the listing contents (a table, grid, or default layout) on the listing page itself. By default, we just place that in the body of the page, but you can use the id + div to position it yourself (on the listing page itself).

If you are trying to control which blogs posts appear in which listing, you do this using the contents property of a listing. This is a path (or glob) that points to which documents should be included.

The example is contents: posts which is saying to find all the qmd files within the posts directory and make a listing of those.

Does that help?

I am following the conversation between @Husada_x_Hertzsprung and @cteague with interest.
I also have problems trying to create a 'listing' .
I can do that only on the index.qmd or about.qmd pages and probably on other potential pages at the same level.
However if I create two such listings on a page the count of the categories is doubled (bug?).
When I create a 'listing' in a blog entry post, I get no error or warning messages, but the listing is not filled with the blog entry information as e.g. in the index.qmd .

I conclude that listings of posts can not be created in a post (??)

You should be to create a listing (or any number of listings) on any page. You will need to adjust the contents to provide a path or list of paths that you'd like to include in the listing. If you copy and paste the exact listing from the root level page, leaving the contents: posts and place that in a post, the listing on the post page will be populated using any documents in a posts subdirectory of the blog post directory (which doesn't exist).

Read more about contents here:

The category count is reflecting the fact that each item appears on the page twice, so when you click the link to view the posts that match a specific category, the current page will show each item twice (hence the doubling of the categories).

Thanks @cteague ,
it works for me now, after correcting contents: posts to

contents: 
      - "../*/*.qmd"

The structure of my posts is identical to the one generated by RStudio when a new Quatro Blog project is requested: each post in its own subfolder of posts .

Concerning the category count: that works fine when the posts are not repeated over the listings.
In many case that will work fine: reports of type X or Y or Z. But even then it can be confusing e.g. when the listings are separated by text,
When the listings are overlapping (e.g. listing of reports of continents and countries) the numbers are simply wrong.
The category count as explained by @cteague is a property of the page and not of the (first) listing it is printed near to.
I think it shows that the category count was developed before multiple listings on a page were introduced.

EDIT: for some (good) reason the post where the listing is produced is not included in the list.

I'm not sure that it's correct to say that the category count is wrong.

When a user clicks the category to filter the listings on the page, and the same content appeared in both listings, the number of items showed on the page after filtering would match the number of items showed next to the categories. I understand there is a sense in which one might expect the categories to count unique documents, but of course that could cause confusion in the other direction, in which the count of categories shows a number, but when a user clicks to view the categories, there are twice as many items visible on the page.

We developed the category support after we developed support for multiple listings - the question was more about a choice of what the correct behavior is given that one set of categories are shown for all listings on the page.

We intentionally exclude the listing source document from the listing itself even when it matches the contents glob :slight_smile: ...