[英]How automatically create new HTML page on Firebase Hosting without redeploy every time?
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.我的痛点是我必须在本地手动生成新的 HTML 页面文件,并在每次用户创建新内容时部署它们。
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.我正在寻找的是当用户创建新内容时自动在 Firebase 托管中生成新的 HTML 文件并为其指定路径 URL。
Let's say比方说
1 - I have this website: www.example.com 1 - 我有这个网站: www.example.com
2 - After a user creates a new comment for example "Hello Firebase Hosting". 2 - 在用户创建新评论后,例如“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. 3 - 我想根据 firebase 主机内的评论生成HTML 文件,而无需重新部署新版本以附加最新评论。
4 - newest comment generated file must be as this URL www.example.com/Hello_Firebase_Hostin.html 4 - 最新的评论生成文件必须是这个 URL www.example.com/Hello_Firebase_Hostin.html
5 - www.example.com/Hello_Firebase_Hostin.html can be accessed immediately after being created. 5 - www.example.com/Hello_Firebase_Hostin.html创建后可以立即访问。
Thanks,,,谢谢,,,
There is no way to create new HTML pages (or other files) on Firebase Hosting without deploying them.如果不部署它们,就无法在 Firebase 主机上创建新的 HTML 页面(或其他文件)。
What you can do is call the Firebase Hosting REST API to deploy just the new file(s).您可以做的是致电 Firebase 托管 REST API 以仅部署新文件。 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?
我之前在这里回答过这个问题: 我可以向我的 Firebase 托管的 static 网站添加额外的文件,还是每次都必须部署整个网站? , 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.不过,更常见的方法是将 Firebase Hosting 与 Cloud Functions 或 Cloud Run 连接起来,然后在那里生成动态内容。 For more on this, see the Firebase documentation on serving dynamic content and hosting microservices .
有关这方面的更多信息,请参阅 Firebase 有关提供动态内容和托管微服务的文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.