且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

元标记未针对根 URL www.domain.com 更新

更新时间:2023-11-20 15:03:34

这是一个与 firebase 云功能相关的问题.不会在根路径 (www.domain.com) 上调用云函数,因此不会在服务器端更新元标记.我通过在应用程序的根目录中创建一个文件夹test"并将所有数据从 dist/browser 文件夹复制到test"文件夹并将 index.html 文件重命名为其他内容(例如 index2.html)解决了这个问题.还使用以下行更新了 firebase.json 文件:

This is a issue related to firebase cloud function. The cloud function is not getting invoked on the root path (www.domain.com), hence not updating meta tags on server side. I solved this issue by creating a folder 'test' in the root directory of the application and copying all the data from dist/browser folder into 'test' folder and renaming the index.html file to something else (eg. index2.html). Also updated the firebase.json file with the following line:

....
"hosting": {
    "public": "test",
    ....

因此,每当输入 URL 时,firebase 都会搜索公共文件夹中的 index.html 文件,如果不存在 index.html 文件,它将调用我们的云函数.

So whenever a URL is entered firebase searches the index.html file in the public folder and If there is no index.html file present it will invoke our cloud function.