Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
Vũ Hoàng Anh
canifa_note
Commits
56b55ad9
Commit
56b55ad9
authored
Dec 15, 2023
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update memo metadata
parent
24672e0c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
frontend.go
server/frontend/frontend.go
+9
-6
No files found.
server/frontend/frontend.go
View file @
56b55ad9
...
@@ -80,9 +80,6 @@ func (s *FrontendService) registerRoutes(e *echo.Echo) {
...
@@ -80,9 +80,6 @@ func (s *FrontendService) registerRoutes(e *echo.Echo) {
if
memo
==
nil
{
if
memo
==
nil
{
return
c
.
HTML
(
http
.
StatusOK
,
rawIndexHTML
)
return
c
.
HTML
(
http
.
StatusOK
,
rawIndexHTML
)
}
}
if
memo
.
Visibility
!=
store
.
Public
{
return
c
.
HTML
(
http
.
StatusOK
,
rawIndexHTML
)
}
creator
,
err
:=
s
.
Store
.
GetUser
(
ctx
,
&
store
.
FindUser
{
creator
,
err
:=
s
.
Store
.
GetUser
(
ctx
,
&
store
.
FindUser
{
ID
:
&
memo
.
CreatorID
,
ID
:
&
memo
.
CreatorID
,
})
})
...
@@ -97,15 +94,21 @@ func (s *FrontendService) registerRoutes(e *echo.Echo) {
...
@@ -97,15 +94,21 @@ func (s *FrontendService) registerRoutes(e *echo.Echo) {
}
}
func
generateMemoMetadata
(
memo
*
store
.
Memo
,
creator
*
store
.
User
)
string
{
func
generateMemoMetadata
(
memo
*
store
.
Memo
,
creator
*
store
.
User
)
string
{
description
:=
memo
.
Content
if
memo
.
Visibility
==
store
.
Private
{
description
=
"This memo is private."
}
else
if
memo
.
Visibility
==
store
.
Protected
{
description
=
"This memo is protected."
}
metadataList
:=
[]
string
{
metadataList
:=
[]
string
{
fmt
.
Sprintf
(
`<meta name="description" content="%s" />`
,
memo
.
Content
),
fmt
.
Sprintf
(
`<meta name="description" content="%s" />`
,
description
),
fmt
.
Sprintf
(
`<meta property="og:title" content="%s" />`
,
fmt
.
Sprintf
(
"%s(@%s) on Memos"
,
creator
.
Nickname
,
creator
.
Username
)),
fmt
.
Sprintf
(
`<meta property="og:title" content="%s" />`
,
fmt
.
Sprintf
(
"%s(@%s) on Memos"
,
creator
.
Nickname
,
creator
.
Username
)),
fmt
.
Sprintf
(
`<meta property="og:description" content="%s" />`
,
memo
.
Content
),
fmt
.
Sprintf
(
`<meta property="og:description" content="%s" />`
,
description
),
fmt
.
Sprintf
(
`<meta property="og:image" content="%s" />`
,
"https://www.usememos.com/logo.png"
),
fmt
.
Sprintf
(
`<meta property="og:image" content="%s" />`
,
"https://www.usememos.com/logo.png"
),
`<meta property="og:type" content="website" />`
,
`<meta property="og:type" content="website" />`
,
// Twitter related metadata.
// Twitter related metadata.
fmt
.
Sprintf
(
`<meta name="twitter:title" content="%s" />`
,
fmt
.
Sprintf
(
"%s(@%s) on Memos"
,
creator
.
Nickname
,
creator
.
Username
)),
fmt
.
Sprintf
(
`<meta name="twitter:title" content="%s" />`
,
fmt
.
Sprintf
(
"%s(@%s) on Memos"
,
creator
.
Nickname
,
creator
.
Username
)),
fmt
.
Sprintf
(
`<meta name="twitter:description" content="%s" />`
,
memo
.
Content
),
fmt
.
Sprintf
(
`<meta name="twitter:description" content="%s" />`
,
description
),
fmt
.
Sprintf
(
`<meta name="twitter:image" content="%s" />`
,
"https://www.usememos.com/logo.png"
),
fmt
.
Sprintf
(
`<meta name="twitter:image" content="%s" />`
,
"https://www.usememos.com/logo.png"
),
`<meta name="twitter:card" content="summary" />`
,
`<meta name="twitter:card" content="summary" />`
,
}
}
...
...
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