-
Notifications
You must be signed in to change notification settings - Fork 55
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 #2060 from AshHimself/seo
Problem: site cant be indexed by search engines
- Loading branch information
Showing
5 changed files
with
81 additions
and
6 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -56,3 +56,4 @@ ostrio:cookies | |
meteorhacks:kadira | ||
pauldowman:dotenv | ||
ostrio:flow-router-meta |
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 |
---|---|---|
|
@@ -95,6 +95,8 @@ [email protected] | |
[email protected] | ||
ostrio:[email protected] | ||
ostrio:[email protected] | ||
ostrio:[email protected] | ||
ostrio:[email protected] | ||
ostrio:[email protected] | ||
ostrio:[email protected] | ||
pauldowman:[email protected] | ||
|
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 |
---|---|---|
@@ -1,5 +1,12 @@ | ||
<head> | ||
<title>BLOCKRAZOR</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.4.1/css/simple-line-icons.min.css" rel="stylesheet"> | ||
</head> | ||
<title>BLOCKRAZOR</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.4.1/css/simple-line-icons.min.css" rel="stylesheet"> | ||
<meta name="description" content="Absolutely all information about every blockchain project, presented in a way that anyone can understand." /> | ||
<meta property="og:type" content="website" /> | ||
<meta property="og:title" content="BLOCKRAZOR" /> | ||
<meta property="og:description" content="Absolutely all information about every blockchain project, presented in a way that anyone can understand." /> | ||
<meta property="og:site_name" content="BLOCKRAZOR" /> | ||
<meta property="og:url" content="http://blockrazor.org" /> | ||
<meta property="og:image" itemprop="image" content="https://pbs.twimg.com/profile_images/972399033506455552/yrJNink3_400x400.jpg" /> | ||
</head> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { WebApp } from 'meteor/webapp'; | ||
import { Currencies } from '/imports/api/coins/currencies.js' | ||
|
||
const serverRendering = (req, res, next) => { | ||
try { | ||
|
||
const ua = req.headers['user-agent']; | ||
const pathName = req._parsedUrl.pathname; | ||
if (/bot|WhatsApp|facebook|twitter|pinterest|google|baidu|bing|msn|duckduckgo|teoma|slurp|yandex/i.test(ua)) { | ||
|
||
// Send any non matches forward | ||
if (!pathName.includes('/currency')) { | ||
next(); | ||
} | ||
|
||
var parts = req.url.split("/") | ||
|
||
let currency = Currencies.findOne({ | ||
slug: parts[2] | ||
}) | ||
|
||
let count = Currencies.find({ | ||
slug: parts[2] | ||
}).count(); | ||
|
||
let meteorURL = 'https://blockrazor.org/' + parts[2] | ||
|
||
if(count){ | ||
|
||
// Fetch the data you need to build your tags (and htmlContent) | ||
const html = ` | ||
<!DOCTYPE html> | ||
<!html> | ||
<head> | ||
<title>BlockRazor</title> | ||
<meta name="description" content="Absolutely all information about every blockchain project, presented in a way that anyone can understand." /> | ||
<meta property="og:type" content="website"/> | ||
<meta property="og:title" content="BlockRazor - ${currency.currencyName}"/> | ||
<meta property="og:description" content="Absolutely all information about every blockchain project, presented in a way that anyone can understand."/> | ||
<meta property="og:site_name" content="Saven"/> | ||
<meta property="og:url" content="${meteorURL}"/> | ||
</head> | ||
<body> | ||
Hello Bot, plz index us! | ||
</body> | ||
</html> | ||
`; | ||
res.statusCode = 200; | ||
res.setHeader('Content-Type', 'text/html'); | ||
res.end(html); | ||
}else{ | ||
console.log('can not get any content for some unknown reason, plz investigate : ( ') | ||
} | ||
|
||
} else { | ||
|
||
next(); | ||
} | ||
} catch (err) { | ||
console.log(err); | ||
} | ||
} | ||
|
||
// attach the handler to webapp | ||
WebApp.connectHandlers.use(serverRendering); |