Skip to content

Commit 465fa43

Browse files
committedAug 1, 2015
Include <base> elements early in <head>
For use with troublesome /double//slashed paths and dynamic addresses.
1 parent 15217bc commit 465fa43

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed
 

‎CHANGES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Features
99
Bugfixes
1010
--------
1111

12+
* <base href> resolve common relative resource loading issues
1213
* Handle non-integer shutter speeds and other variables in WordPress
1314
importer (Issue #1917)
1415

‎nikola/data/themes/base-jinja/templates/base_helper.tmpl

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ dir="rtl"
2121
lang="{{ lang }}">
2222
<head>
2323
<meta charset="utf-8">
24+
<meta name="viewport" content="width=device-width">
25+
<base href="{{ abs_link(permalink) }}">
26+
2427
{% if description %}
2528
<meta name="description" content="{{ description }}">
2629
{% endif %}
27-
<meta name="viewport" content="width=device-width">
2830
<title>{{ title|e }} | {{ blog_title|e }}</title>
2931

3032
{{ html_stylesheets() }}

‎nikola/data/themes/base/templates/base_helper.tmpl

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ dir="rtl" \
2121
lang="${lang}">
2222
<head>
2323
<meta charset="utf-8">
24+
<meta name="viewport" content="width=device-width">
25+
<base href="{{ abs_link(permalink) }}">
26+
2427
%if description:
2528
<meta name="description" content="${description}">
2629
%endif
27-
<meta name="viewport" content="width=device-width">
2830
<title>${title|striphtml} | ${blog_title|striphtml}</title>
2931

3032
${html_stylesheets()}

‎nikola/data/themes/bootstrap3-jinja/templates/base_helper.tmpl

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ dir="rtl"
2626
lang="{{ lang }}">
2727
<head>
2828
<meta charset="utf-8">
29+
<meta name="viewport" content="width=device-width, initial-scale=1">
30+
<base href="{{ abs_link(permalink) }}">
31+
2932
{% if description %}
3033
<meta name="description" content="{{ description }}">
3134
{% endif %}
32-
<meta name="viewport" content="width=device-width, initial-scale=1">
3335
<title>{{ title|e }} | {{ blog_title|e }}</title>
3436

3537
{{ html_stylesheets() }}

‎nikola/data/themes/bootstrap3/templates/base_helper.tmpl

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ dir="rtl" \
2626
lang="${lang}">
2727
<head>
2828
<meta charset="utf-8">
29+
<meta name="viewport" content="width=device-width, initial-scale=1">
30+
<base href="{{ abs_link(permalink) }}">
31+
2932
%if description:
3033
<meta name="description" content="${description}">
3134
%endif
32-
<meta name="viewport" content="width=device-width, initial-scale=1">
3335
<title>${title|striphtml} | ${blog_title|striphtml}</title>
3436

3537
${html_stylesheets()}

7 commit comments

Comments
 (7)

Kwpolska commented on Aug 2, 2015

@Kwpolska
Member

👎

Please show me any website that uses it. They can also break anchors. Besides, we handle our own URL fixing pretty well.

I’m reverting those commits.

da2x commented on Aug 2, 2015

@da2x
ContributorAuthor

No!

da2x commented on Aug 2, 2015

@da2x
ContributorAuthor

This was added because of this,
https://chriswarrick.com/blog/2015//07/06/upass/

da2x commented on Aug 2, 2015

@da2x
ContributorAuthor

Google Translated pages (from translate.google.com) only works because of this tag rewriting URLs from their original hosts without modifying the document.

da2x commented on Aug 2, 2015

@da2x
ContributorAuthor

If you see broken anchors,, the anchors were already broken or too ambiguous.

da2x commented on Aug 2, 2015

@da2x
ContributorAuthor

Check out your own 404-pages:
https://chriswarrick.com/dsfs/sdff/ee///dfdf
https://chriswarrick.com/dsfs/sdff/ee/ (not even any double-slashes)

da2x commented on Aug 2, 2015

@da2x
ContributorAuthor

For Nikola that uses relative URLs by default, the base tag is highly recommended. Sorting out all of this is the tag’s explicit purpose.

Please sign in to comment.