Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions apps/frontend/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const favicons = {
'(prefers-color-scheme:dark)': '/favicon.ico',
}

const PROD_MODRINTH_URL = 'https://modrinth.com'
const STAGING_MODRINTH_URL = 'https://staging.modrinth.com'

export default defineNuxtConfig({
srcDir: 'src/',
app: {
Expand Down Expand Up @@ -165,6 +168,13 @@ export default defineNuxtConfig({
await fs.writeFile('./src/generated/state.json', JSON.stringify(state))

console.log('Tags generated!')

const robotsContent =
getDomain() === PROD_MODRINTH_URL
? 'User-agent: *\nDisallow: /_internal/'
: 'User-agent: *\nDisallow: /'

await fs.writeFile('./src/public/robots.txt', robotsContent)
},
},
runtimeConfig: {
Expand Down Expand Up @@ -326,9 +336,9 @@ function getDomain() {
} else if (process.env.VERCEL_URL) {
return `https://${process.env.VERCEL_URL}`
} else if (getApiUrl() === STAGING_API_URL) {
return 'https://staging.modrinth.com'
return STAGING_MODRINTH_URL
} else {
return 'https://modrinth.com'
return PROD_MODRINTH_URL
}
} else {
const port = process.env.PORT || 3000
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/public/robots.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
User-agent: *
Disallow: /_internal/
Disallow: /