Ver código fonte

Merge pull request #2063 from dhrp/doc-template-fix

Doc template fix
Andy Rothfusz 11 anos atrás
pai
commit
b584c21ca4

+ 22 - 6
docs/theme/docker/layout.html

@@ -25,11 +25,20 @@
     + ['//fonts.googleapis.com/css?family=Cabin:400,700,400italic']
     %}
 
-    {%- if pagename == 'index' %}
-    <link rel="canonical" href="http://docs.docker.io/en/latest/">
-    {% else %}
-    <link rel="canonical" href="http://docs.docker.io/en/latest/{{ pagename }}/">
-    {% endif %}
+    {#
+        This part is hopefully complex because things like |cut '/index/' are not available in spinx jinja
+        and will make it crash. (and we need index/ out.
+    #}
+    <link rel="canonical" href="http://docs.docker.io/en/latest/
+    {%- for word in pagename.split('/') -%}
+        {%- if word != 'index' -%}
+            {%- if word != '' -%}
+                {{ word }}/
+            {%- endif -%}
+        {%- endif -%}
+    {%- endfor -%}
+    ">
+
     {%- for cssfile in css_files %}
     <link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
     {%- endfor %}
@@ -124,7 +133,14 @@
                                 <small>Current version:</small>
                                 <ul class="inline">
                                     {% for slug, url in versions %}
-                                    <li class="alternative"><a href="{{ url }}{{ pagename }}/" title="Switch to {{ slug }}">{{ slug }}</a></li>
+                                    <li class="alternative"><a href="{{ url }}{%- for word in pagename.split('/') -%}
+                                        {%- if word != 'index' -%}
+                                            {%- if word != '' -%}
+                                                {{ word }}/
+                                            {%- endif -%}
+                                        {%- endif -%}
+                                    {%- endfor -%}"
+                                    title="Switch to {{ slug }}">{{ slug }}</a></li>
                                     {% endfor %}
                                 </ul>
                             </div>

+ 2 - 1
docs/theme/docker/static/css/main.css

@@ -397,7 +397,8 @@ dt:hover > a.headerlink {
 .admonition .admonition-title {
   font-size: larger;
 }
-.admonition.warning {
+.admonition.warning,
+.admonition.danger {
   border-color: #ac0004;
 }
 .admonition.note {

+ 1 - 1
docs/theme/docker/static/css/main.less

@@ -594,7 +594,7 @@ dt:hover > a.headerlink {
       font-size: larger;
   }
 
-  &.warning {
+  &.warning, &.danger {
     border-color: #ac0004;
   }