Renaming content subdir makes `Serve` stop working?

I have a /content/loose_stuff directory in my Zola project that I want to mv loose_stuff/ posts/ but when I do so, zola serve stops working? I can fix it by just mv posts/ loose_stuff/ but I don’t want a loose_stuff directory hanging around permanently in my zola site.

I’ve tried:

  • reading over all my template and content files for any hardcoded links to loose_stuff but haven’t found any.
  • running zola check
  • zola build also stops working

Using Zola version 0.16.0
The terminal output says

Error: Failed to serve the site
Error: Failed to render page '/home/moffwings/Desktop/Projects/zola-site/content/home.md'
Error: Reason: Failed to render 'page.html' (error happened in a parent template)
Error: Reason: Function call 'get_url' failed
Error: Reason: `get_url`: could not resolve URL for link `@/loose_stuff/_index.md` not found.

Is a restart of zola serve working? In theory it should reload everything on changes but who knows

The problem persists through restarting zola serve and restarting my computer unfortunately.

Can you paste a tree output of the content dir? I’m not sure i’m getting it then

running tree from content dir

.
├── home.md
├── _index.md
└── posts
    ├── about zola.md
    ├── buffer.md
    └── _index.md

Well there’s no loose_stuff in that directory so that normal. In that case, you need to change your template to refer to @/posts/_index.md

Oof, I figured out what happened: It’s easy to miss hardcoded links to stuff like loose_stuff when you only manually look over your code.

Something that helped me is using a search tool like rg (ripgrep) with rg loose_stuff to find that I did have a hardcoded path to fix. :woozy_face:

1 Like

Created a login and joined to upvote this comment. “ripgrep” really helped to find out the loose end.

Used “relative paths” to images and “index.md” files instead of “@”, and things are working for me.

Thanks!