If you are not redirected automatically, follow this link.
- For Google to index the page when the domain is not managed by self, add verified html file generated from Google Search Console by "URL prefix" to root.
- google422183c2a0685f14.html is generated by cr@g
- googlef1b9c8c479944f0e.html is generate by crjp@g
- Google Search Console -> Sitemaps -> Add new sitemap (not sure if it is necessary or not)
- Currently, it seems not work due to bug of Google.
### Firebase functions
In order to make SEO work, not being impact by contents loaded dynamically by JavaScript, we write functions to:
- Replace "canonical" before returning to client.
- Rewrite URL from {host}/index.html?fileId={fileId} to {host}/{fileId}
#### Details
- Deploy "rewriter" app for rewriting canonical link in order to generate unique value directly instead of by client side scripts.
- Change resources(*.js, *.css, *.html) paths from relative to absolute since URL for SEO does not start from root.
- Move static resources from root into functions directory since ~~index.html~~home.html need to be loaded by the app.
- **If static page exists, the routing configuration will not work for that, so we must rename index.html to other file name.**
Configuration files are:
- filebase.json: rewrite URL from *?fileId={fileId} to /album/{fileId}
- We need to add `{"source": "/sitemap.xml","destination": "/sitemap.xml"}` into `hosting.rewrites` node
and `{"source": "/sitemap.xml","headers": {"key": "Content-Type","value": "application/xml"}]}`
into `hosting.headers` node so the file can be served as static resource with correct content type.
- index.js:
- Update canonical link based on file ID to generate unique link for each album.
- Redirect requests sent to root with specific fileId to /album/* path.
#### app info
Run command `firebase functions:list`
Output
┌──────────┬─────────┬─────────┬─────────────┬────────┬──────────┐ │ Function │ Version │ Trigger │ Location │ Memory │ Runtime │ ├──────────┼─────────┼─────────┼─────────────┼────────┼──────────┤ │ rewriter │ v2 │ https │ us-central1 │ 256 │ nodejs18 │ └──────────┴─────────┴─────────┴─────────────┴────────┴──────────┘ ```
https://console.cloud.google.com/logs/query?authuser=1&inv=1&invt=AblZqg&project=linen-sun-367015
or use firebase functions:log
command
https://console.cloud.google.com/artifacts?invt=AbldJA&authuser=1&project=linen-sun-367015
Latest release is using Google Firebase
firebase deploy --only functions,hosting
instead of firebase deploy