Unlike title, description, and canonical meta tags, “robots” does not provide per‑page controls in Wappler’s NodeJS stack. Therefore, I am reaching out to ask for the best practice way to exclude one page from indexing.
The only way I was able to apply to a single page was by injecting custom middleware into routes.js. I chose routes.js because server.js immediately reverts back to its generated state, while routes.js tends to persist longer before Wappler rewrites it.
This approach works, but only until the next edit or Server Connect framework update. At that point Wappler rewrites core files, removes the custom logic, and the site breaks with EJS errors (undefined variables, etc.).
Before I rebuild this again, I’m asking the community:
What is the recommended, stable, update‑safe way to apply noindex/nofollow to one page in a Wappler NodeJS project?
Safest way is probably to create a new layout page (copy and paste your current layout in to it), call it no_index, apply this to the page, and hardcode the noindex, nofollow meta in to it.
I've requested further controls over middleware.js to allow us to modify it as our deployments require such changes, and routes.js would also be beneficial too. Infact would be nice if when we make these changes, to any file, if they would be respected regardless.
The request is here:
Maybe you can suggest routes.js and we revive the request?
@cheese thank you for the thoughtful reply. I took a path similar to your suggestion and bought another domain to keep the landing page out of organic search and index. Once I get my desk cleared, I’ll circle back and make that request. Like I said, server.js immediately reverts to the original, so maybe routes is a file they consider?
@Cheese 's answer would be my second go-to. I would first try to use a conditional region in the layout page such as
<% if (locals.route === '/login') { %>
<meta name="robots" content="noindex, nofollow">
<% } %>
The content page already shows
<meta name="ac:route" content="/login">
@ben Truly appreciate your reply, and making note of your suggestion. What I thought would be rather straightforward turned out to be anything but.