Clean URLs
  • Is there a way to grab a variable from the url without using permalinks?

    I know I could do
    website.com/exhibitions.php?grouping=current

    But is there a way to use cleaner URLs for the three main landing pages:
    website.com/exhibitions/current
    website.com/exhibitions/upcoming
    website.com/exhibitions/press

    It would pull from the Exhibitions structure.

    I cannot use permalinks because I am using them for when you are at a single Exhibition:

    website.com/exhibitions/exhibition-title

  • 6 Answers sorted by
  • There's more magic to permalinks than you know about. :)

    Let's say you have an Exhibition called Worlds Fair, with Permalink:

    website.com/exhibitions/worlds-fair

    When someone hits that URL, it will render whatever HTML page you've defined as the permalink HTML page for exhibitions. But if you want to show, say, reviews of that exhibition, you can use this URL:

    website.com/exhibitions/worlds-fair/reviews

    This will render reviews.html (or .php, etc.) but in the context of the World's Fair exhibition. Pretty cool.

    To get to your original question, yes, you can pull out the "extra path" component of URLs such as these:

    website.com/exhibitions/current
    website.com/exhibitions/upcoming
    website.com/exhibitions/press

    It will be stored in $path. So you can do something like:

    <v:if path="$path='/current'"> ... </v:if>

    Let me know if that helps.

  • This is so cool! You should put it in the documentation!

    Is there a way for you not to have to put the file extension of the new page? I had to use

    website.com/exhibitions/worlds-fair/reviews.php

    to get it to work, would be great if you only had to put

    website.com/exhibitions/worlds-fair/reviews

  • I think I am trying to do something similar, but I'm hitting a road block.

    I have a collection called "Seasons", which contains a sub-collection called "Images".

    I am rendering each Season using runway.html.
    e.g. website.com/runway/season1

    On the Season page, I show all the Images from the sub-collection, and I link each Image to its own page.

    Ideally I want the url's to look like this (where image1 is generated by the title I assign in the backend):
    website.com/runway/season1/image1

    ...or look like this (if we had to use something like look.html to render the image page):
    website.com/runway/season1/look/image1

    Any ideas on how to build this sort of url hierarchy?

    Thanks.

  • @Scott

    That's different, I think a permalink page can only deal with 1 context at a time. You might have to relegate that second part to the hash

    website.com/runway/season1#look/image1

    or hashbang

    website.com/runway/season1/#!/look/image1

  • Thanks Mike. That probably would have worked too.

    I ended up using the regular permalink structure. The client manually enters the Season and Look into a name field, which generates the type of url structure they were seeking.

    The urls ended up looking like this:
    website.com/runway/season1-look1

    Gets the job done.

  • hah, that looks even better!

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

In this Discussion