Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asset Colocation Doesn't Respect Slug #1566

Closed
sstelfox opened this issue Jul 29, 2021 · 1 comment
Closed

Asset Colocation Doesn't Respect Slug #1566

sstelfox opened this issue Jul 29, 2021 · 1 comment
Labels
bug done in pr Already done in a PR

Comments

@sstelfox
Copy link

sstelfox commented Jul 29, 2021

Bug Report

Environment

Zola version: 0.14.0 (using the container docker.io/balthek/zola:0.14.0)

Expected Behavior

I'm migrating old articles and posts from another site which used UUIDs as the slug equivalent (it's awful I know). I've been organizing the posts in a way that Zola is expecting like so:

content/
|-- articles/
|---- 2020-07-29-sample-article.md

Adding a slug key in the top of slug: 2cd1b34b-64a5-4f9c-8ce4-fab586ec2b88 gives me the behavior I expect with a resulting URL looking like /articles/2cd1b34b-64a5-4f9c-8ce4-fab586ec2b88/. I've started going back through and trying to co-locate the assets along with the articles. This involves changing the directory structure above to the following:

content/
|-- articles/
|---- 2020-07-29-sample-article/
|------ _index.md

I would expect that this change alone to have no effect.

Current Behavior

I'm not receiving any errors but the change to the directory structure results in the path to the article changing to /articles/2020-07-29-sample-article/. At the very least I'd expect the behavior to match the normal post slug re-naming behavior that removes the date prefix (which would result in /articles/sample-article/.

Step to reproduce

I wrote a script that shows this behavior here: https://gist.github.com/sstelfox/dae8d0aa225e7c784e0f347d700c6b41

Running that right now will produce the following output:

$ ./reproduce.sh 
.
├── reproduce.sh
└── test_site
    ├── config.toml
    ├── content
    │   ├── articles
    │   │   ├── 2021-07-29-sample-article-1.md
    │   │   └── 2021-07-29-sample-article-2
    │   │       └── _index.md
    │   └── _index.md
    ├── public
    │   ├── 404.html
    │   ├── articles
    │   │   ├── 2021-07-29-sample-article-2
    │   │   │   └── index.html
    │   │   └── c7637df2-530e-4bfc-9a97-1b5c93af62f5
    │   │       └── index.html
    │   ├── index.html
    │   ├── robots.txt
    │   └── sitemap.xml
    ├── static
    ├── templates
    │   ├── index.html
    │   ├── page.html
    │   └── section.html
    └── themes

11 directories, 14 files

The file test_site/public/articles/c7637df2-530e-4bfc-9a97-1b5c93af62f5/index.html is correct. The test_site/public/articles/2021-07-29-sample-article-2/index.html I expect to have the path test_site/public/articles/994f8c4c-4b52-44bd-b2d8-e5c26166f8d0/index.html or at least test_site/public/articles/sample-article-2/index.html.

@Keats Keats added the bug label Jul 30, 2021
Keats added a commit that referenced this issue Feb 11, 2023
@Keats Keats added the done in pr Already done in a PR label Feb 11, 2023
@Keats
Copy link
Collaborator

Keats commented Feb 11, 2023

Turns out it's not a bug, the file needs to be named index.md without the _ otherwise zola thinks its a section.

@Keats Keats closed this as completed in 0b31fc1 Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug done in pr Already done in a PR
Projects
None yet
Development

No branches or pull requests

2 participants