Webflow Job Board Example:
How to integrate Greenhouse Job Board in Webflow
Step 1
Copy the component or duplicate the project.
Make sure the attributes added remain to make sure the code works.
Step 2
Add the code below
This code adds the jobs and departments for the jobs to you want to showcase.
class GREENHOUSEJOBBOARD {
constructor() {
this.tableBody = document.querySelector("[data-item='table']");
this.jobItem = this.tableBody ? this.tableBody.querySelector("[data-item='job-item']") : null;
this.tableParent = this.tableBody.parentElement;
this.jobs = null;
this.init();
}
init() {
this.loadJobsFromApi();
}
loadJobsFromApi() {
let url = 'https://boards-api.greenhouse.io/v1/boards/webflow/departments';
fetch(url)
.then((res) => {
if (res.ok) {
return res.json();
}
})
.then((data) => {
this.jobs = data.departments;
this.appendJobs(this.jobs);
})
.catch((err) => console.log(err));
}
appendJobs(jobs) {
if (this.tableBody != undefined && this.jobItem != undefined) {
if (jobs.length > 0) {
jobs.forEach(job => {
if (job.jobs.length > 0) {
let newTable = this.tableBody.cloneNode(true),
department = newTable ? newTable.querySelector("[data-item='department']") : null;
if (department != null) {
department.innerHTML = job.name;
}
job.jobs.forEach(data => {
let newJob = this.jobItem.cloneNode(true),
roleText = newJob ? newJob.querySelector("[data-item='role-text']") : null,
location = newJob ? newJob.querySelector("[data-item='location']") : null,
apply = newJob ? newJob.querySelector("[data-item='apply']") : null;
if (roleText != null) {
roleText.innerHTML = data.title;
}
if(location != null){
location.innerHTML = data.location.name;
}
if(apply != null){
apply.setAttribute("href", data.absolute_url)
}
newTable.querySelector("[data-item='job-item']").parentElement.appendChild(newJob);
});
this.tableParent.appendChild(newTable)
newTable.querySelectorAll("[data-item='job-item']")[0].remove();
}
});
this.tableBody.remove()
}
}
}
}
new GREENHOUSEJOBBOARD;
Copy codeStep 3
Update the greenhouse URL
Adding your job-board to the code to pull the data.