ToC not rendering?

Hello,
I am using papermod theme and created the following post below. I have set UseHugoToc: true and ShowToc: true. However, no ToC is rendered. Any help appricated! Thank you.

---
title: "Making general recipe"
date: 2024-01-03
draft: false
UseHugoToc: true
ShowToc: true
tocopen: true
summary: "A brief tutorial on creating recipe"
categories: ["recipe"]
---


This article will provide a brief overview of recipe.

## Acquiring goods

In this step 1.

## Layering piles

In this step 2.

This article will provide a brief overview of pile.

# Acquiring goods

In this step 1.

## Layering piles

In this step 2.

I am unable to reproduce the problem.

hugo new site mysite
cd mysite
git init
git submodule add https://github.com/adityatelange/hugo-PaperMod themes/papermod
echo "theme = 'papermod'" >> hugo.toml
hugo new recipes/tutorial.md

Then I pasted your markdown and ran hugo server

Thank you for verifying. Not sure what else I can do?

If it helps, I am using papermod v7.0, hugo v0.111.3, PC.

You are more likely to receive a prompt and accurate response if you post a link to the public repository for your project.

See Requesting Help.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

Hello, I followed this blog for manually adding a TOC. It appears now it works.

(Hugo: Add Table of Contents Anywhere in Markdown File)

Hi,
I figured out the problem. My post was in content/articles/new_post/_index.md.

I just tried creating a new post in content/new_post.md and it works.

Can I someone configure hugo to use papermods ToC function in subfolders under content?

See Joe’s comment or ask the theme author because what you did by moving the content aound is just a patch, not a solution.

Also, I just learned that TOC does not work when file is named /content/articles/mynewpost/_index.md. _index.md should be any other name than _index.md.

The PaperMod theme renders a TOC for content with kind = page:
https://github.com/adityatelange/hugo-PaperMod/blob/master/layouts/_default/single.html#L34

The TOC partial is not called from any other template.

content/
├── posts/
│   ├── post-1/
│   │   └── index.md  <-- kind = page (toc enabled)
│   ├── _index.md     <-- kind = section
│   └── post-2.md     <-- kind = page (toc enabled)
└── _index.md         <-- kind = home

See this FAQ.

Please raise additional questions with the theme author.