.Kind (page): .Type (posts) / .Layout ()
Bundle: n/a (regular page)
[ categories | tags | search ]
ox-hugo Test Site

This is the test site for the ox-hugo package for Emacs/Org-mode.

It is updated automatically after each commit to the ox-hugo repo. It was last updated on Mar 05, 2024 19:24 UTC.


This page was created/modified in commit 451d617 "Replace "--" with "-" in export Markdown files" on 2022-01-16.
Markdown source of this page

No TOC in Summary (with more comment marker)

tags: export-option toc summary endtoc more


Description/Summary

By default, Hugo will dump everything at the beginning of a post into its .Summary (See Hugo content summaries). As TOC enabled using the export option like toc:t is inserted at the beginning of a post, TOC will be shown in that summary too!

In this example, the special comment more is used.


Content

Table of Contents

By default, Hugo will dump everything at the beginning of a post into its .Summary (See Hugo content summaries). As TOC enabled using the export option like toc:t is inserted at the beginning of a post, TOC will be shown in that summary too!

In this example, the special comment more is used.

ox-hugo’s Solution #

ox-hugo helps prevent that with a workaround.. it inserts a special HTML comment <!--endtoc--> after the TOC.

Snippet #

As the more comment is present, the summary_minus_toc.html partial used for this test site ensures that only the content between <!--endtoc--> and <!--more--> is considered as summary.

This partial needs to be used wherever the summary text is needed (example: the Opengraph og:description meta tag).


Page (Debug)

Page VariableValue
Name "No TOC in Summary (with more comment marker)"
Title "No TOC in Summary (with more comment marker)"
ResourceType "page"
Kind "page"
Section "posts"
Draft false
Type "posts"
Layout ""
Permalink "https://ox-hugo.scripter.co/test/posts/no-toc-in-summary-with-more/"
RelPermalink "/posts/no-toc-in-summary-with-more/"
Data
page.Data{} (type:page.Data)
NextPageNo TOC as toc set to nil
PrevPageNo TOC in Summary (without more comment marker)
NextInSectionNo TOC as toc set to nil
PrevInSectionNo TOC in Summary (without more comment marker)

Page Params (Debug)

KeyTypeValue
draftbool false
iscjklanguagebool false
lastmodtime.Time 2022-01-16 11:59:06 -0500 -0500
tags[]string "export-option" "toc" "summary" "endtoc" "more"
titlestring "No TOC in Summary (with more comment marker)"

File Object (Debug)

FileInfo VariableValue
UniqueID "42d4ff9ed643e9c143bef4e0cdd095b0"
BaseFileName "no-toc-in-summary-with-more"
TranslationBaseName "no-toc-in-summary-with-more"
Lang "en"
Section "posts"
LogicalName "no-toc-in-summary-with-more.md"
Dir "posts/"
Ext "md"
Path "posts/no-toc-in-summary-with-more.md"

This site is generated using the ox-hugo package for Emacs/Org-mode + hugo-bare-min-theme + Hugo 0.101.0 (commit 466fa43c16709b4483689930a4f9ac8add5c9f66) . This site is powered by Netlify.
[Test Site home | ox-hugo home]