mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
closes #732, custom robots.txt
This commit is contained in:
@@ -125,6 +125,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<form>
|
||||||
|
<h3>Web Crawler Settings</h3>
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
<strong>Custom Robots.txt <small>Leave blank for default</small></strong><br />
|
||||||
|
<textarea class="form-control" data-field="robots.txt"></textarea>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
<button class="btn btn-lg btn-primary" id="save">Save</button>
|
<button class="btn btn-lg btn-primary" id="save">Save</button>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -754,9 +754,14 @@ if(nconf.get('ssl')) {
|
|||||||
|
|
||||||
app.get('/robots.txt', function (req, res) {
|
app.get('/robots.txt', function (req, res) {
|
||||||
res.set('Content-Type', 'text/plain');
|
res.set('Content-Type', 'text/plain');
|
||||||
res.send("User-agent: *\n" +
|
|
||||||
"Disallow: /admin/\n" +
|
if (meta.config["robots.txt"]) {
|
||||||
"Sitemap: " + nconf.get('url') + "sitemap.xml");
|
res.send(meta.config["robots.txt"])
|
||||||
|
} else {
|
||||||
|
res.send("User-agent: *\n" +
|
||||||
|
"Disallow: /admin/\n" +
|
||||||
|
"Sitemap: " + nconf.get('url') + "sitemap.xml");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/recent.rss', function(req, res) {
|
app.get('/recent.rss', function(req, res) {
|
||||||
|
|||||||
Reference in New Issue
Block a user