Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Set site indexability at runtime (#4671)

zack23c46d3cbc6e
diff --git a/frontend/server/plugins/indexable.ts b/frontend/server/plugins/indexable.ts
new file mode 100644
index 000000000..88056472e
--- /dev/null
+++ b/frontend/server/plugins/indexable.ts
@@ -0,0 +1,11 @@
+import { defineNitroPlugin } from "nitropack/runtime"
+
+import { PRODUCTION } from "~/constants/deploy-env"
+
+export default defineNitroPlugin(async (nitroApp) => {
+ nitroApp.hooks.hook("site-config:init", ({ siteConfig }) => {
+ siteConfig.push({
+ indexable: import.meta.env.DEPLOYMENT_ENV === PRODUCTION,
+ })
+ })
+})