diff --git a/ox-hugo.el b/ox-hugo.el
index 5343d97..db48ccd 100644
--- a/ox-hugo.el
+++ b/ox-hugo.el
@@ -1025,12 +1025,21 @@ When optional argument LOCAL is non-nil, build a table of
contents according to the current headline."
(let* ((toc-headline
(unless local
- (format "\n
\n" ;This is a nasty workaround
- "
\n" ;till Hugo/Blackfriday support
- toc-headline ;wrapping Markdown in HTML div's.
+ (format "
\n"
+ (if local
+ (format " local level-%d" current-level)
+ ""))
+ "
\n" ;This is a nasty workaround till Hugo/Blackfriday support
+ toc-headline ;wrapping Markdown in HTML div's.
+ "\n"
toc-items ;https://github.com/kaushalmodi/ox-hugo/issues/93
"\n\n"
"
\n"
diff --git a/test/site/content-org/all-posts.org b/test/site/content-org/all-posts.org
index 7eaaf9a..cfc5c8b 100644
--- a/test/site/content-org/all-posts.org
+++ b/test/site/content-org/all-posts.org
@@ -4620,6 +4620,36 @@ This post should also be created in =content/section-a/=.
:END:
#+toc: headlines 6
#+include: "./all-posts.org::#nested-sections-example" :only-contents t
+*** TOC Local :local:
+:PROPERTIES:
+:EXPORT_FILE_NAME: toc-local
+:END:
+Below, TOC is exported with only level-1 headings in this post.
+#+toc: headlines 1
+**** Post sub-heading 1
+Below, TOC is exported with only level-1 headings *relative to* this
+"Post sub-heading 1" section.
+#+toc: headlines 1 local
+***** Post sub-heading 1.1
+****** Post sub-heading 1.1.1
+***** Post sub-heading 1.2
+***** Post sub-heading 1.3
+**** Post sub-heading 2
+***** Post sub-heading 2.1
+***** Post sub-heading 2.2
+Below, TOC is exported with only up to level-2 headings *relative to*
+this "Post sub-heading 2.2" section.
+#+toc: headlines 2 local
+****** Post sub-heading 2.2.1
+****** Post sub-heading 2.2.2
+****** Post sub-heading 2.2.3
+Below, TOC is exported with only level-1 headings *relative to* this
+"Post sub-heading 2.2.3" section.
+#+toc: headlines 1 local
+******* Post sub-heading 2.2.3.1
+******* Post sub-heading 2.2.3.2
+**** Post sub-heading 3
+***** Post sub-heading 3.1
* Pandoc Citations :pandoc:citations:
:PROPERTIES:
:EXPORT_HUGO_PANDOC_CITATIONS: t
diff --git a/test/site/content/posts/toc-local.md b/test/site/content/posts/toc-local.md
new file mode 100644
index 0000000..2725c98
--- /dev/null
+++ b/test/site/content/posts/toc-local.md
@@ -0,0 +1,104 @@
++++
+title = "TOC Local"
+tags = ["keyword", "toc", "local"]
+draft = false
++++
+
+Below, TOC is exported with only level-1 headings in this post.
+
+
+
+
+
Table of Contents
+
+- [Post sub-heading 1](#post-sub-heading-1)
+- [Post sub-heading 2](#post-sub-heading-2)
+- [Post sub-heading 3](#post-sub-heading-3)
+
+
+
+
+
+## Post sub-heading 1 {#post-sub-heading-1}
+
+Below, TOC is exported with only level-1 headings **relative to** this
+"Post sub-heading 1" section.
+
+
+
+
+- [Post sub-heading 1.1](#post-sub-heading-1-dot-1)
+- [Post sub-heading 1.2](#post-sub-heading-1-dot-2)
+- [Post sub-heading 1.3](#post-sub-heading-1-dot-3)
+
+
+
+
+
+### Post sub-heading 1.1 {#post-sub-heading-1-dot-1}
+
+
+#### Post sub-heading 1.1.1 {#post-sub-heading-1-dot-1-dot-1}
+
+
+### Post sub-heading 1.2 {#post-sub-heading-1-dot-2}
+
+
+### Post sub-heading 1.3 {#post-sub-heading-1-dot-3}
+
+
+## Post sub-heading 2 {#post-sub-heading-2}
+
+
+### Post sub-heading 2.1 {#post-sub-heading-2-dot-1}
+
+
+### Post sub-heading 2.2 {#post-sub-heading-2-dot-2}
+
+Below, TOC is exported with only up to level-2 headings **relative to**
+this "Post sub-heading 2.2" section.
+
+
+
+
+- [Post sub-heading 2.2.1](#post-sub-heading-2-dot-2-dot-1)
+- [Post sub-heading 2.2.2](#post-sub-heading-2-dot-2-dot-2)
+- [Post sub-heading 2.2.3](#post-sub-heading-2-dot-2-dot-3)
+ - [Post sub-heading 2.2.3.1](#post-sub-heading-2-dot-2-dot-3-dot-1)
+ - [Post sub-heading 2.2.3.2](#post-sub-heading-2-dot-2-dot-3-dot-2)
+
+
+
+
+
+#### Post sub-heading 2.2.1 {#post-sub-heading-2-dot-2-dot-1}
+
+
+#### Post sub-heading 2.2.2 {#post-sub-heading-2-dot-2-dot-2}
+
+
+#### Post sub-heading 2.2.3 {#post-sub-heading-2-dot-2-dot-3}
+
+Below, TOC is exported with only level-1 headings **relative to** this
+"Post sub-heading 2.2.3" section.
+
+
+
+
+- [Post sub-heading 2.2.3.1](#post-sub-heading-2-dot-2-dot-3-dot-1)
+- [Post sub-heading 2.2.3.2](#post-sub-heading-2-dot-2-dot-3-dot-2)
+
+
+
+
+
+##### Post sub-heading 2.2.3.1 {#post-sub-heading-2-dot-2-dot-3-dot-1}
+
+
+##### Post sub-heading 2.2.3.2 {#post-sub-heading-2-dot-2-dot-3-dot-2}
+
+
+## Post sub-heading 3 {#post-sub-heading-3}
+
+
+### Post sub-heading 3.1 {#post-sub-heading-3-dot-1}