siteleaf / siteleaf-v1-themes

Siteleaf v1 theme documentation
http://www.siteleaf.com
69 stars 7 forks source link

Getting to the parent of an archive page #2

Closed kilmc closed 11 years ago

kilmc commented 11 years ago

The code below is how I've got my nav working on my site but in the archive section the link renders as the current directory, not the parent.

<header class="site-header">
  {% if type == 'page' %}
    <a href="{{current.url}}">
      <h1>{{current.title}}</h1>
    </a>
  {% elsif type == 'archive' %}
    <a href="{{previous.url}}">
      <h1>{{current.title}}</h1>
    </a>
  {% elsif type == 'post' %}
    <a href="{{parent.url}}">
      <h1>&larr; {{parent.title}}</h1>
    </a>
  {% endif %}
</header>

Are archive pages children of pages? If not can you guys point me in the right direction for getting this back up one level.

The url structure for my site is

kilmc.com/writing kilmc.com/writing/blog-post-name kilmc.com/writing/archive

And so I can't just send it back to the root directory, I want to keep people in the writing section.

Thanks

sskylar commented 11 years ago

Yes, just change previous.url to parent.url:

<header class="site-header">
 ...
  {% elsif type == 'archive' %}
    <a href="{{parent.url}}">
  ...
</header>
kilmc commented 11 years ago

Apologies, I pasted the wrong code. I had been trying things out to get it to work.

{% elsif type == 'archive' %}
  <a href="{{parent.url}}">
    <h1>{{current.title}}</h1>
  </a>

Currently this parent.url just sets it to the current directory, so I'm assuming something's wrong there. I've just published the latest to http://kilmc.siteleaf.net/writing/archive and if you hover over the top nav item "Writing" you'll see it points to /writing/archive instead of /writing

sskylar commented 11 years ago

Ah, looks like this is an issue on our end. We'll get a fix up right away.

In the meantime, a simple <a href="../"> will work. I'll update here when the fix is live.

kilmc commented 11 years ago

Sweet. Thanks Skylar.

larryfox commented 11 years ago

@kilmc Deployed a fix this morning. Let us know if you run into other bugs!