Do not redirect to 404, when subpage is missing?

I have .md content for the services page, with a personal layout.
Hugo generates me page. When visitors go to, they receive 404 page (reasonable). Is there any way to respond with the services page and save in browser URL string

I need this for manual processing unexisting pages and dynamically creating them with JS.

You can add frontmatter alias to the page you wish to redirect to.

- /services/seo

in the file (or where ever you define the service section) should do the trick.

This is a good solution when I know the subpages’ URLs. But I don’t. Basically, I get content for them via REST API. I need something that is described here, but I think for me is enough just redirect to root page