Render user-submitted links with nofollow attribute

This patch makes use of a plugin for the markdown parser so that links
to user-supplied content are rendered in a way that search engine
spiders or crawlers don't follow or index these links. The link
attributes plugin has been used here to set nofollow attribute to all
links directing to user-submitted content.

Change-Id: I05d794b15b823f417f9860d67fb52405360bb595
Task: 26060
Signed-off-by: Riju19 <19.riju@gmail.com>
This commit is contained in:
Riju19 2019-03-28 11:30:40 +05:30 committed by Adam Coldrick
parent 4e5e84fe9b
commit 011ae93ae3
3 changed files with 8 additions and 0 deletions

View File

@ -82,6 +82,7 @@
"gifsicle": "1.0.0",
"highlightjs": "9.10.0",
"markdown-it": "8.4.0",
"markdown-it-link-attributes": "^2.1.0",
"moment-timezone": "0.5.4",
"ng-sortable": "1.3.1"
}

View File

@ -33,6 +33,12 @@ angular.module('sb.services')
linkify: true
});
md.use($window.markdownitLinkAttributes, {
attrs: {
rel: 'nofollow'
}
});
return {
restrict: 'E',
scope: {

View File

@ -43,6 +43,7 @@
<script src="markdown-it/dist/markdown-it.min.js"></script>
<script src="highlightjs/highlight.pack.js"></script>
<script src="ng-sortable/dist/ng-sortable.js"></script>
<script src="markdown-it-link-attributes/index.js"></script>
<!-- endbuild -->
<link rel="stylesheet" href="styles/main.css">