11import React , { useState , useEffect } from 'react'
22import { Helmet } from 'react-helmet'
3- import { checkIfImage } from 'services/api'
43import removeMd from 'remove-markdown'
5- import { parseUrls , stripHtml } from 'services/helper'
4+ import { stripHtml } from 'services/helper'
65
76const HelmetGenerator = ( props ) => {
87 const { content, user, page = 'content' } = props
98 const [ title , setTitle ] = useState ( )
109 const [ description , setDescription ] = useState ( )
11- const [ image , setImage ] = useState ( )
1210 const url = window . location . href
1311
1412 useEffect ( ( ) => {
@@ -18,7 +16,6 @@ const HelmetGenerator = (props) => {
1816 const stripContent = stripHtml ( removeMd ( content ) )
1917 let title = stripContent
2018 let description = stripContent
21- const links = parseUrls ( content )
2219
2320 if ( `${ title } ` . length > 80 ) {
2421 title = `${ title . substr ( 0 , 80 ) } ...`
@@ -31,22 +28,10 @@ const HelmetGenerator = (props) => {
3128 }
3229
3330 description = `${ description } | by ${ user } `
34- const avatarLink = `https://images.hive.blog/u/${ user } /avatar/large`
3531
3632 setTitle ( title )
3733 setDescription ( description )
3834
39- if ( links . length !== 0 ) {
40- const result = await checkIfImage ( links )
41- const { hasImage, imageUrl } = result
42- if ( hasImage ) {
43- setImage ( `https://images.hive.blog/0x0/${ imageUrl } ` )
44- } else {
45- setImage ( avatarLink )
46- }
47- } else {
48- setImage ( avatarLink )
49- }
5035 window . prerenderReady = true
5136 }
5237
@@ -65,16 +50,22 @@ const HelmetGenerator = (props) => {
6550 < Helmet >
6651 < title > { title } </ title >
6752 < meta property = "description" content = { description } />
68- < meta property = "image" content = { image } />
53+ < meta property = "image" content = "https://d.buzz/dbuzz.svg" />
54+ < meta property = "image:width" content = "1200" />
55+ < meta property = "image:height" content = "628" />
6956 < meta property = "og:url" content = { url } />
7057 < meta property = "og:title" content = { title } />
7158 < meta property = "og:description" content = { description } />
72- < meta property = "og:image" content = { image } />
59+ < meta property = "og:image" content = "https://d.buzz/dbuzz.svg" />
60+ < meta property = "og:image:width" content = "1200" />
61+ < meta property = "og:image:height" content = "628" />
7362 < meta property = "title" content = { title } />
7463 < meta property = "twitter:url" content = { url } />
7564 < meta property = "twitter:title" content = { title } />
7665 < meta property = "twitter:description" content = { description } />
77- < meta property = "twitter:image" ccontent = { image } />
66+ < meta property = "twitter:image" content = "https://d.buzz/dbuzz.svg" />
67+ < meta property = "twitter:image:width" content = "1200" />
68+ < meta property = "twitter:image:height" content = "628" />
7869 </ Helmet >
7970 ) }
8071 { page !== 'content' && (
0 commit comments