简体   繁体   English

如何在 Firebase 主机上自动创建新的 HTML 页面而无需每次都重新部署?

[英]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.

相关问题 每次用户在 firebase 存储中拍摄新照片时创建一个新图像 - Create a new image every time user takes a new photo in firebase storage firebase flutter 不刷新页面怎么自动更新数据? - How can I update the data automatically without refreshing the page in firebase flutter? Flutter Firestore 每次创建新阵列 function 调用 - Flutter Firestore create new Array every time function called 如何更改 index.html(firebase 托管)以显示项目内容? - How to change index.html (firebase hosting) to show project content? 如何使用 Firebase 主机在 Flutter 中设置 404 未找到页面 - how to setup 404 Not found page in Flutter using Firebase Hosting Firebase 托管。 Firebase Deploy 只部署 index.html - Firebase Hosting. Firebase Deploy only deploys index.html 如何以编程方式部署到 Firebase 托管? - How to programatically deploy to Firebase Hosting? 如何使用 Firebase 托管镜像? - How To Host An Image With Firebase Hosting? firebase实时数据库动态添加新节点的方法 - How to add a new node dynamically in firebase real-time database 了解将 next.js 与 firebase 托管集成时如何计算服务器时间? - understanding how server-time is calculated when integrating next.js with firebase-hosting?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM