diff --git a/doc/_scripts/gen_kconfig_rest.py b/doc/_scripts/gen_kconfig_rest.py
index e5a8bb55960..5a55dd4ae4c 100755
--- a/doc/_scripts/gen_kconfig_rest.py
+++ b/doc/_scripts/gen_kconfig_rest.py
@@ -528,9 +528,12 @@ def sym_header_rst(sym):
#
# - '.. title::' sets the title of the document (e.g.
). This seems
# to be poorly documented at the moment.
+ l = len(f"CONFIG_{sym.name}")
return ":orphan:\n\n" \
- f".. title:: {sym.name}\n\n" \
+ f".. title:: CONFIG_{sym.name}\n\n" \
f".. kconfig:: CONFIG_{sym.name}\n\n" \
+ f"CONFIG_{sym.name}\n" \
+ f"{'#' * l}\n\n" \
f"{prompt_rst(sym)}\n\n" \
f"Type: ``{kconfiglib.TYPE_TO_STR[sym.type]}``\n\n"