Help

Re: How do I do this?

1789 4
cancel
Showing results for 
Search instead for 
Did you mean: 
Robert_Andrews
6 - Interface Innovator
6 - Interface Innovator

Say I have an Airtable base listing details of “Executives” by record…

And say I wanted to throw up a rough prototype site to show the profiles of those executives on individual pages… How would I do that?

For example, the page http://www.example.com/profile/bill-gates/ should use the Airtable API to get and show details from Bill’s record.

It seems to call for a single “profile” web page, and maybe an index to list each executive first.
But I can’t wrap my head around how to interrogate the URL slug for an executive’s name handle to pass to Airtable…

If there is no such page at “bill-gates”, why would it not throw a 404? If the idea is I should create a page at /profile/index.html, how would I get it to understand “bill-gates”? And/or do I need a system whereby the URL slug is an Airtable “rec*” ID?

I realise this is probably due to my general programming stack capabilities more than Airtable per se, but still.

FYI, PHP is what I’m most familiar with, but simple Javascript may be a goer.

Thanks.

8 Replies 8

How far are you into your development? If you show the code that you have and the specific parts that you are trying to integrate, it will be easier to help you.

If you want a no-code method of throwing up a website with an Airtable back end, you can create a Wordpress website with the Airpress plugin.

Not at all. I’m currently considering whether Airtable would be part of this stack at all, so I haven’t yet done anything.

I have indeed seen Airpress; looks like I would use that at some point. But for now, using WordPress at all may be overkill, so I’m just wondering about the basics I asked.

Thanks.

Hi @Robert_Andrews1, @Robert_Andrews

This is definitely do-able. I don’t use PHP much so can’t advise on that specifically (I mainly use RoR), but the principles will be the same whatever language you use.

In Rails you can set a resource, e.g. profile, to have “slug” parameter. Normally a parameter would be something like:

https://www.yoursite.com/profile?name=bill-gates

but you can set up your Rails app to work the same way with:

https://www.yoursite.com/profile/bill-gates

(I’m sure a good PHP framework will offer the same type of thing).

Either way, once you have your parameter value “bill-gates” you can pass this to the Airtable API call using “filterByFormula” and just return the Bill Gates record.

Screenshot 2020-04-27 at 16.18.36

You could set up your table like this:

Screenshot 2020-04-27 at 16.22.19

Or you could just user the name field, lower case it, replace spaces with hyphens and so on.

Lots of way to approach this, but the key element is to use the “filterByFormula” param on the API to get the specific data you want for each page.

Hope that helps

JB

On the 404 question, I don’t think this would arise with the approach I outlined. You would just get the page you requested by with no data (as the slug/param did not match any AT records). You’d just need some logic in the page that says:

“if data returned, show show profile, otherwise show “unknown person” message”

What is the rest of your programming stack? Do you want a vanilla PHP/HTML/CSS solution, or do you use a framework?

Even though WordPress may be overkill, it is still a very fast solution. Depending on the setup of your data and how much formatting you want, a WordPress+Airpress+Airtable website can be thrown together in a matter of minutes, not hours or days.

@kuovonne,

Not fixed. I know HTML and CSS, and some PHP from years of tinkering with WordPress, but I won’t be using a PHP framework as I’m not familiar with them (ie. Laravel) yet.

If I go ahead with this, it will be in the realm of proof of concept, a lightweight illustration, rather than an intention toward a full build. So I’d like to keep it as low/no-code as possible.

Appreciate what you saying that about Airpress/WordPress. WordPress has been my go-to for a long time.

I know people are doing things with Webflow that bring in Airtable content, so I’d imagine I could work up an executive profile page and populate it with Airtable records. In theory, this appeals due to the supposed simplicity - in truth, I haven’t yet used Webflow at all, so there would be some learning curve at list.

Mutsuda
5 - Automation Enthusiast
5 - Automation Enthusiast

You could also set up a simple and static Jekyll site (hosted in Netlify for example) and place a simple Ruby plugin in the _plugins folder (that would run every time you deploy the site to Netlify) that gets the “Executives” in json through the Airtable API and generates a page for each Executive. :slightly_smiling_face:

Hey, have you done this? I’ve run into a few issues w/ some Plugins :weary: