1
0
Fork 0

add canonical and nofollow

This commit is contained in:
Thomas Steur 2019-03-11 10:19:09 +13:00
parent 286225eb1a
commit fa33348bac
3 changed files with 9 additions and 2 deletions

View file

@ -53,12 +53,14 @@ class Markdown extends \Parsedown
private function purifyHtml($html) { private function purifyHtml($html) {
$config = \HTMLPurifier_Config::createDefault(); $config = \HTMLPurifier_Config::createDefault();
$config->set('HTML.Doctype', 'XHTML 1.0 Transitional'); $config->set('HTML.Doctype', 'XHTML 1.0 Transitional');
$config->set('HTML.Allowed', 'p,strong,em,b,a[href],i,span,ul,ol,li,cite,code,pre,br,blockquote,img'); $config->set('HTML.Allowed', 'p,strong,em,b,a[href],i,span,ul,ol,li,cite,code,pre,br,blockquote,img');
$config->set('HTML.AllowedAttributes', 'src, height, width, alt, href, class'); $config->set('HTML.AllowedAttributes', 'src, height, width, alt, href, class, rel');
$config->set('URI.AllowedSchemes', array('http' => true, 'https' => true, 'mailto' => true, 'ftp' => true)); $config->set('URI.AllowedSchemes', array('http' => true, 'https' => true, 'mailto' => true, 'ftp' => true));
$config->set('HTML.TargetBlank', true); $config->set('HTML.TargetBlank', true);
$config->set('HTML.Nofollow', true);
$purifier = new \HTMLPurifier($config); $purifier = new \HTMLPurifier($config);
return $purifier->purify($html); return $purifier->purify($html);

View file

@ -1,6 +1,10 @@
{% extends "layout.twig" %} {% extends "layout.twig" %}
{% import "macros.twig" as macro %} {% import "macros.twig" as macro %}
{% block head %}
<link rel="canonical" href="https://github.com/matomo-org/matomo/{{ pull_request ? "pulls" : "issues" }}/{{ number|e('html_attr') }}" />
{% endblock %}
{% block title %} {% block title %}
<title>{{ projectName }} {{ pull_request ? "Pull Request" : "Issue" }} #{{ number }} - {{ title }}</title> <title>{{ projectName }} {{ pull_request ? "Pull Request" : "Issue" }} #{{ number }} - {{ title }}</title>
{% endblock %} {% endblock %}

View file

@ -7,6 +7,7 @@
<link href="/css/style.css" rel="stylesheet"> <link href="/css/style.css" rel="stylesheet">
{% block head %} {% block head %}
<link rel="canonical" href="https://github.com/matomo-org/matomo/issues/" />
{% endblock %} {% endblock %}
{% block title %} {% block title %}