如何在 firebase 托管上存储 xml 文件获取 url 指向它?

How to store xml file on firebase hosting get url point to it?

我有一个 React 应用程序存储在 google Firebase 中,带有我的自定义域(不是 google Firebase 提供的那个) 我创建了一个 xml 文件并想将其存储在 google Firebase 上并获取其 URL.

例如,如果我的网站域名是: www.mywebsite.com 我想将文件 sitemap.xml 上传到 Firebase 并将其存储在那里, 并能够通过以下方式访问它: www.mywebsite.com/sitemap.xml

如何上传该文件并通过 URL 访问它?

如果要上传 sitemap.xml:

  1. sitemap.xml 放入您在 firebase.json 中配置为 public 文件夹的文件夹中,该文件夹也是您拥有主 index.html 的文件夹] 文件。
  2. 运行 firebase deploy --only hosting.

现在 sitemap.xml 将在 www.mywebsite.com/sitemap.xml 上线。