Where did you get the information that this is not a good practice? There is no problem in doing this. All sites do. The search engine accesses the page as if it were a browser.
How page generation works
Just do not say "if the browser sees the content the search engine will also see" because this is not an absolute truth when the content is assembled through JavaScript.
There is the myth that this is solved today, but it is not true. The situation that was zero capability of the mechanisms understand JS, has improved, but still has ground. And yet it has its own techniques to achieve a reasonable result in some mechanisms. Not all. While only Google really counts.
Any page generated on-the-fly on the server will be viewed normally without any problem. The only reason to generate static pages would be to optimize the server's capacity since you would generate a page once and then only access. But I've seen people abusing this and getting the opposite result.
When the page is dynamic it is generated every time it is requested. Unless you use cache. And of course the general page cache only works if the page never changes, or at least changes little, which is not so common. It is common for each page requested to have a difference to the previous one, for publicity, news, personalization or another reason. Dynamic pages generate more load on the server, but in most cases this is not a problem. And the various cache levels will help mitigate a very heavy load.
The browser cache is also your friend.
The problem is on these pages SPA . In this case generation is done in the browser, by JS. The search engine can simulate some executions and generate content, but there are several situations that this is impractical.
Page name extension
When you generate a page you can by whatever extension you want. It is not mandatory to be .aspx
, or .php
or other extension for it to be processed.
If you configure the HTTP server for an extension to be processed, every time something with this extension is configured to call, it will trigger a designated processor, which can be an application or interpreter of a language. You can set up .html
to be processed as an ASP.Net application if you want. It has been agreed that the .html
extension is used for static pages, but nothing prevents it from being this.
Friendly URL
In addition, you can use a friendly URL ( another question ) that turns the URL into a route that internally in the server calls some application or piece of it in specific. That is, you disguise the application's actual address for something that's easier for people to read, and search engines identify the content. This is a very common technique that can be configured on the HTTP server (Apache, IIS, etc.) or within the application . I particularly prefer it within the application.
Conclusion
Do not worry about generating dynamic pages. And when this is creating load problems, start seeing techniques to reduce this. But not before.
This is general information. When you have more specific questions open more specific questions.