11export const config = {
2- matcher : [ '/meme/:path*' , '/meme/quiz' ] ,
2+ matcher : [ '/meme/:path*' ] ,
33} ;
44
55export default async function middleware ( request : Request ) {
@@ -24,7 +24,7 @@ export default async function middleware(request: Request) {
2424 )
2525 . replace (
2626 / < m e t a \s + p r o p e r t y = " o g : i m a g e " \s + c o n t e n t = " [ ^ " ] * " [ ^ > ] * > / ,
27- `<meta property="og:image" content="https://meme-wiki.net /thumbnail.png" />` ,
27+ `<meta property="og:image" content="${ url . origin } /thumbnail.png" />` ,
2828 )
2929 . replace (
3030 / < m e t a \s + p r o p e r t y = " o g : u r l " \s + c o n t e n t = " [ ^ " ] * " [ ^ > ] * > / ,
@@ -40,50 +40,7 @@ export default async function middleware(request: Request) {
4040 )
4141 . replace (
4242 / < m e t a \s + p r o p e r t y = " t w i t t e r : i m a g e " \s + c o n t e n t = " [ ^ " ] * " [ ^ > ] * > / ,
43- `<meta property="twitter:image" content="https://meme-wiki.net/thumbnail.png" />` ,
44- ) ;
45-
46- return new Response ( modifiedHtml , {
47- status : 200 ,
48- headers : {
49- 'content-type' : 'text/html;charset=UTF-8' ,
50- 'cache-control' : 'no-cache, no-store, must-revalidate' ,
51- pragma : 'no-cache' ,
52- expires : '0' ,
53- } ,
54- } ) ;
55- }
56-
57- // /meme/{id} 경로인 경우 API 호출하여 OG 태그 설정
58- if ( path && path !== 'quiz' ) {
59- const modifiedHtml = html
60- . replace (
61- / < m e t a \s + p r o p e r t y = " o g : t i t l e " \s + c o n t e n t = " [ ^ " ] * " [ ^ > ] * > / ,
62- `<meta property="og:title" content="Meme Wiki - 밈 문화의 모든 것" />` ,
63- )
64- . replace (
65- / < m e t a \s + p r o p e r t y = " o g : d e s c r i p t i o n " \s + c o n t e n t = " [ ^ " ] * " [ ^ > ] * > / ,
66- `<meta property="og:description" content="나만의 밈을 만들고 공유하세요." />` ,
67- )
68- . replace (
69- / < m e t a \s + p r o p e r t y = " o g : i m a g e " \s + c o n t e n t = " [ ^ " ] * " [ ^ > ] * > / ,
70- `<meta property="og:image" content="https://meme-wiki.net/thumbnail.png" />` ,
71- )
72- . replace (
73- / < m e t a \s + p r o p e r t y = " o g : u r l " \s + c o n t e n t = " [ ^ " ] * " [ ^ > ] * > / ,
74- `<meta property="og:url" content="${ url . href } " />` ,
75- )
76- . replace (
77- / < m e t a \s + p r o p e r t y = " t w i t t e r : t i t l e " \s + c o n t e n t = " [ ^ " ] * " [ ^ > ] * > / ,
78- `<meta property="twitter:title" content="Meme Wiki - 밈 문화의 모든 것" />` ,
79- )
80- . replace (
81- / < m e t a \s + p r o p e r t y = " t w i t t e r : d e s c r i p t i o n " \s + c o n t e n t = " [ ^ " ] * " [ ^ > ] * > / ,
82- `<meta property="twitter:description" content="나만의 밈을 만들고 공유하세요." />` ,
83- )
84- . replace (
85- / < m e t a \s + p r o p e r t y = " t w i t t e r : i m a g e " \s + c o n t e n t = " [ ^ " ] * " [ ^ > ] * > / ,
86- `<meta property="twitter:image" content="https://meme-wiki.net/thumbnail.png" />` ,
43+ `<meta property="twitter:image" content="${ url . origin } /thumbnail.png" />` ,
8744 ) ;
8845
8946 return new Response ( modifiedHtml , {
0 commit comments