(#23373) Check for minimal use of [main]

When inserting settings into [main], there isn't any need to add a
section header.
(#23373) Don't set metadata when it isn't supported

Not all settings have metadata, this prevents the settings code from
trying to set it on ones that don't support it.