Skip to content

Commit

Permalink
Ordenamiento de navegación. Close #5.
Browse files Browse the repository at this point in the history
  • Loading branch information
puentesarrin committed Jul 18, 2014
1 parent cfdf329 commit b758c79
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 2 deletions.
3 changes: 1 addition & 2 deletions _includes/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
`layout: page` in the front-matter. See readme for usage.
{% endcomment %}

{% assign pages_list = site.pages %}
{% for node in pages_list %}
{% for node in site.navigation %}
{% if node.title != null %}
{% if node.layout == "page" %}
<li class="sidebar-nav-item{% if page.url == node.url %} active{% endif %}">
Expand Down
17 changes: 17 additions & 0 deletions _plugins/navigation.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module Jekyll

class SiteNavigation < Jekyll::Generator
safe true
priority :lowest

def generate(site)
sorted = []
site.pages.each do |page|
sorted << page if page.data.has_key?("navigation") and page.data["navigation"]["show"] != false
end
sorted = sorted.sort{ |a,b| a.data["navigation"]["weight"] <=> b.data["navigation"]["weight"] }
site.config["navigation"] = sorted
end
end

end
3 changes: 3 additions & 0 deletions acerca.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
layout: page
title: Acerca de este sitio
navigation:
weight: 4
show: true
---

Este sitio web está construido con la ayuda de [Jekyll] y [GitHub Pages], por lo que todo lo que se muestra es contenido estático que en realidad está redactado mayormente con el formato de marcado [Markdown]. El tema visual que utilizamos se llama [Hyde], y si bien es cierto que hemos realizado algunas ligeras añadiduras, éstas han sido escritas en un archivo CSS separado para mantener la integridad del tema.
Expand Down
3 changes: 3 additions & 0 deletions grupos-estudio.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
layout: page
title: Grupos de estudio
navigation:
weight: 3
show: true
---
3 changes: 3 additions & 0 deletions nosotros.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
layout: page
title: Nosotros
navigation:
weight: 1
show: true
---
3 changes: 3 additions & 0 deletions proyectos.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
layout: page
title: Proyectos
navigation:
weight: 2
show: true
---

0 comments on commit b758c79

Please sign in to comment.