Skip to content

Commit

Permalink
Merge pull request #101 from Drop-in-Hachinohe/feature_dynamic_ogp
Browse files Browse the repository at this point in the history
vercel.jsonの再テスト
  • Loading branch information
YuukiIshibashi authored Jan 14, 2024
2 parents d4d720d + 368577c commit 2364301
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
27 changes: 20 additions & 7 deletions api/bot_index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
export default (req, res) => {
console.log(req)
res.status(200).json({ name: 'John Doe' })

// return json({
// message: `Hello ${name}!`,
// })
const bots = [
'Twitterbot',
'facebookexternalhit',
'Slackbot-LinkExpanding'
];

export default function handler(req, res) {
res.write(
`
<!doctype html>
<html lang="ja">
<head prefix="og: http://ogp.me/ns#">
</head>
<body>bot用</body>
</html>
`
);
res.end();
return
}

6 changes: 5 additions & 1 deletion vercel.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"rewrites": [{ "source": "/:path*", "destination": "/index.html" }]
"rewrites": [
{ "source": "/news/:match*", "destination": "/api/bot_index" },
{ "source": "/:path*", "destination": "/index.html" }
]
}

0 comments on commit 2364301

Please sign in to comment.