Browse Source

Fixes menu to work with non-default base_url values.

Includes the patch by Brian Mattern that fixes menu to work in all
situations. Also adds the explanation how to use media_url and
base_url properties.
main
Merlin 13 years ago
parent
commit
7fa9fb4dff
2 changed files with 13 additions and 7 deletions
  1. +3
    -3
      hyde/layouts/starter/layout/macros.j2
  2. +10
    -4
      hyde/layouts/starter/site.yaml

+ 3
- 3
hyde/layouts/starter/layout/macros.j2 View File

@@ -6,11 +6,11 @@
#} #}
<ul> <ul>
{% for menu_item in menu -%} {% for menu_item in menu -%}
<li><a {% if (menu_item.url == resource.full_url) or
<li><a {% if (menu_item.url == resource.url) or
(menu_item.title == "Advanced topics" (menu_item.title == "Advanced topics"
and resource.node.name == "advanced") and resource.node.name == "advanced")
%}class="selected"{% endif %}
href="{{ menu_item.url }}">{{ menu_item.title }}</a></li>
%}class="selected"{% endif -%}
href="{{ content_url(menu_item.url) }}">{{ menu_item.title }}</a></li>
{%- endfor %} {%- endfor %}
</ul> </ul>
{%- endmacro %} {%- endmacro %}


+ 10
- 4
hyde/layouts/starter/site.yaml View File

@@ -1,6 +1,12 @@
mode: learning mode: learning
media_root: media media_root: media
media_url: /media media_url: /media
base_url: /
# If your site is nested inside of a bigger one, you can use media_url and
# base_url to properly generate links on your site. For example, if your URL
# will be some.domain.com/starter/, use:
# media_url: /starter/media
# base_url: /starter/
template: hyde.ext.templates.jinja.Jinja2Template template: hyde.ext.templates.jinja.Jinja2Template
plugins: plugins:
- hyde.ext.plugins.meta.MetaPlugin - hyde.ext.plugins.meta.MetaPlugin
@@ -23,13 +29,13 @@ context:
install: "http://hyde.github.com/install.html" install: "http://hyde.github.com/install.html"
menu: menu:
- title: Home - title: Home
url: /index.html
url: index.html
- title: First steps - title: First steps
url: /first-steps.html
url: first-steps.html
- title: Advanced topics - title: Advanced topics
url: /advanced/overview.html
url: advanced/overview.html
- title: About - title: About
url: /about.html
url: about.html


### Advanced part ### ### Advanced part ###




Loading…
Cancel
Save