0

My pain point is I have to locally and manually generate the new HTML pages file and deploy them every time users create new content.

What I am looking for is when users create new content automatically generate the new HTML file in the Firebase Hosting and give it a path URL.

Let's say

1 - I have this website: www.example.com

2 - After a user creates a new comment for example "Hello Firebase Hosting".

3 - I want to generate the HTML file base on that comment inside firebase hosting without redeploying a new version to attach the newest comment.

4 - newest comment generated file must be as this URL www.example.com/Hello_Firebase_Hostin.html

5 - www.example.com/Hello_Firebase_Hostin.html can be accessed immediately after being created.

Thanks,,,

YahYa
  • 407
  • 4
  • 9
  • 1
    Why not save the data to firestore or realtime db and have one html file say comments.html that you parse comment id and it displays given comment. – griffins Apr 07 '22 at 09:09
  • because I want the SEO to find users' comments and rank it in the search engine – YahYa Apr 07 '22 at 10:58
  • 1
    @YahYa The way we work with this is that we store the comments in the DB and every 20 hours, we have a CRON job (using firebase functions and scheduler) which builds the html files and deploy to the firebase hosting. SEO is a long term thing, I think it doesn't have to be real time. Or if you want, you can look into custom approaches for ISR or ISG. – Aayush Sinha Aug 21 '23 at 09:20

1 Answers1

0

There is no way to create new HTML pages (or other files) on Firebase Hosting without deploying them.

What you can do is call the Firebase Hosting REST API to deploy just the new file(s). I've answered about this before here: Can I add additional file to my Firebase hosted static website, or must I deploy the entire site every time?, and there's a Gist with the basic code for it here.

The more common approach though is to connect Firebase Hosting with Cloud Functions or Cloud Run and then generate the dynamic content there. For more on this, see the Firebase documentation on serving dynamic content and hosting microservices.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807