Skip to content

Commit

Permalink
Merge pull request #26 from profiq/seo-updates
Browse files Browse the repository at this point in the history
Add SEO updates
  • Loading branch information
dhrdlicka authored Jan 24, 2024
2 parents 9590a36 + c635f01 commit cd01016
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
13 changes: 13 additions & 0 deletions cdn-config/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ import { Router, edgioRoutes } from '@edgio/core'
// Edgio automatically respects all cache headers, we don't have to setup anything here.

export default new Router()
// https://developer.chrome.com/blog/private-prefetch-proxy/
.match("/.well-known/traffic-advice", ({ send, setResponseHeader, cache }) => {
setResponseHeader("Content-Type", "application/trafficadvice+json");
send('[{"user_agent": "prefetch-proxy","fraction": 1.0}]', 200);
cache({
edge: {
maxAgeSeconds: 60 * 60 * 24,
staleWhileRevalidateSeconds: 60 * 60 * 24 * 7,
forcePrivateCaching: true,
},
});
})

// Here is an example where we cache api/* at the edge but prevent caching in the browser
// .match('/api/:path*', {
// caching: {
Expand Down
2 changes: 1 addition & 1 deletion lib/swapi_web.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defmodule SWAPIWeb do
those modules here.
"""

def static_paths, do: ~w(assets downloads fonts images favicon.ico robots.txt)
def static_paths, do: ~w(assets downloads fonts images favicon.ico robots.txt sitemap.txt .well-known)

def router do
quote do
Expand Down
2 changes: 2 additions & 0 deletions priv/static/.well-known/security.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Contact: https://github.com/profiq/swapi-elixir
Preferred-Languages: en, cz
3 changes: 3 additions & 0 deletions priv/static/sitemap.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
swapi.profiq.com/
swapi.profiq.com/swaggerui
swapi.profiq.com/postman

0 comments on commit cd01016

Please sign in to comment.