Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
50910f8a
Unverified
Commit
50910f8a
authored
Apr 11, 2024
by
tom goriunov
Committed by
GitHub
Apr 11, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
URL previews don't work on X (Twitter) (#1792)
Fixes #1791
parent
3a9c6cb1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
meta.ts
configs/app/meta.ts
+2
-2
PageNextJs.tsx
nextjs/PageNextJs.tsx
+7
-1
No files found.
configs/app/meta.ts
View file @
50910f8a
import
app
from
'
./app
'
;
import
app
from
'
./app
'
;
import
{
getEnvValue
,
getExternalAssetFilePath
}
from
'
./utils
'
;
import
{
getEnvValue
,
getExternalAssetFilePath
}
from
'
./utils
'
;
const
defaultImageUrl
=
app
.
baseUrl
+
'
/static/og_placeholder.png
'
;
const
defaultImageUrl
=
'
/static/og_placeholder.png
'
;
const
meta
=
Object
.
freeze
({
const
meta
=
Object
.
freeze
({
promoteBlockscoutInTitle
:
getEnvValue
(
'
NEXT_PUBLIC_PROMOTE_BLOCKSCOUT_IN_TITLE
'
)
||
'
true
'
,
promoteBlockscoutInTitle
:
getEnvValue
(
'
NEXT_PUBLIC_PROMOTE_BLOCKSCOUT_IN_TITLE
'
)
||
'
true
'
,
og
:
{
og
:
{
description
:
getEnvValue
(
'
NEXT_PUBLIC_OG_DESCRIPTION
'
)
||
''
,
description
:
getEnvValue
(
'
NEXT_PUBLIC_OG_DESCRIPTION
'
)
||
''
,
imageUrl
:
getExternalAssetFilePath
(
'
NEXT_PUBLIC_OG_IMAGE_URL
'
)
||
defaultImageUrl
,
imageUrl
:
app
.
baseUrl
+
(
getExternalAssetFilePath
(
'
NEXT_PUBLIC_OG_IMAGE_URL
'
)
||
defaultImageUrl
)
,
},
},
});
});
...
...
nextjs/PageNextJs.tsx
View file @
50910f8a
...
@@ -3,6 +3,7 @@ import React from 'react';
...
@@ -3,6 +3,7 @@ import React from 'react';
import
type
{
Route
}
from
'
nextjs-routes
'
;
import
type
{
Route
}
from
'
nextjs-routes
'
;
import
config
from
'
configs/app
'
;
import
useAdblockDetect
from
'
lib/hooks/useAdblockDetect
'
;
import
useAdblockDetect
from
'
lib/hooks/useAdblockDetect
'
;
import
useGetCsrfToken
from
'
lib/hooks/useGetCsrfToken
'
;
import
useGetCsrfToken
from
'
lib/hooks/useGetCsrfToken
'
;
import
*
as
metadata
from
'
lib/metadata
'
;
import
*
as
metadata
from
'
lib/metadata
'
;
...
@@ -34,9 +35,14 @@ const PageNextJs = (props: Props) => {
...
@@ -34,9 +35,14 @@ const PageNextJs = (props: Props) => {
<
meta
property=
"og:title"
content=
{
opengraph
.
title
}
/>
<
meta
property=
"og:title"
content=
{
opengraph
.
title
}
/>
{
opengraph
.
description
&&
<
meta
property=
"og:description"
content=
{
opengraph
.
description
}
/>
}
{
opengraph
.
description
&&
<
meta
property=
"og:description"
content=
{
opengraph
.
description
}
/>
}
<
meta
property=
"og:image"
content=
{
opengraph
.
imageUrl
}
/>
<
meta
property=
"og:image"
content=
{
opengraph
.
imageUrl
}
/>
<
meta
property=
"og:type"
content=
"website"
/>
{
/* Twitter Meta Tags */
}
<
meta
name=
"twitter:card"
content=
"summary_large_image"
/>
<
meta
name=
"twitter:card"
content=
"summary_large_image"
/>
<
meta
property=
"twitter:domain"
content=
{
config
.
app
.
host
}
/>
<
meta
name=
"twitter:title"
content=
{
opengraph
.
title
}
/>
{
opengraph
.
description
&&
<
meta
name=
"twitter:description"
content=
{
opengraph
.
description
}
/>
}
<
meta
property=
"twitter:image"
content=
{
opengraph
.
imageUrl
}
/>
<
meta
property=
"twitter:image"
content=
{
opengraph
.
imageUrl
}
/>
<
meta
property=
"og:type"
content=
"website"
/>
</
Head
>
</
Head
>
{
props
.
children
}
{
props
.
children
}
</>
</>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment