Skip to content

Commit

Permalink
Update landing page documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ddippolito committed Oct 18, 2024
1 parent 43a55d7 commit fb127dd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
6 changes: 3 additions & 3 deletions app/controllers/vacancies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ def map_teaching_job_roles_subjects_phases(campaign_params)

def extract_working_patterns(campaign_params)
working_patterns = []
working_patterns << "full_time" if ActiveModel::Type::Boolean.new.cast(campaign_params.delete(:email_fulltime)) == "true"
working_patterns << "part_time" if ActiveModel::Type::Boolean.new.cast(campaign_params.delete(:email_parttime)) == "true"
working_patterns << "job_share" if ActiveModel::Type::Boolean.new.cast(campaign_params.delete(:email_jobshare)) == "true"
working_patterns << "full_time" if ActiveModel::Type::Boolean.new.cast(campaign_params.delete(:email_fulltime))
working_patterns << "part_time" if ActiveModel::Type::Boolean.new.cast(campaign_params.delete(:email_parttime))
working_patterns << "job_share" if ActiveModel::Type::Boolean.new.cast(campaign_params.delete(:email_jobshare))
working_patterns
end

Expand Down
30 changes: 14 additions & 16 deletions documentation/landing-pages.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## Introduction

Teaching Vacancies uses dynamic landing pages to enhance the user experience by offering tailored job searches based on various criteria such as location, organisation, and specific job roles.
These landing pages are predefined with unique search filters and localised content, allowing users to find relevant job opportunities quickly and efficiently.

This document outlines how landing pages are structured, how the system retrieves them, and how the search process works in conjunction with these pages.
It also covers the configuration of landing pages through YAML files and explains how to further customise their behavior to suit specific needs.

1. **Routes**
Dynamic routes are defined for different types of landing pages:
- Location-based (`teaching-jobs-in-:location_landing_page_name`)
Expand All @@ -13,30 +21,20 @@
3. **LandingPage Model**
- **Landing page lookup:** The `LandingPage` class is responsible for determining if a landing page exists (`exists?(slug)`) and retrieving the associated search criteria via `LandingPage[slug]`.
- **Criteria-based search:** The landing page holds pre-configured search criteria (from the YAML configuration file), which is used to generate the filtered job search.
- **Caching:** The total count of jobs matching the landing page's criteria is cached to optimize performance (`count` method).
- **I18n for content:** The landing page also uses internationalization (I18n) for generating the page's title, heading, and meta description, interpolating the total job count into the strings.
- **Caching:** The total count of jobs matching the landing page's criteria is cached to optimise performance (`count` method).
- **I18n for content:** The landing page also uses internationalisation (I18n) for generating the page's title, heading, and meta description, interpolating the total job count into the strings.

4. **YAML Configuration (`config/landing_pages.yml`)**
- **Static configuration:** The YAML file defines static landing pages by their slug (e.g., `sendco-jobs`, `teacher-jobs`). Each landing page is associated with predefined search criteria (e.g., job roles, subjects, working patterns) that will be used for filtering job listings.
- **Translation integration:** For each landing page, you also have translation keys in `config/locales/landing_pages.yml` that provide the localized content for the page title, heading, and meta description.
- **Translation integration:** For each landing page, you also have translation keys in `config/locales/landing_pages.yml` that provide the localised content for the page title, heading, and meta description.
The configuration also includes placeholders like `%{count}` to display the total number of jobs for a given landing page.

5. **Localized Content**
The landing page titles, headings, and meta descriptions are all localized and customizable through the `config/locales/landing_pages.yml` file. Each landing page has its specific content defined under its slug, making the pages flexible and customizable per landing page.
5. **Localised Content**
The landing page titles, headings, and meta descriptions are all localised and customisable through the `config/locales/landing_pages.yml` file. Each landing page has its specific content defined under its slug, making the pages flexible and customisable per landing page.
For example, the title for the `assistant-headteacher-jobs` landing page is "Assistant Headteacher Jobs", while the heading dynamically interpolates the job count (e.g., "45 assistant headteacher jobs").

6. **Flow of Landing Page Generation**
- **Routing:** The request hits the appropriate route (e.g., `:landing_page_slug`).
- **Landing Page Retrieval:** The `set_landing_page` method in the `VacanciesController` retrieves the landing page from the `LandingPage` model based on the slug in the URL.
- **Search Criteria:** The landing page's search criteria (from YAML) are passed to the `VacancySearch` class, which performs a job search.
- **Pagination & Rendering:** The search results are paginated, and the page is rendered using localized content (title, heading, meta description) for that specific landing page.

### Next Steps for Customization:
Since you want to add more bespoke behavior to the landing pages, you can now build upon this foundation by adding conditional logic based on the landing page type or slug. For example, you could:
- Customize the search behavior for certain landing pages.
- Display additional custom content or widgets for specific landing pages.
- Add new fields to the search criteria in the YAML configuration and extend the search form to include them.

This approach gives you flexibility without rewriting the entire logic for each landing page, and the YAML configuration can be expanded to support new criteria or types of landing pages.

Let me know how you'd like to proceed or if you'd like help with a specific part of the customization!
- **Pagination & Rendering:** The search results are paginated, and the page is rendered using localised content (title, heading, meta description) for that specific landing page.

0 comments on commit fb127dd

Please sign in to comment.