0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-29 11:12:39 +00:00

Added robots.txt, nofollow in metatags

Also noindex on /print/ pages
This commit is contained in:
Trevor Buckner
2020-04-20 13:46:18 -04:00
parent bdf37d8fe7
commit e88253f364
6 changed files with 19 additions and 7 deletions

View File

@@ -203,7 +203,7 @@ const EditPage = createClass({
render : function(){
return <div className='editPage page'>
<Meta name="robots" content="noindex" />
<Meta name='robots' content='noindex, nofollow' />
{this.renderNavbar()}
<div className='content'>

View File

@@ -73,7 +73,7 @@ const HomePage = createClass({
render : function(){
return <div className='homePage page'>
<Meta name="google-site-verification" content="NwnAQSSJZzAT7N-p5MY6ydQ7Njm67dtbu73ZSyE5Fy4" />
<Meta name='google-site-verification' content='NwnAQSSJZzAT7N-p5MY6ydQ7Njm67dtbu73ZSyE5Fy4' />
{this.renderNavbar()}
<div className='content'>

View File

@@ -2,6 +2,7 @@ const React = require('react');
const createClass = require('create-react-class');
const _ = require('lodash');
const cx = require('classnames');
const Meta = require('vitreum/meta');
const Markdown = require('naturalcrit/markdown.js');
const PrintPage = createClass({
@@ -42,6 +43,7 @@ const PrintPage = createClass({
render : function(){
return <div>
<Meta name='robots' content='noindex, nofollow' />
{this.renderPages()}
</div>;
}

View File

@@ -46,7 +46,7 @@ const SharePage = createClass({
render : function(){
return <div className='sharePage page'>
<Meta name="robots" content="noindex" />
<Meta name='robots' content='noindex, nofollow' />
<Navbar>
<Nav.section>
<Nav.item className='brewTitle'>{this.props.brew.title}</Nav.item>

5
robots.txt Normal file
View File

@@ -0,0 +1,5 @@
# Disallow crawling brew edit and share pages
User-agent: *
Disallow: /edit/
Disallow: /share/
Disallow: /print/

View File

@@ -44,9 +44,14 @@ const HomebrewModel = require('./server/homebrew.model.js').model;
const welcomeText = require('fs').readFileSync('./client/homebrew/pages/homePage/welcome_msg.md', 'utf8');
const changelogText = require('fs').readFileSync('./changelog.md', 'utf8');
String.prototype.replaceAll = function(s, r){return this.split(s).join(r);};
//Robots.txt
app.get('/robots.txt', (req, res)=>{
return res.sendFile(`${__dirname}/robots.txt`);
});
//Source page
String.prototype.replaceAll = function(s, r){return this.split(s).join(r);};
app.get('/source/:id', (req, res)=>{
HomebrewModel.get({ shareId: req.params.id })
.then((brew)=>{
@@ -59,7 +64,7 @@ app.get('/source/:id', (req, res)=>{
});
});
//User Page
app.get('/user/:username', (req, res, next)=>{
const fullAccess = req.account && (req.account.username == req.params.username);
HomebrewModel.getByUser(req.params.username, fullAccess)
@@ -72,7 +77,7 @@ app.get('/user/:username', (req, res, next)=>{
});
});
//Edit Page
app.get('/edit/:id', (req, res, next)=>{
HomebrewModel.get({ editId: req.params.id })
.then((brew)=>{
@@ -115,7 +120,7 @@ app.get('/print/:id', (req, res, next)=>{
});
//Render Page
//Render the page
const render = require('vitreum/steps/render');
const templateFn = require('./client/template.js');
app.use((req, res)=>{