🚧 Switch to monorepo with Turbo
This commit is contained in:
3
apps/api/extensions/hooks/robots-txt/.gitignore
vendored
Normal file
3
apps/api/extensions/hooks/robots-txt/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
dist
|
||||
1
apps/api/extensions/hooks/robots-txt/index.js
Normal file
1
apps/api/extensions/hooks/robots-txt/index.js
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";const t="\nUser-agent: Twitterbot\nAllow: /\n\nUser-agent: *\nDisallow: /\n".trim();module.exports=({init:e})=>{e("app.before",(({app:e})=>{e.get("/robots.txt",((e,n)=>{n.set("Content-Type","text/plain"),n.status(200),n.send(t)}))}))};
|
||||
7324
apps/api/extensions/hooks/robots-txt/package-lock.json
generated
Normal file
7324
apps/api/extensions/hooks/robots-txt/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
22
apps/api/extensions/hooks/robots-txt/package.json
Normal file
22
apps/api/extensions/hooks/robots-txt/package.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "directus-extension-robots-txt",
|
||||
"version": "1.0.0",
|
||||
"keywords": [
|
||||
"directus",
|
||||
"directus-extension",
|
||||
"directus-custom-hook"
|
||||
],
|
||||
"directus:extension": {
|
||||
"type": "hook",
|
||||
"path": "dist/index.js",
|
||||
"source": "src/index.js",
|
||||
"host": "^9.20.4"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "directus-extension build",
|
||||
"dev": "directus-extension build -w --no-minify"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@directus/extensions-sdk": "9.20.4"
|
||||
}
|
||||
}
|
||||
17
apps/api/extensions/hooks/robots-txt/src/index.js
Normal file
17
apps/api/extensions/hooks/robots-txt/src/index.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const customRobotsTxt = `
|
||||
User-agent: Twitterbot
|
||||
Allow: /
|
||||
|
||||
User-agent: *
|
||||
Disallow: /
|
||||
`.trim()
|
||||
|
||||
export default ({ init }) => {
|
||||
init('app.before', ({ app }) => {
|
||||
app.get('/robots.txt', (_, res) => {
|
||||
res.set('Content-Type', 'text/plain')
|
||||
res.status(200)
|
||||
res.send(customRobotsTxt)
|
||||
})
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user