Forum

Thread tagged as: Question, Addons, Discussion

Best App For Job Vacancy Page?

Hi everyone

I need to create a jobs vacancy page but not sure which app is best to use, Perch Blog or Perch Events? Or just a normal multi-item perch_content template?

It needs to display the normal job title and description etc but also have an end date so it comes off the site after the end date.

My first thought was Perch Events but the /perch/templates/events/event.html template doesn't seem to work in the same way other templates do?

I'm using Runway 3.0.12

Many thanks

Glen Piggott

Glen Piggott 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

It's not a blog and it's not a list of events, so neither of those seems suitable. I'd use a multiple item region.

Thanks Drew.

I think my plan of action is to create each vacancy as a subpage of /vacancies for the full details and then use perch_custom_content to list them on /vacancies/index.php.

Glen

Duncan Revell

Duncan Revell 78 points
Registered Developer

Hi Glen,

you're using Runway - why not use a collection and routing to give the impression of sub-pages.

Simon Clay

Simon Clay 127 points

Hi Glen, I agree with all above, Perch Content, list-and-detail, or Collections is a great way to do it.

I have created a few sites with vacancies in this way. I build a form into the vacancy template too that pulls the Job reference via a hidden field, so we know what job they're applying for when the form is submitted:

https://www.arthuredward.co.uk/available-roles/

https://www.spritesdental.com/vacancies

https://www.hfhcare.co.uk/vacancies

I haven't done them with 'Expiry date' but that should be easy with perch_content_custom filtering.

Hi Duncan

I've started to use collections (for the first time ever!) for the vacancies page.

Everything seems to be pretty straightforward and working fine, the only thing is I'm not sure how to do the routing to link and display the subpages / vacancy details.

I've got my list of vacancies on the /vacanices page and using

<a href="<perch:content id="slug" type="slug" />" class="bg-black5 vacancy-listing">

for the link to the vacany itself.

In the collection option, I've set the URL to /vacancies/{position}-{office}. but it's not generating a link all I'm getting is <a href="">

Drew McLellan

Drew McLellan 2638 points
Perch Support

Does your collection template include a field with id="slug" ?

Hi Drew

Nope.

So I take it you have to add a field to the template for the URL manually and it's not generated automatically?

Drew McLellan said:

I'd use a multiple item region.

Ok, so I've gone down the multi-region route.

I've got all my vacancies listing nicely on the /vacancies page using perch_content_custom. But how do I now link to each multi-region item to a page which details the vacancy, for example /vacancies/[position]-{location}

Personally, I would use a list-detail (or Collections) approach here. Then, you can link through to each vacancy using a slug that is created automatically from one or more fields in your template.

More about slugs https://docs.grabaperch.com/templates/field-types/slug/

Hi Clive (and everyone)

Thanks very much. I'm now all up and running with the vacancies using collections.

I just have one problem with the id="slugOffice" with the town King's Lynn.

The full URL is /vacancies/{slug:slugH1}-{slug:slugOffice} which outputs /vacancies/residential-conveyancing-lawyer-kings-lynn.

However, the slug isn't being passed correctly when viewing the vacancy/page. In debug it's processing as:

Page arguments:
Array
(
    [0] => /vacancies/residential-conveyancing-lawyer-kings-lynn
    [slugH1] => residential-conveyancing-lawyer-kings
    [1] => residential-conveyancing-lawyer-kings
    [slugOffice] => lynn
    [2] => lynn
)

As as you can see it is splitting the kings and lynn. Where an office is just one word, it works perfectly.

I have also tried it without the apostrophe as it's doing the same.

Page template:

<perch:content id="vacancyh1" type="text" label="Position" title="true" />
<perch:content id="location" type="select" label="Office" options="Chatteris,Dereham,Downham Market,Ely,Heacham,King's Lynn,Swaffham,Watton" allowempty="false" required="true" help="Select which office(s) this vacancy relates to" />

<perch:content id="slugH1" type="slug" for="vacancyh1" suppress="true" />
<perch:content id="slugOffice" type="slug" for="location" suppress="true" />

Full debug:

Time    Δ   Debug Message - Perch Runway 3.0.13
0.0325  0   [20] SELECT p.pagePath, pr.routePattern, pr.routeRegExp, p.pageTemplate, pr.routeOrder, s.settingValue AS siteOffline FROM perch3_pages p LEFT JOIN perch3_page_routes pr ON p.pageID=pr.pageID LEFT JOIN perch3_settings s ON s.settingID='siteOffline' UNION SELECT NULL AS pagePath, pr2.routePattern, pr2.routeRegExp, pr2.templatePath AS pageTemplate, pr2.routeOrder, NULL AS siteOffline FROM perch3_page_routes pr2 WHERE templateID!=0 ORDER BY routeOrder ASC, pagePath ASC
0.0353  0.0029  Matched route: vacancies/[slug:slugH1]-[slug:slugOffice]
0.0354  0.0001  Using master page: /templates/pages/vacancies/vacancy.php
0.0354  0   Page arguments:
Array
(
    [0] => /vacancies/residential-conveyancing-lawyer-kings-lynn
    [slugH1] => residential-conveyancing-lawyer-kings
    [1] => residential-conveyancing-lawyer-kings
    [slugOffice] => lynn
    [2] => lynn
)
0.0359  0.0005  [38] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
0.0392  0.0033  [1] SELECT * FROM perch3_pages WHERE pagePath='/vacancies/vacancy-details' LIMIT 1
0.0402  0.0011  Using template: /templates/pages/attributes/default.html
0.0406  0.0003  Using sub-template: /templates/pages/attributes/seo.html
0.0418  0.0012  [7] SELECT * FROM perch3_pages WHERE pageNew=0 AND pageHidden=0 AND pageDepth >=0 AND pageDepth<=1 ORDER BY pageTreePosition ASC
0.0419  0.0002  [1] SELECT pageTreePosition FROM perch3_pages WHERE pagePath='/vacancies/vacancy-details' LIMIT 1
0.042   0.0001  [2] SELECT pageID FROM perch3_pages WHERE pageTreePosition IN ('000-006-001', '000-006', '000') ORDER BY pageTreePosition DESC
0.0425  0.0004  [7] Using template: /templates/navigation/top-navigation.html
0.0435  0.001   [1] SELECT collectionID, collectionTemplate FROM perch3_collections WHERE collectionKey='Vacancies'
0.0438  0.0003  [nil] SELECT * FROM ( SELECT idx.itemID, ci.collectionID, ci.itemJSON, idx2.indexValue as sortval FROM perch3_collection_index idx JOIN perch3_collection_items ci ON idx.itemID=ci.itemID AND idx.itemRev=ci.itemRev AND idx.collectionID=ci.collectionID JOIN perch3_collection_revisions cr ON idx.itemID=cr.itemID AND idx.itemRev=cr.itemRev AND idx.collectionID=ci.collectionID JOIN perch3_collection_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE (idx.collectionID=2) AND ((idx.indexKey='slugH1' AND idx.indexValue='residential-conveyancing-lawyer-kings') OR (idx.indexKey='slugOffice' AND idx.indexValue='lynn')) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, itemJSON, sortval HAVING count(*)=2 ORDER BY sortval ASC
0.048   0.0042  Using template: /templates/content/vacancies/vacancy.html
0.0485  0.0005  [2] SELECT regionKey, regionHTML FROM perch3_content_regions WHERE regionPage='/vacancies/vacancy-details' OR regionPage='*' ORDER BY regionPage DESC
0.0491  0.0007  [7] SELECT * FROM perch3_pages WHERE pageNew=0 AND pageHidden=0 AND pageDepth >=0 AND pageDepth<=1 ORDER BY pageTreePosition ASC
0.0493  0.0002  [1] SELECT pageTreePosition FROM perch3_pages WHERE pagePath='/vacancies/vacancy-details' LIMIT 1
0.0495  0.0002  [2] SELECT pageID FROM perch3_pages WHERE pageTreePosition IN ('000-006-001', '000-006', '000') ORDER BY pageTreePosition DESC
0.0499  0.0003  [7] Using template: /templates/navigation/footer-navigation.html
Time    Δ   Debug Message - Perch Runway 3.0.13
0.0325  0   [20] SELECT p.pagePath, pr.routePattern, pr.routeRegExp, p.pageTemplate, pr.routeOrder, s.settingValue AS siteOffline FROM perch3_pages p LEFT JOIN perch3_page_routes pr ON p.pageID=pr.pageID LEFT JOIN perch3_settings s ON s.settingID='siteOffline' UNION SELECT NULL AS pagePath, pr2.routePattern, pr2.routeRegExp, pr2.templatePath AS pageTemplate, pr2.routeOrder, NULL AS siteOffline FROM perch3_page_routes pr2 WHERE templateID!=0 ORDER BY routeOrder ASC, pagePath ASC
0.0353  0.0029  Matched route: vacancies/[slug:slugH1]-[slug:slugOffice]
0.0354  0.0001  Using master page: /templates/pages/vacancies/vacancy.php
0.0354  0   Page arguments:
Array
(
    [0] => /vacancies/residential-conveyancing-lawyer-kings-lynn
    [slugH1] => residential-conveyancing-lawyer-kings
    [1] => residential-conveyancing-lawyer-kings
    [slugOffice] => lynn
    [2] => lynn
)
0.0359  0.0005  [38] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
0.0392  0.0033  [1] SELECT * FROM perch3_pages WHERE pagePath='/vacancies/vacancy-details' LIMIT 1
0.0402  0.0011  Using template: /templates/pages/attributes/default.html
0.0406  0.0003  Using sub-template: /templates/pages/attributes/seo.html
0.0418  0.0012  [7] SELECT * FROM perch3_pages WHERE pageNew=0 AND pageHidden=0 AND pageDepth >=0 AND pageDepth<=1 ORDER BY pageTreePosition ASC
0.0419  0.0002  [1] SELECT pageTreePosition FROM perch3_pages WHERE pagePath='/vacancies/vacancy-details' LIMIT 1
0.042   0.0001  [2] SELECT pageID FROM perch3_pages WHERE pageTreePosition IN ('000-006-001', '000-006', '000') ORDER BY pageTreePosition DESC
0.0425  0.0004  [7] Using template: /templates/navigation/top-navigation.html
0.0435  0.001   [1] SELECT collectionID, collectionTemplate FROM perch3_collections WHERE collectionKey='Vacancies'
0.0438  0.0003  [nil] SELECT * FROM ( SELECT idx.itemID, ci.collectionID, ci.itemJSON, idx2.indexValue as sortval FROM perch3_collection_index idx JOIN perch3_collection_items ci ON idx.itemID=ci.itemID AND idx.itemRev=ci.itemRev AND idx.collectionID=ci.collectionID JOIN perch3_collection_revisions cr ON idx.itemID=cr.itemID AND idx.itemRev=cr.itemRev AND idx.collectionID=ci.collectionID JOIN perch3_collection_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE (idx.collectionID=2) AND ((idx.indexKey='slugH1' AND idx.indexValue='residential-conveyancing-lawyer-kings') OR (idx.indexKey='slugOffice' AND idx.indexValue='lynn')) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, itemJSON, sortval HAVING count(*)=2 ORDER BY sortval ASC
0.048   0.0042  Using template: /templates/content/vacancies/vacancy.html
0.0485  0.0005  [2] SELECT regionKey, regionHTML FROM perch3_content_regions WHERE regionPage='/vacancies/vacancy-details' OR regionPage='*' ORDER BY regionPage DESC
0.0491  0.0007  [7] SELECT * FROM perch3_pages WHERE pageNew=0 AND pageHidden=0 AND pageDepth >=0 AND pageDepth<=1 ORDER BY pageTreePosition ASC
0.0493  0.0002  [1] SELECT pageTreePosition FROM perch3_pages WHERE pagePath='/vacancies/vacancy-details' LIMIT 1
0.0495  0.0002  [2] SELECT pageID FROM perch3_pages WHERE pageTreePosition IN ('000-006-001', '000-006', '000') ORDER BY pageTreePosition DESC
0.0499  0.0003  [7] Using template: /templates/navigation/footer-navigation.html
0.0512  0.0013  Request time: 0.0512
0.0512  0   Process time: 0.0504
0.0512  0   Memory: 3.2983
Duncan Revell

Duncan Revell 78 points
Registered Developer

It's not the apostrophe causing the issue - it's the route vacancies/[slug:slugH1]-[slug:slugOffice]. It's being told to pick up the text after the - as slugOffice, but how does the route know which - to pick it up from? It's using the last - in the url, which is why it's only getting lynn. The issue is caused by the fact that the town has two words.

Either change your options list to King's Lynn|kingslynn for example, or change your separator in the url - vacancies/[slug:slugH1]/[slug:slugOffice] maybe.

Thanks Duncan - I see.

Okay, so if I used King's Lynn|kingslynn how do I then echo King's Lynn as the value on the template?

Reason for asking is that on the template I've got the office location mentioned a couple of times (taken from the select value) but want it to display as King's Lynn and not kingslynn

Would I reverse it via replace="kingslynn|King's Lynn"?

Thank you

Duncan Revell

Duncan Revell 78 points
Registered Developer

I'd probably not do that then - change the separator in the url instead...

Thanks Duncan

Drew McLellan

Drew McLellan 2638 points
Perch Support

I would actually flip the order of items in the URL

/vacancies/{slug:slugOffice}/{slug:slugH1}

so that you end up with

/vacancies/kings-lynn/residential-conveyancing-lawyer

which feels like a more natural hierarchy.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You could then have /vacancies/{slug:slugOffice} as a listing page for vacancies per location.

Thanks Drew.

Yes, I was thinking the same with regards to the hierarchy.