Works... ta...
On 4/18/07, Rick Olson <technoweenie gmail.com> wrote:
>
> On 4/17/07, Jason N. <jason.nah gmail.com> wrote:
> >
> > Howdy Folks,
> >
> > I'm trying to do a sidebar section which iterates
across sections
> > which have single pages in them. Here's the
snippet of liquid code:
> >
> > {% if site.page_sections %}
> > <h2>Sections</h2>
> > <ul>
> > {% for page in site.page_sections %}
> > <li> {{ page | link_to_section }}
</li>
> > {% if page.pages.size > 0 %}
> > <ul>
> > {% for subpage in page.pages %}
> > <li> {{ subpage |
link_to_page }} </li>
> > {% endfor %}
> > </ul>
> > {% endif %}
> > {% endfor %}
> > </ul>
> > {% endif %}
> >
> > This works fine for most situations but when I do
a search, the
> > 'subpages' come up as
> >
> > "Liquid error: undefined method 'url' for
nil:NilClass"
> >
> > It would appear that there are subpages (hence it
enters the loop) and
> > it is fully populated BUT the link_to_page method
doesn't work.
> > Perhaps the code that attaches methods doesn't get
executed hence the
> > error?
>
> link_to_page uses the current section if it's not
defined. But
> searches don't have a section. Try this:
>
> {{ subpage | link_to_page: page }}
>
>
> --
> Rick Olson
> http://lighthouseapp.com
> http://weblog.techno-
weenie.net
> http://mephistoblog.com
>
> >
>
--
Cheers,
Jason
--~--~---------~--~----~------------~-------~--~----~
Mephisto: http://mephistoblog.com |
Mephisto Help: http://mephisto.stikipad
.com
To post to this group, send email to MephistoBlog googlegroups.com
To unsubscribe from this group, send email to
MephistoBlog-unsubscribe googlegroups.com
For more options, visit this group at http
://groups-beta.google.com/group/MephistoBlog
-~----------~----~----~----~------~----~------~--~---
|