This repository has been archived by the owner on Jun 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from AudiusProject/jowlee-seo
SEO friendly changes
- Loading branch information
Showing
14 changed files
with
204 additions
and
38 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { h } from "preact"; | ||
import { Helmet } from "react-helmet"; | ||
import { getAudiusHostname } from "../../util/getEnv"; | ||
import { getHash } from "./collectibleHelpers"; | ||
|
||
const CollectibleHelmet = ({ collectiblesInfo }) => { | ||
if (!collectiblesInfo) { | ||
return null | ||
} | ||
const { collectible, user } = collectiblesInfo | ||
const title = `${collectible.name ? `${collectible.name} • ` : ''}NFT COLLECTIBLES • Audius` | ||
const description = collectible.description || (collectible.name ? `Check out ${collectible.name} on Audius · NFT COLLECTIBLES` : 'Check out NFT collectibles on Audius') | ||
const hostname = getAudiusHostname() | ||
const url = `https://${hostname}/${user.handle}/collectibles/${getHash(collectible.id)}` | ||
let type | ||
switch (collectible.mediaType) { | ||
case 'IMAGE': | ||
case 'GIF': | ||
type = 'ImageObject' | ||
break | ||
case 'VIDEO': | ||
type = 'VideoObject' | ||
break | ||
case 'THREE_D': | ||
type = '3DModel' | ||
break | ||
default: | ||
type = 'MediaObject' | ||
} | ||
const structuredData = { | ||
"@context": "http://schema.googleapis.com/", | ||
"@type": type, | ||
"@id": url, | ||
url: url, | ||
name: collectible.name || 'NFT Collectible', | ||
description: description, | ||
} | ||
|
||
return ( | ||
<Helmet encodeSpecialCharacters={false}> | ||
<title>{title}</title> | ||
<meta name="description" content={description} /> | ||
<link rel="canonical" href={url} /> | ||
<script type="application/ld+json"> | ||
{JSON.stringify(structuredData)} | ||
</script> | ||
</Helmet> | ||
) | ||
} | ||
|
||
export default CollectibleHelmet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { h } from "preact" | ||
import { Helmet } from "react-helmet" | ||
import { getAudiusHostname } from "../../util/getEnv" | ||
|
||
const CollectionHelmet = ({ collection }) => { | ||
if (!collection) { | ||
return null | ||
} | ||
|
||
const title = `${collection.name} by ${collection.ownerName} • Audius` | ||
const description = `Listen on Audius: ${collection.name}` | ||
const hostname = getAudiusHostname() | ||
const url = `https://${hostname}/${collection.collectionURLPath}` | ||
const isAlbum = collectionURLPath.toLowerCase().includes('album') | ||
let type = isAlbum ? 'MusicAlbum' : 'MusicPlaylist' | ||
const structuredData = { | ||
"@context": "http://schema.googleapis.com/", | ||
"@type": type, | ||
"@id": url, | ||
url: url, | ||
name: collection.name, | ||
description: description, | ||
} | ||
|
||
return ( | ||
<Helmet encodeSpecialCharacters={false}> | ||
<title>{title}</title> | ||
<meta name="description" content={description} /> | ||
<link rel="canonical" href={url} /> | ||
<script type="application/ld+json"> | ||
{JSON.stringify(structuredData)} | ||
</script> | ||
</Helmet> | ||
) | ||
} | ||
|
||
export default CollectionHelmet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { h } from "preact"; | ||
import { Helmet } from "react-helmet"; | ||
|
||
const TrackHelmet = ({ track }) => { | ||
if (!track) { | ||
return null; | ||
} | ||
|
||
const title = `${track.title} by ${track.userName} • Audius`; | ||
const description = `Listen to ${track.title} on Audius. ${track.userName} · Song`; | ||
const hostname = getAudiusHostname() | ||
const url = `https://${hostname}/${track.urlPath}`; | ||
const structuredData = { | ||
"@context": "http://schema.googleapis.com/", | ||
"@type": "MusicRecording", | ||
"@id": url, | ||
url: url, | ||
name: track.title, | ||
description: description, | ||
} | ||
|
||
return ( | ||
<Helmet encodeSpecialCharacters={false}> | ||
<title>{title}</title> | ||
<meta name="description" content={description} /> | ||
<link rel="canonical" href={url} /> | ||
<script type="application/ld+json"> | ||
{JSON.stringify(structuredData)} | ||
</script> | ||
</Helmet> | ||
); | ||
}; | ||
|
||
export default TrackHelmet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters