Add metas to prevent the app to be indexed

Hi, we’ve recently started working on an app that we need to hide from web indexation. Since we created the app with the SDK, there doesn’t seem to be any HTML markup where we can simply add the metas to the head.

Does Lightning have any solution to the problem other than dynamically injecting it with javascript?

Thank you

1 Like

Assuming you’re hosting it yourself and need to make modifications to the index.html, you can edit: Lightning-SDK/index.html at master · rdkcentral/Lightning-SDK · GitHub for the easy route.

This will then be persisted over rebuilds.

Thanks for the quick answer! In our project there is no index.html file (we followed the Setup Lightning SDK instructions) other than the one in the build folder. We tried adding the meta in it but it gets removed when rebuilt.

Should we use the non-SDK setup?

Hello @Wouter, I’m working with @Seb and we used lng create to create our app. However, by using that command there’s no support folder created like in the repo you sent us. Should we use another another set up? Should we use the master branch of that repo?

For the usecase of self hosting a Lightning App, we actually recommend to use the lng dist command (Lightning CLI)

This will create a standalone version of the App (without trying to simulate the App store flow, as the result of lng build does) that can easily be uploaded to a server for self hosting.

Any changes made to the index.html created by lng dist will persist. So it would be safe to add your own metatags to this file for example.

Thanks!

My only concern with this approach is that while working on localhost with the lng dev command, the modification we made to the index.html file in the dist folder won’t be reflected in the browser, which could cause errors if we were to include scripts.

We have plans to add the functionality to watch for file changes and then generate a dist version (versus watch and generate a build version, as lng dev does)

In the mean time you could implement this yourself in a script in your package.json, utilizing a library like https://www.npmjs.com/package/watch and then run lng dist upon each file change.

A bit cumbersome, but a feasible workaround until this makes it into a next release.

1 Like

This is truly appreciated! Thank you so much!

Is there any way we can benefit from the lng serve command to use the dist folder instead of the build one?

Or is is implied we need to implement Express to serve the dist folder?