Xử lý external link cho website

Đây là đoạn jQuery để xử lý exteral link cho website… script sẽ tìm từng thẻ a trên web, nếu là external link thì sẽ cập nhật 2 attribute là ref=’nofollow’ và target =’_blank’…

<script>
$(document).ready(function(){
    $("a").each(function() {
        if (this.hostname !== location.hostname) {
            $(this).attr("rel", "nofollow");
            $(this).attr("target", "_blank");
        }
    });
});
</script>

Ngoài ra, nếu dùng wordpress thì có thể tham khảo qua plug-in: SyntaxHighlighter Evolved, hoặc Crayon Syntax Highlighter

RELATED POSTS

AttributeError: module ‘yaml’ has no attribute ‘FullLoader’

Issue found: Solution:Reference: https://stackoverflow.com/questions/55551191/module-yaml-has-no-attribute-fullloader The FullLoader class is only available in PyYAML 5.1 and later. Version 5.1 was released on March 13, 2019 and has probably not filtered down to many distributions yet. You can check the version of PyYAML by inspecting yaml.__version__: If you

Read More »
Share the Post: