Support » Plugin: Airpress » How to create an “Index” or “Archive” page

  • Plugin Author chetmac

    (@chetmac)


    If you’ve created a Virtual Post configuration for an Airtable table called “Things”, your URL Pattern might look something like: ^things/(.*)/?$ and your filterByFormula would be {Thing Slug}="$1"

    This will give you a page per record. But what if you want a page that has “access” to ALL the records?

    While the simple answer is to create a new Virtual Post configuration with a URL Pattern like ^things/?$ and a filterByFormula of NOT({Thing Slug}=BLANK()) there is a huge caveat to make this work.

    Since both ^things/?$ and ^things/(.*)/?$ will match the URL “/things/” you must either place the “index” or “archive” Virtual Post configuration FIRST, or make the regular expressions more specific. So consider using ^things/(.+)/?$.

    Sorry for the long-winded explanation, but Regular Expressions can get tricky. I highly recommend playing around on https://regex101.com/, just remember that on Airpress you don’t need to escape your front slashes, but on regex101 you do need to.

    • This topic was modified 4 years, 2 months ago by chetmac. Reason: typo
Viewing 3 replies - 1 through 3 (of 3 total)
  • Great, thanks for this fast answer! This was a big help.

    But unfortunately I am not able to list the entries. I tried following snipped:

    <ul>
    [apr_loop field="Name"]
      <li> <a href="/things/{{record_id}}">{{Name}}</a> </li>
    [/apr_loop]
    </ul>

    But then the page is not rendered any more from this point of code. If I change {{Name}} to some chars like: <li> <a href="/things/{{record_id}}">Name</a> </li> then I get a list, but the links have neither record_id

    Plugin Author chetmac

    (@chetmac)

    Instead of [apr_loop field="Name"] just do [apr_loop]

    The former is attempting to loop through an array of records INSIDE of the Name field, whereas the later is looping through all the records available to the current Virtual Post.

    That is it. Awesome.

    Thank you very much!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to create an “Index” or “Archive” page’ is closed to new replies.