add canonical url

This commit is contained in:
slorber 2020-05-26 21:03:18 +02:00
parent 9a2129551e
commit cc1705e00c
2 changed files with 6 additions and 15 deletions

View file

@ -7,6 +7,7 @@ Array [
<head> <head>
<meta charset=\\"UTF-8\\"> <meta charset=\\"UTF-8\\">
<meta http-equiv=\\"refresh\\" content=\\"0; url=/abc/\\"> <meta http-equiv=\\"refresh\\" content=\\"0; url=/abc/\\">
<link rel=\\"canonical\\" href=\\"/abc/\\" />
</head> </head>
<script> <script>
window.location.href = '/abc/'; window.location.href = '/abc/';
@ -22,21 +23,7 @@ Array [
<head> <head>
<meta charset=\\"UTF-8\\"> <meta charset=\\"UTF-8\\">
<meta http-equiv=\\"refresh\\" content=\\"0; url=/abc/\\"> <meta http-equiv=\\"refresh\\" content=\\"0; url=/abc/\\">
</head> <link rel=\\"canonical\\" href=\\"/abc/\\" />
<script>
window.location.href = '/abc/';
</script>
</html>",
]
`;
exports[`toRedirectFilesMetadata should create appropriate metadatas for root baseUrl: fileContent baseUrl=empty 1`] = `
Array [
"<!DOCTYPE html>
<html>
<head>
<meta charset=\\"UTF-8\\">
<meta http-equiv=\\"refresh\\" content=\\"0; url=/abc/\\">
</head> </head>
<script> <script>
window.location.href = '/abc/'; window.location.href = '/abc/';
@ -52,6 +39,7 @@ Array [
<head> <head>
<meta charset=\\"UTF-8\\"> <meta charset=\\"UTF-8\\">
<meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/abc/\\"> <meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/abc/\\">
<link rel=\\"canonical\\" href=\\"https://docusaurus.io/abc/\\" />
</head> </head>
<script> <script>
window.location.href = 'https://docusaurus.io/abc/'; window.location.href = 'https://docusaurus.io/abc/';
@ -62,6 +50,7 @@ Array [
<head> <head>
<meta charset=\\"UTF-8\\"> <meta charset=\\"UTF-8\\">
<meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/def.html/\\"> <meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/def.html/\\">
<link rel=\\"canonical\\" href=\\"https://docusaurus.io/def.html/\\" />
</head> </head>
<script> <script>
window.location.href = 'https://docusaurus.io/def.html/'; window.location.href = 'https://docusaurus.io/def.html/';
@ -72,6 +61,7 @@ Array [
<head> <head>
<meta charset=\\"UTF-8\\"> <meta charset=\\"UTF-8\\">
<meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/\\"> <meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/\\">
<link rel=\\"canonical\\" href=\\"https://docusaurus.io/\\" />
</head> </head>
<script> <script>
window.location.href = 'https://docusaurus.io/'; window.location.href = 'https://docusaurus.io/';

View file

@ -11,6 +11,7 @@ export default `
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="refresh" content="0; url=<%= it.toUrl %>"> <meta http-equiv="refresh" content="0; url=<%= it.toUrl %>">
<link rel="canonical" href="<%= it.toUrl %>" />
</head> </head>
<script> <script>
window.location.href = '<%= it.toUrl %>'; window.location.href = '<%= it.toUrl %>';