### Bug description

This bug requires a bit of setup, so I've included a zip file with a reprex website: [reprex-website.zip](https://github.com/quarto-dev/quarto-cli/files/10365861/reprex-website.zip).

## Terminology

I'm using the term "series" to refer to a listing page that lists listing pages. The latter listing pages list posts which are related to each other by some topic.

This works really great by the way; you can even add a sidebar to get navigation between the posts in the series (almost like a lighter version of the book format inside a website).

## Bug description

I want to add citations to the posts inside a series with a citation style that includes the post URL by setting `citation: true` and the appropriate CSL. However, when I do this, the URLs for the posts are incorrect.

For example, say my `site-url` is `https://reprex.com`. I have a series called `my-awesome-series` and a post in that series is called `a-first-post`. The URL to this post is `https://reprex.com/series/my-awesome-series/posts/first-post.html`. **This should be the URL included in the post citation**. Instead, the URL in the citation thinks the post is located in the root directory of the site: `https://reprex.com/first-post.html`.

Site navigation works fine, so it's just the citation URL that seems to be the issue.

## How to reproduce

Using the reprex site, you can preview the site to see the bug. From the home page, click the "My awesome series" post, then click either of the two posts there and see the URL at the end of the citation at the bottom of the page. If you compare that to the URL in the browser, you can see it's ignoring the nesting structure of the site.

### Checklist

- [X] Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- [X] Please [format your issue](https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us) so it is easier for us to read the bug report.
- [ ] Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [ ] Please document the operating system you're running. If on Linux, please provide the specific distribution.
dragonstyle
2023-01-07T09:30:18Z
mccarthy-m-g
bug
v1.3
closed
Citation URLs are wrong in posts of nested listing pages when `citation: true`
https://github.com/quarto-dev/quarto-cli/issues/3881