11{% comment %}
2- Copyright 2025 Google LLC
2+ Copyright 2025 Google LLC
33
4- Licensed under the Apache License, Version 2.0 (the "License");
5- you may not use this file except in compliance with the License.
6- You may obtain a copy of the License at
4+ Licensed under the Apache License, Version 2.0 (the "License");
5+ you may not use this file except in compliance with the License.
6+ You may obtain a copy of the License at
77
8- http://www.apache.org/licenses/LICENSE-2.0
8+ http://www.apache.org/licenses/LICENSE-2.0
99
10- Unless required by applicable law or agreed to in writing, software
11- distributed under the License is distributed on an "AS IS" BASIS,
12- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13- See the License for the specific language governing permissions and
14- limitations under the License.
10+ Unless required by applicable law or agreed to in writing, software
11+ distributed under the License is distributed on an "AS IS" BASIS,
12+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ See the License for the specific language governing permissions and
14+ limitations under the License.
1515{% endcomment %}
1616
1717{% comment %}
1818This layout file is used for generating permanent redirects from old URLs to
1919new ones.
2020{% endcomment %}
2121
22- {% capture redirect_url %}{{ page.redirect_to | prepend: site.baseurl | prepend: site.url }}{% endcapture %}
22+ {% assign redirect_url = page.redirect_to | prepend: site.baseurl | prepend: site.url %}
23+ {% assign http = page.redirect_to | downcase | slice: 0, 7 %}
24+ {% assign https = page.redirect_to | downcase | slice: 0, 8 %}
2325
24- {% if page.redirect_to | downcase | slice: 0, 6 == "http://" or page.redirect_to | downcase | slice: 0, 7 == "https://" %}
25- {% capture redirect_url %}{{ page.redirect_to }}{% endcapture %}
26+ {% if http == "http://" or https == "https://" %}
27+ {% assign redirect_url = page.redirect_to %}
2628{% endif %}
2729
2830< meta http-equiv ="refresh " content ="0; url={{ redirect_url }} ">
29- < link rel ="canonical " href ="{{ redirect_url }} " />
31+ < link rel ="canonical " href ="{{ redirect_url }} " />
0 commit comments