Add speculation rules for pre-fetching and rendering

This commit is contained in:
2024-06-16 10:14:57 +10:00
parent be329447ab
commit 98e289744a
4 changed files with 37 additions and 1 deletions

View File

@@ -0,0 +1,33 @@
module Main
module Views
class Context < Adamantium::Context
include Deps["repos.page_repo"]
def speculation_rules
{"prerender": [
{
"where": {
"and": [
{"href_matches": "/*"},
]
}
}
],
"prefetch": [
{
"urls": ["bookmarks", "posts", "photos", "statuses", "uses"],
"referrer_policy": "no-referrer"
}
]}.to_json
end
def pages
page_repo.for_main_nav
end
def current_path
request.fullpath
end
end
end
end