@raushan123 You can create an AEM run mode OSGI service which will have the ability to return us to either “development”, “staging”, or “production”. Basically, you would need to create a RunModeIndentifierService and create configuration files & place them under the run mode configuration folder (config.dev, config.prod). Moreover, in the Sling Model with the help of @OSGIService annotation, you can call this service and get the actual run mode. Finally, in the sightly, you can provide a condition to display the HTML based on the run mode value coming from Sling Model.
Detailed step on this blog: https://sourcedcode.com/blog/aem/checking-run-mode-from-sightly-htl-in-aem-in-2023
Regards,
Ayush