soupault
soupault copied to clipboard
"Not inserting index data: page name does not match index" - how to solve?
I tried to create a blog, loosely following the "blog" tutorial. However, I don't seem to get any index contents, and I'm getting messages like below with --debug
:
[INFO] Writing generated page to _out\to-past\@go-loose\index.html
[INFO] Processing page site\to-past\@[email protected]
[INFO] Calling preprocessor "lua plugins/markdown.lua -n" on page site\to-past\@[email protected]
[INFO] Using the default template for page site\to-past\@[email protected]
[DEBUG] Not inserting index data: page name does not match index
What does this mean and how can I debug this?
My soupault.toml
- click to show!
# To learn about configuring soupault, visit https://www.soupault.app/reference-manual
[settings]
# Soupalt version that the config was written/generated for
# Trying to process this config with an older version will result in an error message
soupault_version = "4.0.0"
# Stop on page processing errors?
strict = true
# Display progress?
verbose = true
# Display detailed debug output?
debug = false
# Where input files (pages and assets) are stored.
site_dir = "site"
# site_dir = "."
# Where the output goes
build_dir = "_out"
# Files inside the site/ directory can be treated as pages or static assets,
# depending on the extension.
#
# Files with extensions from this list are considered pages and processed.
# All other files are copied to build/ unchanged.
#
# Note that for formats other than HTML, you need to specify an external program
# for converting them to HTML (see below).
page_file_extensions = ["htm", "html", "md", "rst", "adoc"]
# Files with these extensions are ignored.
ignore_extensions = ["draft"]
# Soupault can work as a website generator or an HTML processor.
#
# In the "website generator" mode, it considers files in site/ page bodies
# and inserts them into the empty page template stored in templates/main.html
#
# Setting this option to false switches it to the "HTML processor" mode
# when it considers every file in site/ a complete page and only runs it through widgets/plugins.
generator_mode = true
# Files that contain an <html> element are considered complete pages rather than page bodies,
# even in the "website generator" mode.
# This allows you to use a unique layout for some pages and still have them processed by widgets.
complete_page_selector = "html"
# Website generator mode requires a page template (an empty page to insert a page body into).
# If you use "generator_mode = false", this file is not required.
default_template_file = "templates/main.html"
# Page content is inserted into a certain element of the page template. This option is a CSS selector
# used for locating that element.
# By default the content is inserted into the <body>
default_content_selector = "body"
# You can choose where exactly to insert the content in its parent element.
# The default is append_child, but there are more, including prepend_child and replace_content
# default_content_action = "append_child"
default_content_action = "replace_content"
# If a page already has a document type declaration, keep the declaration
keep_doctype = true
# If a page does not have a document type declaration, force it to HTML5
# With keep_doctype=false, soupault will replace existing declarations with it too
doctype = "<!DOCTYPE html>"
# Insert whitespace into HTML for better readability
# When set to false, the original whitespace (if any) will be preserved as is
pretty_print_html = true
# Enables or disables clean URLs.
# When false: site/about.html -> build/about.html
# When true: site/about.html -> build/about/index.html
clean_urls = true
# Plugins can be either automatically discovered or loaded explicitly.
# By default discovery is enabled and the place where soupault is looking is the plugins/ subdirectory
# in your project.
# E.g. a file at plugins/my-plugin.lua will be registered as a widget named "my-plugin".
plugin_discovery = true
plugin_dirs = ["plugins"]
# It is possible to store pages in any format if you have a program
# that converts it to HTML and writes it to standard output.
# Example:
[preprocessors]
md = "lua plugins/markdown.lua -n"
# md = "lua -e \"package.path='./plugins/?.lua'\" plugins/luamd -p"
# md = "cmark --unsafe --smart"
# adoc = "asciidoctor -o -"
# Pages can be further processed with "widgets"
# Takes the content of the first <h1> and inserts it into the <title>
[widgets.page-title]
widget = "title"
selector = "h1"
default = "My Homepage"
append = " — My Homepage"
# Insert a <title> in a page if it doesn't have one already.
# By default soupault assumes if it's missing, you don't want it.
force = false
# Inserts a generator meta tag in the page <head>
# Just for demonstration, feel free to remove
[widgets.generator-meta]
widget = "insert_html"
html = '<meta name="generator" content="soupault">'
selector = "head"
# <blink> elements are evil, delete them all
[widgets.no-blink]
widget = "delete_element"
selector = "blink"
# By default this widget deletes all elements matching the selector,
# but you can set this option to false to delete just the first one
delete_all = true
[widgets.delete-dev-stylesheet]
widget = "delete_element"
selector = "head link.dev"
delete_all = true # 'false' only deletes the first one
[widgets.insert-sakura-ink-css]
widget = "insert_html"
html = '<link rel="stylesheet" href="/sakura-ink.css" type="text/css" /><link rel="stylesheet" href="/sakura-mod.css" type="text/css" />'
selector = "head"
[index.fields.title]
selector = ["h1"]
[index]
index = true
sort_descending = true
#sort_type = "calendar"
sort_type = "lexicographic"
# sort_by = "date"
sort_by = "title"
date_formats = ["%F"]
[index.views.blog]
index_selector = "#blog-index"
index_item_template = """
<p><a href="{{url}}">{{title}}</a></p>
"""
Hm; it showed something when I added section = "subdir/"
into the [index.views.blog]
block. Is there a way to add contents of more such "sections" to one index file?
@akavel Index data is only inserted in pages that match the index page regex, by default it's index.*
. Could you tell me the page path (in the source dir) where you expect to see it and don't see it there?
site\to-past\@[email protected]
definitely doesn't match that regex. You can use the index_first
option from 4.0.0 is you want to render metadata on content pages though, but I'm not sure what your requirement is.
Or you mean a different page?
Regarding section
, you can use a list of strings instead of a single string.
So, basically, I have site\index.html
, with barebones contents:
<h1>Welcome!</h1>
<p>Welcome to my homepage. It's under construction.</p>
<div id="blog-index">
<!-- blog index will be inserted here -->
</div>
I was thinking it could contain a list of all the pages generated based on the .md
input files. The input files are currently in site\to-past\*.md
and in site\other\*.md
. But with the TOML config as mentioned above, my _out\index.html
shows up rather empty (nothing is inserted in the blog-index
section). And when I run soupault --debug
, it prints that Not inserting index data (...)
message for every *.md
input.
Hm; when I add section = ["to-past/", "other/"]
in the [index.views.blog]
block, some items now show up in the _out\index.html
, and yet the Not inserting (...)
message is still printed. So I now understand that this message is not really relevant to my issue, it was something of a red herring probably. So now I'd like just to confirm one thing - do I have to always add every subdirectory to section
if I want it's files included in the index?
And by the way, thanks for creating soupault, its approach gives me hope that maybe I don't have to write my own SSG in the end ;) ❤️ Also the sakura.css suggestion in the tutorial is refreshingly simple too ❤️
I understand this is a very late reply, but for the reference:
do I have to always add every subdirectory to section if I want it's files included in the index?
You can either include them explicitly (if you only want some subdirectories) or use the include_subsections
option.
Since the issue was a configuration issue, I'm closing it now.