EDIT: дизайн внешних ссылок

This commit is contained in:
Evg 2022-04-03 00:40:27 +03:00
parent 477efebed9
commit b5b52b100b
2 changed files with 16 additions and 4 deletions

View file

@ -25,10 +25,13 @@ class MyParsedown extends Parsedown
$server_host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null;
$href_host = isset($Element['attributes']['href']) ? parse_url($Element['attributes']['href'], PHP_URL_HOST) : null;
// Add a list of allowed urls to the config?
if ($server_host != $href_host) {
$Element['attributes']['target'] = '_blank';
$Element['attributes']['rel'] = 'noopener nofollow ugc';
if($href_host) {
// Add a list of allowed urls to the config?
if ($server_host != $href_host) {
$Element['attributes']['target'] = '_blank';
$Element['attributes']['class'] = 'external-url';
$Element['attributes']['rel'] = 'noopener nofollow ugc';
}
}
}

View file

@ -204,6 +204,15 @@ blockquote {
justify-content: center;
}
.external-url:after {
content: "🔗";
font-family: bootstrap-icons;
color: #eee;
vertical-align: middle;
font-size: 13px;
margin-left: 3px;
}
@media (max-width: 890px) {
aside { display: none; }
main { width: 100%; }