{"id":1954,"date":"2023-08-14T14:38:54","date_gmt":"2023-08-14T07:38:54","guid":{"rendered":"https:\/\/dev.artru.io.vn\/?p=1954"},"modified":"2023-10-27T14:38:05","modified_gmt":"2023-10-27T07:38:05","slug":"cach-gan-huy-hieu-bao-ve-dmca-toi-uu-nhat","status":"publish","type":"post","link":"https:\/\/artru.net\/en\/cach-gan-huy-hieu-bao-ve-dmca-toi-uu-nhat\/","title":{"rendered":"The best way to get the best DMCA protection badge"},"content":{"rendered":"<p class=\"wp-block-paragraph\">Perhaps not many of you pay attention to speed or SEO issues after affixing the DMCA protection badge on your website.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Error when attaching DMCA protection badge<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Here is the code that the DMCA tells you to attach to the web:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"977\" height=\"455\" src=\"https:\/\/cdn.artru.eu.org\/wp-content\/uploads\/2023\/08\/Embed-Your-Badge-DMCA.png\" alt=\"Embed Your Badge DMCA\" class=\"wp-image-1961\"\/><figcaption class=\"wp-element-caption\">Embed Your Badge DMCA<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Try to visit <a href=\"https:\/\/pagespeed.web.dev\/\" data-type=\"link\" data-id=\"https:\/\/pagespeed.web.dev\/\" target=\"_blank\" rel=\"noreferrer noopener\">PageSpeed Insights<\/a> to check if your website has any errors related to DMCA.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"644\" height=\"355\" src=\"https:\/\/cdn.artru.eu.org\/wp-content\/uploads\/2023\/08\/Loi-hinh-anh-DMCA-khong-co-width-height-ro-rang.png\" alt=\"Error DMCA image has no clear width, height\" class=\"wp-image-1969\"\/><figcaption class=\"wp-element-caption\">Error DMCA image has no clear width, height<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">If the user uses an ad blocker extension, the DMCA image cannot be loaded.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"458\" height=\"170\" src=\"https:\/\/cdn.artru.eu.org\/wp-content\/uploads\/2023\/08\/Loi-huy-hieu-DMCA-khong-load.png\" alt=\"Error of DMCA badge not loading\" class=\"wp-image-1970\"\/><figcaption class=\"wp-element-caption\">Error of DMCA badge not loading<\/figcaption><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Bug fixes and DMCA badge optimization<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You need more attributes <code data-no-translation=\"\" data-no-auto-translation=\"\">width height<\/code> for card <code data-no-translation=\"\" data-no-auto-translation=\"\">&lt;img&gt;<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The DMCA protection badge is usually located at the bottom of the page. So you can set more attributes <code data-no-translation=\"\" data-no-auto-translation=\"\">loading=\"lazy\"<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You should always save the image of the DMCA badge on your website to avoid errors when users use an ad blocker.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"907\" height=\"114\" src=\"https:\/\/cdn.artru.eu.org\/wp-content\/uploads\/2023\/08\/Them-thuoc-tinh-cho-the-img-DMCA.png\" alt=\"Add attribute for DMCA img tag\" class=\"wp-image-1979\"\/><figcaption class=\"wp-element-caption\">Add attribute for DMCA img tag<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">File <code data-no-translation=\"\" data-no-auto-translation=\"\">&lt;script&gt;<\/code> It&#039;s actually just a JavaScript code that adds the function to the tag&#039;s tail <code data-no-translation=\"\" data-no-auto-translation=\"\">&lt;a href<\/code> part <code data-no-translation=\"\" data-no-auto-translation=\"\">&amp;refurl={url}<\/code>. <code data-no-translation=\"\" data-no-auto-translation=\"\">{url}<\/code> is the url of the current page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Instead of using JavaScript code you can write it directly with the function <code data-no-translation=\"\" data-no-auto-translation=\"\">get_permalink()<\/code> in WordPress.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#039;s how I use the DMCA protection badge:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-translation=\"\" data-no-auto-translation=\"\"><code data-no-translation=\"\" data-no-auto-translation=\"\">&lt;a target=\"_blank\" href=\"https:\/\/www.dmca.com\/Protection\/Status.aspx?ID=f403b2c1-8e2d-4993-8c7a-2d7da934eb4c&amp;refurl=&lt;?php echo get_permalink(); ?&gt;\" class=\"dmca-badge\"&gt;\n\t&lt;img loading=\"lazy\" width=\"100\" height=\"20\" src =\"https:\/\/cdn.artru.io.vn\/wp-content\/uploads\/2023\/07\/dmca-badge.png\" alt=\"DMCA.com Protection Status\" \/&gt;\n&lt;\/a&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In case you use the source code <code data-no-translation=\"\" data-no-auto-translation=\"\">PHP<\/code> pure, you can use the function like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-translation=\"\" data-no-auto-translation=\"\"><code data-no-translation=\"\" data-no-auto-translation=\"\">function get_permalink() {\n    $protocol = isset($_SERVER&#91;'HTTPS']) &amp;&amp; $_SERVER&#91;'HTTPS'] === 'on' ? 'https:\/\/' : 'http:\/\/';\n    $host = $_SERVER&#91;'HTTP_HOST'];\n    $uri = $_SERVER&#91;'REQUEST_URI'];\n    return $protocol . $host . $uri;\n}\n$current_permalink = get_permalink();\necho $current_permalink;<\/code><\/pre>","protected":false},"excerpt":{"rendered":"<p>C\u00f3 l\u1ebd kh\u00f4ng nhi\u1ec1u b\u1ea1n \u0111\u1ec3 \u00fd \u0111\u1ebfn v\u1ea5n \u0111\u1ec1 t\u1ed1c \u0111\u1ed9 ho\u1eb7c SEO sau khi g\u1eafn huy hi\u1ec7u b\u1ea3o v\u1ec7 DMCA tr\u00ean website. L\u1ed7i khi g\u1eafn huy hi\u1ec7u b\u1ea3o v\u1ec7 DMCA \u0110\u00e2y l\u00e0 \u0111o\u1ea1n code m\u00e0 DMCA b\u1ea3o b\u1ea1n g\u1eafn v\u00f4 web: H\u00e3y th\u1eed truy c\u1eadp PageSpeed Insights \u0111\u1ec3 ki\u1ec3m tra xem website c\u1ee7a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1991,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"[]"},"categories":[9],"tags":[],"class_list":["post-1954","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-website"],"_links":{"self":[{"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/posts\/1954","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/comments?post=1954"}],"version-history":[{"count":0,"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/posts\/1954\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/media\/1991"}],"wp:attachment":[{"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/media?parent=1954"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/categories?post=1954"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artru.net\/en\/wp-json\/wp\/v2\/tags?post=1954"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}