Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
In this course, we’ll take you through the site building process by looking at a fictional (but typical!) scenario of using GovCMS to replace an outdated site. Specifically, we’ll be building a government jobs listing website called Government Jobs Portal.
First of all, thank you for taking the time to provide feedback and/or contribute to the training manuals! We’re continually working on improving these documents with community input and we appreciate any feedback, whether it's helping to contribute to further documentation or code, grammar issues, or simply a suggestion or improvement.
If you want to read the manual you can do so with the following link: https://salsa-digital.gitbook.io/govcms-site-builder.
If you want to contribute and make changes to the manuals, this page will guide you through the contribution process, outlining which tools we use and the steps you need to follow to contribute.
There are a few ways you can provide feedback:
You can email your feedback to govcms.training@salsadigital.com.au.
You can submit an issue via the GitHub issue queue: https://github.com/govcms-training/site-builder/issues.
The source code for this manual is hosted on Github and uses a service called Gitbook for publishing its documentation.
The manuals are written using Markdown mark up language.
The GovCMS Site Building manual is part of the govcms-training distribution which also includes the GovCMS content administration manual.
Both these manuals share a public Roadmap which lists out issues and feature requests on a kanban board.
Click here to view the current issue queue for the GovCMS content administration manual.
All contributions must be licensed under CC BY-SA 3.0 AU.
For contributing to the manual, the following is needed to get started:
Some basic knowledge of GitHub. Please see Beginner Github guide to get started.
Some knowledge of Markdown,
The following Markdown Cheatsheet may be helpful.
You can also use a visual WYSIWYG editor for Markdown such as Stack Edit.
This repo has two branches:
master
: reserved for production only. The master
branch is synced with the Gitbook page for this manual and is only editable by maintainers of this repo.
Any changes merged in to master
will automatically be reflected on Gitbook.
develop
: the default branch used for development and content changes.
Trying to edit or create a file in this repository will create your fork automatically. You can then edit pages or create new pages, and commit your changes and file a pull requests one document/issue at a time.
For content changes or new pages, you can use the GitHub online editor:
Open the page you want to edit on your forked version of the repo on GitHub and press the Edit icon (pen icon).
When have finalised your changes, scroll to the bottom of the page and write a description of the changes you're proposing under the "Commit changes" ection. Then select Create a new branch for this commit and start a pull request
and click on Propose file change
. This will direct you to the Pull request page
On the Pull request page, write a short comment explaining why are proposing those changes and publish your pull request clicking on Create pull request.
Any pull request should be based on the develop
branch. We will not consider pull requests made to master
.
For more information, please see see Using Pull Request and Fork a Repo if you're not familiar with Pull Requests.
Moderators will review and comment on pull requests. We may suggest changes, improvements, or alternatives, in which case the original contributor will be tagged directly so follow-up instructions are clear. There may be times where moderators will make commits to your fork directly for clarity.
If you have any other questions about contributing to our documentation, please reach out to govcms.training@salsadigital.com.au or join the online GovCMS Community Discourse.
This manual is aimed at developers familiar with Drupal and/or other web content management systems (CMSs) who want to build or extend a GovCMS SaaS website. You should have skills in basic HTML, CSS, some Twig and basic PHP.
Public URL: https://salsa-digital.gitbook.io/govcms-site-builder GitHub URL: https://github.com/govcms-training/site-builder
In this training manual, you will learn how to:
Extend default functionality in GovCMS to meet advanced functional requirements
Show best practices for GovCMS site building
Configure both controlled vocabularies and free tagging with Taxonomy
Manage navigation through the GovCMS menu system
Use URL path configuration to improve your site’s search
Configure automatically generated images and thumbnails
Create advanced listings of content
Maintain a secure and well-performing website
This manual also includes challenge exercises, which are designed for those who have additional time or who want to know more about a particular feature.
We’re continually working on improving these documents with community input and we appreciate any feedback, whether it's helping to contribute to further documentation or code, grammar issues, or simply a suggestion or improvement! Please refer to the Contributing guide for more guidance on this topic.
Alternatively you can also provide any feedback by emailing govcms.training@salsadigital.com.au.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Australia License (CC BY-SA 3.0 AU).
This manual has been created for the GovCMS Site Builder course. The manual uses a combination of content from drupal.org, adapted content from drupal.org and content we’ve written specifically for the GovCMS Site Builder course. Re-used and adapted content is in accordance with the Creative Commons License, Attribution-ShareAlike 2.0 (CC BY-SA 2.0).
Depending on how the course has been set up, you will either be using remotely installed sites (e.g. on the GovCMS Lagoon platform), or you’re using a local installation (on your computer). If you’re working locally, we recommend using the GovCMS8 bundled development environment at: https://github.com/govcms/govcms8-scaffold. A complete guide for installation is available at https://github.com/govCMS/govcms8-scaffold/blob/master/README.md
You’ll also need a web browser with an inspection tool (e.g. Firebug or Firefox) - you can download Firebug here: http://getfirebug.com. You can also use Chrome’s “Developer tools” or Safari’s “Develop menu”.
Finally, you’ll need a Lorem Ipsum generator extension such as this one: https://addons.mozilla.org/en-US/firefox/addon/dummy-lipsum/. You can add placement text, by right-clicking on the text area. ![A screenshot of a cell phone
Description automatically generated](.gitbook/assets/0%20%282%29.png)
This course and manual are for GovCMS8, which contains most of the modules you’ll need to build a typical government website.
You can view the additional GovCMS8 modules in “composer.json file”: https://github.com/govCMS/govCMS8/blob/1.x/composer.json - see the “require” section lists all “drupal/[modulename]” modules?
GovCMS8 comes with a fully-featured base theme:
GovCMS 8 UI-Kit Starter - based on UI-Kit theme - ships with GovCMS core
Audience analysis is a task that site builders use to gain a deeper understanding of the visitor segments. Understanding the audience’s interests, needs, and pain points helps site builders define accurate visitor personas, create a smooth user experience, and improve the website’s effectiveness.
When you’re building a site, it’s important to understand the client’s requirements. These cover creative requirements, technical requirements and content requirements.
Creative requirements Think about the site’s visual look and feel. The branding that needs to be applied, the colour scheme, and the agency’s creative requirements. What sort of websites do they like (a mood board with sample designs might help here). Ideally, you should also bring user research into the site building to understand the site’s audience and help you create personas and user pathways.
Technical requirements Think about the required functionality and how this maps to GovCMS. Which modules will you be using? Do you need to integrate with third-party APIs? At this stage, you’ll also need to decide whether GovCMS SaaS or PaaS is a better fit.
Content Requirements GovCMS comes with six content types out-of-the-box. While these content types are designed for government, you may need additional content types. Will your site use blocks? Think about the site’s taxonomy. You should also consider the content editors/users to work out what roles you’ll need and whether you’ll need content moderation workflow.
The steps below provide a high-level overview of establishing requirements:
Define the minimum viable product (MVP).
Build a roadmap: Decide what are the features beyond the MVP? Identify features that are “low hanging fruit” - easy to build with high business value.
Set measurable goals so you can measure the project’s success.
Review the current systems.
Consider mobile devices and establish Web Content Accessibility Guidelines (WCAG) compliance requirements.
Research the editor types required for the site, and any approval workflow that’s required.
Who are the site visitors (the audience)? Consider setting up personas for your site visitors.
Define the minimum set of permissions and roles.
This unit focuses on the concepts of GovCMS site-building. At this stage, you’re familiar with the essentials of GovCMS. You may have been working already on a GovCMS site but never built one before. Or you may have learned the basics, but don't know how it fits together. Now you want to know how to put the building blocks together to make new, unique websites or applications.
In this unit you’ll learn:
How to plan a new GovCMS website
How to make changes to the site theme
How to create new user roles
How to configure role permissions
About the page layout in GovCMS
How to create and manage site navigation and place blocks
Site building in GovCMS is about configuring the GovCMS solution to build a functional website. It needs a GovCMS developer who’s familiar with the contributed modules and site building in general.
Menus are a collection of links (menu items) used to navigate a website. The core Menu UI module provides an interface to control and customise the menu system. Menus are primarily displayed as a hierarchical list of links. By default, new menu items are placed inside a built-in menu labelled Main navigation, but administrators can also create custom menus.
The GovCMS installation profile contains five menus:
Administration (administrative task links)
Footer (site information links)
Main navigation (site section links)
Tools (user tool links, often added by modules)
User account menu (links related to the active user account)
You can customise menus in the menu administration functionality by:
Creating new custom menus
Adding new menu items
Reordering menu items by setting their "weight" or by dragging them into place
Renaming menu items
Changing the link title (the tooltip that appears when you mouse over a menu item)
Moving a menu item into a different menu by editing its Parent property
A menu item will only be shown to a visitor if they have the rights to view the page it links to. For example, the admin menu item is not shown to visitors who are not logged in.
User stories are another way to find out more about your audience and ensure your website is designed to meet users’ needs. For site builders, you can create user stories for the end site visitors and for the people who will be working on the CMS (backend) to create the site (e.g. Content Editors and Content Approvers).
As a job seeker, I want to be able to find a job I’m interested in so that I can apply online.
As a Content Editor, I want to create and find content in one place so that I can do my job more efficiently.
As a Content Approver, I want to see any content that’s waiting for my review/approval as soon as I login to the site so that I can review content quickly and easily.
Personas are often used when building a website. You’re effectively designing for one, specific person however that person represents a group of your site visitors. Most sites will have 2-4 personas.
Identify the most important types of users
Define personas: use photos and personal backstories
Interview real people - potential site visitors
The current government jobs website is a static website, managed manually by a number of employees at a government agency. Job categories and individual pages require a manual update. The same content has to be updated in multiple places, to stay in sync across various sections of the site. This has led to incomplete and mismatching content.
A Google search widget allows job seekers to find jobs, but the search is lacking configuration and flexible styling. Your client wants to enhance the search functionality with facets, to facilitate easy filtering of search results.
As the number of jobs listed on the site has grown over time, managing the site has become difficult. The government agency that maintains the site has requested a new website and CMS and they have approached you as a site builder.
Rather than assigning individual permissions directly to each user, permissions are grouped into roles. You can define one or more roles on your site, and then grant permissions to each role.
Each (backend) user account on your site is automatically given the Authenticated user role, and may optionally be assigned one or more additional roles. When you assign a role to a user account, the user will have all the permissions of the role when logged in.
It’s a good practice to create several roles on your site.
GovCMS comes with a number of default roles:
Content Author
Content Approver
Site Administrator
In the case of our new Government Jobs Portal, our site needs three user roles:
Job Seeker: Job seekers can’t create any content in the site but can save job applications (webforms) and update their profile.
Content Author: These are the agency staff members who will be creating content for the website.
Content Approver: These are the agency staff members who will be approving content for publishing.
The Content Author role is available by default in GovCMS sites and in your training environment. Since Site builders do not have permission to create a new role, the role Job Seeker is also available in your training environment.
Many websites contain a welcome message on the homepage. In this exercise you’ll learn how to place a block of content into a page and manage block visibility settings. You will also learn how blocks are placed into page regions.
The screenshot below displays some blocks being placed in various footer regions. You will build a similar block in this exercise.
Navigate to Structure → Block layout → Add custom block (/block/add).
Select "Basic text with Image". Note, the options you see here will depend on the theme that your site is using and will most likely differ on your agency website.
Fill out the form:
Block description: “Welcome to Government Jobs Portal”.
Body: “Government Jobs Portal is the official site to search and apply for jobs in the federal or state government. Be part of the bigger picture.”
Click the Save button.
Navigate to Structure → Block layout and locate the "Footer top 1" region. Click the Place block button next to the Footer top 1 region name.
Locate the block you created, by searching for its name “Welcome to Government Jobs Portal”.
Next, you’ll need to assign the block to an area on the site.
Scroll down to the Region select element. Select Footer Top.
Finally, configure the block’s Visibility settings so the Welcome Message block only appears on the homepage.
Under the Pages section of the visibility settings.
Select the Show for the listed pages radio button.
Following the screenshot below, enter the text <front> in the Pages field. This will make sure the block is only displayed on the front (home) page of your site. Leave the other settings as-is.
Save the block.
After the page is saved, you’ll be redirected to the Block Layout page. If you have multiple blocks assigned to the same region (such as Footer top 1), these can be rearranged on that page. Press the Save blocks button.
Now go to the homepage of your site and view your new welcome message/block in the footer.
Tip: Blocks aren’t content so they won’t be displayed in the content listing. To view all custom blocks go to Structure → Block layout → Custom block library .
Footers are often used to provide global ‘quick links’ for site visitors. For the Government Jobs Listing site, the Related Links menu in the footer will contain links to the basic page content of the Government Jobs Listing website (FAQs, About us, etc.).
Pages in GovCMS hold Regions. Regions are defined in the theme (in code, in an info.yaml file) and cannot be altered via the GovCMS administration backend.
The content is placed into Regions as Blocks. Some blocks are created by Content Editors, they are called content blocks. Other blocks are created by modules or Views and provide predefined content listings from the site (e.g. listing of events or publications) or from other systems (e.g. a Twitter block shows Tweets).
The screenshot below shows a page divided up into basic regions of Header, Content, Footer and RHS Sidebar.
The screenshot below represents content blocks placed within regions. The Logo is in the Header region and an Author Profile is in the RHS Sidebar.
You may explore the default theme GitHub repository to review the available regions: https://github.com/govCMS/govcms8_uikit_starter/blob/8.x-1.x/govcms8_uikit_starter.info.yml#L8
A theme is a set of files that define the visual look and feel of your site. The core software and modules that run on your site determine which content (including HTML text and other data stored in the database, uploaded images, and any other asset files) is displayed on the pages of your site. The theme determines the HTML markup and CSS styling that wraps the content.
The default theme shipped with GovCMS 9 are:
The theme defines what regions are available in your GovCMS site.
The last step is to configure the new menu block.
Go to Structure → Block layout and find the Related Links block. Click Configure.
Configure the Title. We’ll leave it at the default, but this is where you can:
Enter a new title.
Unselect the Display title checkbox to remove the block title.
In the Visibility settings you’ll notice options for:
Pages - show or hide the block on specific pages.
Content Types – display the block alongside specific content types.
Roles – display the block to specific roles.
You’ll often need to alter a block’s Pages visibility settings. For this exercise, we want the Related Links menu to appear only on the About us page we created earlier, and the homepage of our site.
Under Pages → Show for the listed pages, enter the URL paths of the pages that we want to display the block, e.g. /about-us-0
On a new line in the Pages text area, enter <front>. This will ensure your Related Links menu block is displayed on the front (home) page of your site.
Click Save block.
The Related Links menu will only be displayed on the front and About us pages.
In this exercise, we’ll add a Related Links menu item. This can be broken into two stages:
Go to the menu administration page – /admin/structure/menu - hover over Structure on the Admin menu then click Menus. Click on the Add menu button at the top right of the page.
Type in the name of our menu in the Title field: Related Links.
Type in a menu description in the Administrative summary field. While the description is optional, it helps site administrators understand the different menus, especially if the site has lots menus.
Click Save to create the new menu.
Now that you’ve created the custom menu, you need to add in the links to existing pages. You can do this in one of two ways:
Adding links to the menu when you edit the specific content pages/section.
Adding the items manually via the menu interface.
On the Admin menu hover over Structure → Content types, then click on Page.
Scroll down and click on the “Menu settings” item. Under Available menus, enable Related links.
Click Save content type.
Add content using the Page content type and create the following new pages:
About us
FAQs
Disclaimer
Privacy policy
Make sure you select "Provide a menu link" and select the parent item "Related links" for all pages. See the screenshot below for an example.
On the Admin menu hover over Structure → Menus then click on Related links. The new pages you created now appear in this admin area.
You can also add the links manually by following these steps:
In the menu administration page, click Add link at the top of the Related links. At the menu link creation page type in these settings:
Link: type About and select About us.
Description: Jobs Posting About Us page.
Menu link title: About us
Leave the other settings at their defaults and click Save.
Repeat the steps above for any remaining menu items.
Finally, you can re-order the links on your menu.
Go to Structure → Menus to see a list of all your site’s menus.
Click on Edit menu to the right of the Related links menu entry. You should see a list of the menu items we just created as in the previous screenshot.
You can drag and drop the menu items to re-order them. Then click Save configuration.
Note: Another way to change the menu order is to change the ‘weight’ of the menu item when you’re editing the content.
Blocks are pieces of your site’s web page layout. They are placed inside the regions of your theme, and can be created, removed, and rearranged in the Block layout (admin/structure/block) administration page. Examples of blocks include the Who’s online listing, the main navigation menu, and the breadcrumb trail. The main page content is also a block.
Some modules make new blocks available for placement on your site. For example, when the core Search module is installed and configured, it provides a block that contains a search form. You may also create and place your own custom blocks.
Each block has its own configuration settings, which allow you to select which pages of your site will display the block. It’s even possible to place multiple copies of a block, each with its own separate configuration and visibility rules.
On the Admin menu hover over Structure then click on Block layout.
The block admin page shows you the blocks on your site and where they’re displayed. In the default GovCMS (Olivero) theme, the main navigation, user account menu and site branding blocks are spread across various regions.
You can change the order of the blocks displaying by using the four-way arrow icons and dragging and dropping the blocks up or down. Once you’re happy with the position, scroll to the bottom of the page and click the Save blocks button.
Depending on what modules you have installed, various new blocks become available for activation in any of the site regions. You may explore available blocks by clicking the “Place block” button in the desired region:
Besides its primary content, a web page contains other content such as site branding (site name, slogan, and logo), navigation aids (menus, links, and icons), formatted text and images. Each theme provides a set of named regions, such as Header, Content, and Sidebar, where site builders may choose to place their content.
The available regions depend on the theme design. Only the Content region, which contains the primary content, is required; others are optional.
Regions can be displayed by hovering over Structure on the Admin Menu then clicking Block layout.
Once at this page, click on the Demonstrate block regions (Olivero) button.
In the previous unit we discussed content requirements, focusing on the areas we’d need to consider when planning a site, such as content types, blocks, user requirements (both for the site visitor and the CMS user), user roles and permissions and content moderation workflow.
Content requirements usually affect the site structure and data models, including content types, fields, block types, taxonomies and media types. Considering our fictional example of the Jobs Portal, let’s assume these are the outcomes of the content planning:
Defined content types, fields and widgets
Defined content display and View Modes
Defined Media types, fields and media display
Defined taxonomy vocabularies
Defined user roles and permissions
Defined content moderation workflow(s)
GovCMS uses content types to create a variety of pages to meet different needs. For example, news pages look different to event pages. Content types also allow you to capture different information for various purposes. For example, an Event content type captures event date (or dates) and location(s), unlike any other content types.
GovCMS comes with many content types out-of-the-box (OOTB). In this section you’ll learn about structuring content and planning content types.
New content types can be easily created in GovCMS. Follow these simple steps to create a new content type:
Plan the content type. Think about what you should call it, how it should be displayed and what fields you’ll need.
Create a content type
Configure default settings
Add custom fields
Configure form display and widgets
Manage display and view modes
Add taxonomy
Update permissions
When you create a new menu, GovCMS automatically creates a menu block for the menu. Now we need to assign this menu block to a region on the website.
Go to Structure → Block layout (/admin/structure/block).
Scroll down and find the Footer middle 2 area and click the Place block button.
Search the list for - Related Links. Select Menus block “Related Links”.
Click Place block.
Uncheck the option to "Display title".
Click Save block.
Click Save blocks in the Block layout page.
Check your site to make sure the Related Links menu block is in the Footer.
Next, we’ll restrict visibility so it doesn’t show throughout the site.
In this exercise, you’ll learn how to access various account settings and change them in GovCMS.
Navigate to Configuration → People → Account settings
This area allows users to login with a username or password and allows you to update the account creation process. Look at the “Who can register accounts” page and make sure you’re happy with the settings. To allow Job Seekers to register an account, change the setting to "Visitors".
On this page you can edit the automatic emails used for welcoming new users, account activation, password recovery, etc. Use tokens for setting email content. This is often overlooked, but it's a great way to provide a good first impression with new site members.
The screenshot below shows the email sent to trainees as part of the setup for a course. Change it to reflect an email you would wish to send to a newly registed Job Seeker.
Tokens are specially formatted chunks of text that serve as placeholders for a dynamically generated value. For example, a token of [title] will automatically place the content’s title in the field.
Edit the main menu by re-ordering the menu items.
GovCMS provides some basic configuration options to the site theme. For example, you may change the site logo, favicon, and control additional options.
To update theme settings, go to Appearance and click the Settings link next to the currently used theme.
Custom themes may provide a more advanced set of settings than those found in base themes.
The GovCMS default layout includes a logo in the header of your site. In this exercise, we’ll change this logo. If you have a logo on your computer you can use that one. If not, find a sample logo on the internet that you can use for this exercise.
Go to Appearance and click the Settings link next to the “Olivero” theme.
Unselect the “Use the logo supplied by the theme” checkbox, then use the Upload logo image button to upload the new logo.
Click Save configuration.
Now check what the logo looks like on the site. You can also go back to the theme configuration page to adjust the logo’s pixel width (the height will adjust correspondingly).
In this unit, you learned: some introductory information about GovCMS page layouts; how to plan content types and fields; how roles and permissions are set up; how to add blocks; how to build new menus; and how to change basic theme settings.
In this exercise we’ll compare content form and display using the default content types in GovCMS. We explore some fields and form widgets and how these can change between content types.
Click Content → Add content.
Create a Standard page titled “About us” Use a Lorem Ipsum generator to add placeholder text. Do not add the page to the menu and keep all other defaults. Publish the page.
Create a News and Media article titled “Salary rates in 2019 for Government employees” Again, Use a Lorem Ipsum generator to add placeholder text. Do not add the page to the menu and keep all other defaults. Publish the page.
Go to Admin → Content. Compare the editing forms and content display. News and Media and Standard Pages have different default settings.
Customising error messages is often overlooked, but it’s easy to tailor this experience for your website. See: https://salsadigital.com.au/somepage as an example.
In this exercise you’ll create a custom error message/page. The page could be a graphic, or a useful message.
Create basic Standard pages with an appropriate message for each situation (e.g. http://example.com/notfound and http://example.com/accessdenied)
Go to Configuration → System → Basic site settings.
Type in the paths in the bottom section on Error pages.
Save configuration.
Depending on the functional analysis and content requirements identified, you may need to create additional content types. While GovCMS has been setup to have common government content types available out-of-the-box you may still need to create your own content types. In this section you’ll learn how to:
Create new content types
Modify existing content types by adding media and files
Modify existing content types with taxonomy
Thanks to the View modes (a feature in GovCMS that allows you to display or hide different fields in content types), the same content can be displayed in different ways depending on the context and content type.
The above image shows how content of an event can be displayed in different ways - one as summary information (using the Teaser view mode) on the events listing page (left screenshot), and another showing a full event page using the Full content view mode (right screenshot).
Thinking of our sample Government Jobs Portal, what content types do you think we’ll need? Do we need to change any of the existing GovCMS content types to suit our needs?
In this exercise you’ll design your own content type for the Government Jobs Portal (not a Job Posting content type).
Sketch the content entry form. Think about what fields you’ll need and what widgets you might need. Sketch how the content would be displayed on the listing page versus a full page.
Sketch how the content might be displayed in two different conditions.
Full page display (Full content view mode)
Listing display (Teaser view mode)
Different content types meet different content requirements while ensuring consistency across a type of content. Content types are set up with text boxes and structured through pull-down menus and check boxes.
https://www.drupal.org/docs/user_guide/en/structure-content-type.html
In this exercise you’ll create a Job Posting content type. The screenshot below shows the form and what the posting will look like on the website.
As the name suggests, the Job Posting content type will be used to post jobs on the website. There are three stages involved:
Create content type
Review your content type
Adjust the permissions for your new content type
Go to Structure → Content types. Click Add content type.
Next, type in the content name and description:
Name: Job Posting
Description: Post a job to the jobs section of the site. (The description should explain the content type.)
Next, scroll down to the configuration tabs. Under Submission form settings follow these:
Title field label: Job title.
Preview before submitting: Disabled.
Explanation or submission guidelines: Leave this empty. This field lets you put in any specific instructions for the content type.
We want jobs to be published by default, but not automatically promoted to the front page, so under Publishing options use these settings:
Published: Leave selected.
Promoted to front page:: Deselect.
Sticky at top of lists: Leave unselected.
Create new revision: Leave selected.
Note: Some Content Authors (depending on their permissions) will be able to override these defaults when creating content.
We don’t want the author’s name or the content publish date displayed, so under Display settings deselect the Display author and date information option if it is selected.
We also don’t want job listings being added to the menu navigation, so under the default Menu settings, deselect Main menu.
Click Save and manage fields. This brings you to the Manage Fields admin page - admin/structure/types/manage/job_posting/fields. Review the default fields that were created for your new content type.
Go to Content → Add content and select Job posting. Review the form for your new content type.
Go to People → Permissions and change the permissions to match the other content types.
Looking back on what you’ve learnt so far during this unit, think about how you’d add a new content type, such as ‘Media conference’. What fields would you need to include? Plan out the process you’d follow to create the new content type.
Go to Structure → Content types → Job posting → Manage fields.
Click Edit on the body field (this will only change the way the field appears in the Job posting content type, and not others):
Change the Label to “Job description”
Deselect Summary input
Click Save settings. Your field listing should show the new label.
The Field module (GovCMS core) provides the configuration for fields and field attachments; the field types and input widgets themselves are provided by additional modules. Some of the modules are required, and the optional modules can be enabled from the Modules administration page (Administer → Modules).
GovCMS core includes the following field type modules: Text (required), Number, List, Taxonomy, Image, and File. Additional fields and widgets may be provided by contributed modules.
The Field module allows custom data fields to be attached to GovCMS entities (content nodes, users, taxonomy vocabularies, etc.) and takes care of storing, loading, editing, and rendering field data. Most users will not interact with the Field module directly, but will instead use the Field UI module user interface. Module developers can use the Field API to make new entities "fieldable" and allow fields to be attached to their entities.
Go to Structure → Content types → Blog article → Manage fields to view the fields configured for the Blog article content type.
For our Government Jobs Portal website, we want to let site visitors filter job offers by full time/part time. In this exercise, we’ll add this value in.
Let’s start by adding our first field – Terms of employment
Go to Structure → Content types → Job posting → Manage fields (if you have moved away from this page).
Click + Add field.
Under Text, select List (text).
Enter “Terms of employment” for Label.
For the Machine name, click edit and enter the machine name: jobterms.
Click Save and continue.
Click Save and continue and you’ll go back to the Field settings page for the Terms of employment field.
Review the Field naming conventions section below, before moving to the Field settings.
When adding a new field, GovCMS automatically suggests a field name. You can edit the field name when you’re adding it but cannot change it later on. When naming the field you should think carefully about a logical name, especially if you’ll be using the field in other content types.
The field name can only contain lowercase letters, numbers 0-9, and the underscore character. It’s a good idea to set up a naming convention early on.
Next we’ll set up the values (items) for our dropdown list.
Add the following options to the Allowed Values list text area:
1|Permanent
2|Temporary
3|Part-time
4|Full-time
Note You must include the numbers before each entry because they provide a numerical key for each option, which means you can change the names of the items without losing content.
Select “Limited” and “1” in the Allowed number of values dropdown and scrollwheel.
Click Save field settings.
Now you’ll see the Edit tab, with the field’s default settings. Follow these settings:
Select Required Field.
Help text: “Please select terms of employment” (to be displayed when creating or editing Job Posting content).
Default value for Terms of employment: leave this as - None -.
Click Save settings. You’ll then be returned to the Manage fields page.
The Manage Form display tab allows you to control fields that will be available in the content creation form, along with widgets. This page is used to make adjustments to the widgets used in content types.
Navigate to the Manage Form display page and review the available fields. Locate the “Terms of employment” field you created and review what widget selection is available.
Once you’ve saved your last field, you’ll be taken back to the Job Posting Manage fields page. All the fields you add to your content type will be visible here.
Finally, you should test the content type by adding content to it.
Go to Content → Add content and choose the Job posting option. Check the form and create a test job posting for a full-time job as a Drupal developer. Save the new job posting and note the URL path for the new content.
To view the field you’ve created, go to Reports → Field list.
GovCMS allows you to configure all aspects of the content creation forms. It gives you control over the position of form fields, widget configuration and additional options such as field size, image thumbnail preview size and much more.
Your instructor will give you an introduction to managing form display.
Display modes (found at /admin/structure/display-modes) exist to provide different presentations of Content Entities for either viewing or editing. The two types of display modes are View modes and Form modes.
To see the availale Display modes for the Blog article content type, go to Structure → Content types → Blog article → Manage display, then click on Custom display settings.
Form modes are a way to create different field configurations with the same content entity bundle. Form modes allow for multiple sets of field widget orderings and customisations, just as view modes allow for different orderings and customisations of field formatters.
This gives us more flexibility over how things will appear when someone is looking at the add/edit form for any content types.
Your instructor will now show you how view modes are used to control how content appears in different conditions on a sample website. Later in this course you’ll learn how to add view modes in GovCMS.
In most cases websites need to apply CSS in the theme to be able to get total control of the layout. View modes allows the same content to be displayed in a variety of layouts.
Go to Structure → Content types → Job Posting then click the Manage Display tab at the top of the page.
This admin page allows you to change the field display settings. For example, you can change the display order of the fields.
For the moment, don't make any changes - we’ll look at this page more later.
Go to Reports → Field list to see a list of fields added to your site.
Delete any unused fields on your site.
Remember, using common fields across multiple content types allows you to edit some global settings and values in one place.
Create a Job listing manually.
Go to Content -> Add content → Job posting.
On the Add Job posting form, enter the following information:
Job Title – Police Officers
Terms of employment – Permanent
Geographical Region: Victoria
Job Description – Victoria Police is looking for more than 3000 people across the state in their biggest recruitment drive ever. If you’re interested in keeping Victorian communities safe and want a challenging and rewarding career, then join the force.
Leave all remaining default settings.
Click Save.
You should now see your newly created Job Posting.
Often we need content to help test new content types. However, creating content manually can be very time consuming. Instead, we can use the Devel Generate – a module, bundled in GovCMS.
Note: The Devel Generate module should not be enabled or used in a production website.
This module is already enabled on your training environment.
Go to Configuration → Generate → Generate content.
Select the Job Posting checkbox.
Enter 10 in the How many nodes would you like to generate? field.
Click Generate button.
Note: Content generated by the Devel Generate module is not published by default – this is due to active content moderation workflow. Make sure you publish content if necessary.
In this unit we looked at the differences between the basic content types and how you can customise your own content types with additional fields. Most of the planning and work you’ll do on your site requires careful mapping out of content types, thinking about how they will be displayed on your site.
It’s also important to get your clients to test the content creation forms using real content to make sure the content types you designed model the data correctly and are flexible enough to be expanded.
The Image module allows you to display and manipulate images on your website. It exposes a setting for using the Image toolkit, allows you to configure image styles that can be used for resizing or adjusting images on display, and provides an image field (using the Field API) for attaching images to content.
Image Styles is a feature of GovCMS that allows to resize and crop images within the predefined dimensions, ensuring the file size of the image does not increase page size unnecessarily.
Multiple image styles are provided out of the box and Site Builders can define additional image styles. Having image styles allows content editors focus on image uploading, where resizing is done automatically by GovCMS. In addition, Image styles allow you to present images across the site in a preconfigured way and avoid inconsistency between image sizes.
By default, anyone who can add content can upload images. However, to ensure a consistent layout, during content analysis of our client we identified that all images in our content need to be within 480×480 pixels.
The diagram above outlines how Media types are referenced by Content Types via the Media entity reference field. To apply an Image Style to an image field, we have to select a View mode of the Image media. The Image media display configuration has the Image style selection.
When embedding media assets from other content types and entity types, we have the option to display them rendered, in which case we have to select the required view mode. In this exercise we’ll explore how Display modes in the Media type Image link to the Image styles.
Navigate to Structure → Media types → Image.
Explore the primary tabs of Manage fields and Manage form display. The user interface is almost identical to the content types.
Go to the Manage display tab.
Explore the available display modes, paying attention to the advanced configuration of the Image field.
Default
Featured
Landscape
Media Library
Square
Thumbnail
The Advanced configuration of the Image field uses “Image styles” in most cases
In the Event content type, we have an image field. The same image may display as a Thumbnail (left in the screenshot below) or Full content image (right in the screenshot below). The image is scaled down, resized and cropped. Each image has a copy stored in the filesystem.
You may explore how the Event content type displays these images based on the Display Mode.
Navigate to Structure → Content types → Event → Manage display → Teaser Small.
Locate the Image field.
Explore how it’s rendered by using the Thumbnail Display mode from the Image Media entity (see previous exercise).
Image styles allow you to scale, crop and resize images without changing the original image. By default, in GovCMS seven sizes are defined:
Featured
Landscape
Large (480×480)
Linkit result thumbnail
Medium (220×220)
Square
Thumbnail (100×100)
The Thumbnail (100×100) style, for example, is shown with the teaser for image posts and Square is used when listing Events.
When you change an image style configuration, the image module automatically refreshes all created images.
Every image style must have a name, which will be used in the URL of the generated images. Image styles are generally named in one of three ways:
Using a generic style label/name, such as “Featured” or “Thumbnail”. This is the most flexible and can be reused in different locations.
Using its ‘location’ within the image style name, e.g. “Events Banner”.
Using the image size to name it, such as “Large (480×480)”.
You can name your image styles differently, but we recommend setting up a naming convention.
In this exercise you will add an Image media field to a content type and learn how to configure it. There are four steps involved:
Create an image style
Configure an Image Media entity view mode to use an Image style
Check permissions
Add image field to content type
Image styles are set and configured in the Image styles admin page.
Go to Configuration → Media → Image styles.
To create our new image style, click on the Add image style button at the top of the page.
Name it Job Posting Image (given the image style will be applied to the “Job posting” Featured Image field.)
Click the Create new style button to save the new image style. You’ll then be taken to the Edit style Job Posting Image page as seen below.
The next step is to add the Scale effect. Under Effect select Scale from the dropdown menu.
Click Add. You’ll then be taken to the Add scale effect page.
Enter the following settings:
Width: 1200
Height: leave empty This allows you to have a flexible image height and keep the original proportions of the image.
Leave the Allow Upscaling checkbox unselected Image upscaling usually leads to poor image quality.
Click Add effect.
Your image style has been saved. You can make additional changes and then click the Save button to save those changes.
Navigate to the Structure → Media types → Image → Manage display (/admin/structure/media/manage/image/display). You should see some out-of-the-box available view modes.
Scroll to the bottom of the page and expand the Custom display settings pane. You can see a few View modes preselected by default. Each selected checkbox here represents an enabled View mode at the top of the page.
Since we need to apply our custom Image style, we have to create a new View mode so that we don’t affect the display of existing images that are configured to display with other View modes.
Click on the Manage view modes link (see the previous screenshot) in a new tab/browser window.
Click the Add view mode button.
Select Media from the list.
Give it a name “Job Posting featured” and click the Save button.
Return to the previous browser tab/window - go back to step 2b above and refresh the page to get the updated list of View modes.
Repeat step 2b above by scrolling down and expanding the Custom display settings pane. You should now see the Job Posting featured view mode as a checkbox option. Select it and save the page.
Note, that the Job Posting featured tab is now available at the top. Click it to navigate to the view mode configuration page.
At the moment, the Image field is the only one available for display and it is set to show as the originally uploaded image, without any image style. We need to change it to apply our custom Image style.
Click the gear link on the right to change from the Original image to the image style Job Posting Image.. Press the Update button to save the changes.
Confirm the image style option has changed:
Press the Save button to save the changes.
Go to People → Permissions and double check the permissions for the content type: Job posting.
Make sure the Content Author role has permissions to Create, Edit any and Delete any Job posting.
Click Save permissions
Go to Structure → Content types → Job Posting → Manage fields page. Add a field following these steps:
Click the Add field button.
In the “Reuse an existing field” selector, choose Entity reference: field_featured_image.
Ensure the label reads “Featured Image”.
Click the Save and continue button.
In the next page, select the Create referenced entities if they don't already exist toggle in the Reference type fieldset.
Select Image as Media type.
Leave the remaining values to their defaults and Save settings. This will take you back to the Manage fields page.
Navigate to the Manage form display (secondary tabs).
Locate the Featured image field, set the Widget to Entity Browser.
Click on the cogs icon to configure the Entity Browser.
Change the Widget for the field as displayed below, then click on Update.
Media is a drop-in replacement for the Drupal core upload field with a unified User Interface where editors and administrators can upload, manage, and reuse files and multimedia assets.
The core Media module provides a 'base' entity for media assets. This allows you to standardise the way your GovCMS site interacts with media resources. Local files or images, YouTube videos, Tweets, Instagram or Facebook posts, etc. can all be treated in a common way, regardless of where the media resource itself is ultimately stored. Being a standard content entity, you can reference and use this new entity in any place GovCMS knows how to work with them.
Just like with Content types, with this new entity type you can create Media Types, add fields to them, manage display modes (for view and form operations), and so on.
If you’ve worked with nodes before, you will find some similarities in the basic concepts when dealing with media entities. For example, Media Types are the equivalent to media entities the way Content Types are to nodes. In other words, the media entity (just like any other content entity in Drupal 8) has Media Types.
These Media Types are available in GovCMS out-of-the-box for you:
File
Image
Audio file (local)
Video file (local)
Remote video
They are ready to use, and if you want to directly create a Media entity you can go to /media/add/{type_name} and see how the media entity form looks.
One important difference of media entities when compared to nodes is that not all media types are equal. They are specialised so that they are able to know how to manage the media resource they’re dealing with in the best way. For example, media types that deal with images will be able to validate file extensions, as well as know how to map width/height image information to Drupal fields. On the other hand, this knowledge won't be necessary or useful to youtube media entities, which in turn will probably need to know how to retrieve a thumbnail or the video author information from the remote video server.
Throughout this training we’ll rely on the default media types.
(i) If you need to create new media types, follow instructions from this documentation page: Creating and configuring Media Types.
Remove the Scale width 1200 effect in the Job Posting Image style and replace it with Scale and Crop, applying 1200px wide and 400px height dimensions.
Review how GovCMS updates the Job posting images for the existing content.
What if you want to change the image size?
The original image is saved as a backup and can be changed. If you decide to change the Job Posting Image style later (for example change the image’s dimensions to 200 x 200) GovCMS will automatically resize all Job posting images. You can also completely change the image style used in a content type by editing the content type display settings. This also flushes the cached versions and creates new, resized versions (which are copies of the original).
In this unit we learned Media types in GovCMS and that managing Media types is very similar to Content Types - Media types provide a similar interface to manage fields, form widgets and display.
We learned that for the consistent display of images we should use Image Styles. We learned how to add a media field to a content type (which can be applied to adding media fields to any other entity type, such as taxonomy terms, blocks or users).
Job seekers want to see content (including available jobs) that relate to a specific state/territory, such as ACT or Victoria. To meet this requirement, all Job Posting content on the site should be categorised by State/Territory. To do this, we’ll create a new vocabulary called ‘State/Territory’ and add terms to it (all of Australia’s states and territories).
In this exercise you’ll create a vocabulary, add terms and reorder the terms.
Go to Structure → Taxonomy and click Add vocabulary. Enter in the following information:
Name: State/territory
Description: Australian states/territories
Click Save.
You can now see the new State/Territory vocabulary on the main Taxonomy page (Structure → Taxonomy). Next you’ll need to add terms to the vocabulary. Click List terms.
Click Add term button.
Name: ACT
Description: leave empty
Relations: leave all defaults
Click Save.
Enter the remaining terms (in this case the remaining states and territories). Each time you save, the form will reload, ready for you to add more terms. Enter the following terms with a short description for each:
New South Wales
Victoria
South Australia
Western Australia
Northern Territory
Queensland
Tasmania
Navigate to the list of all terms in the vocabulary by going to Structure → Taxonomy → State/territory. By default the list is ordered alphabetically, but you can change the order by dragging the terms up or down. As an exercise, drag “Queensland” to the top of the list.
Click Save.
Taxonomy is a core Drupal/GovCMS module that gives your website(s) use of the organisational keywords known in other systems as categories, tags, or metadata. It allows you to connect, relate and classify your website’s content. In GovCMS, these terms are gathered within “vocabularies”. The Taxonomy module allows you to create, manage and apply those vocabularies.
Taxonomy should be driven by the business requirements of your website, thinking about possible future functional expansion. Here are some questions to help you determine how you may want to use taxonomy:
Are there subsections of your site that you’d like to look different from the main theme?
Are there content areas of your site that should be edited only by a specific part of your organisation?
Is there content that can be shared across your site (such as a press release, form or fact sheet)?
Is there a business need to support local sites such as service centres or local events?
Are there different ‘states’ you need to set (such as left navigation/breadcrumbs) for site sections?
Do you need to provide default lists of content by taxonomy term or default RSS feeds by term?
Many contributed modules rely on Taxonomy-generating; for example, menus based on existing tags.
You may also like to refer to https://www.drupal.org/docs/8/core/modules/taxonomy/taxonomy-module-overview for more information on taxonomy.
You can also add a "List (text)" field to a content type. What’s the difference between List (text) and a taxonomy field?
To manage values in the List (text) field, a privileged user role (like Site Administrator) is required to alter the site configuration. Taxonomy, on the other hand, could be managed similarly to content by Content Editors.
Taxonomy can be used in a workflow, to customise defined sections of your website with different themes or to display specific content based on taxonomy terms. Although taxonomy can be used in various ways, probably the most important use of taxonomy in GovCMS is to relate content.
Use your experience from the previous exercises to add the State/Territory field to the Job Posting content type.
Hint - use Entity Reference for the field type or Select lsit if you prefer a dropdown. Follow the screenshots below if needed to configure the field correctly for the Job posting content type
In the Manage form display of your Job content type, you can set Select list as the field widget type as shown below.
When creating you Job content, the state field will look similar to the following screenshot.
In this exercise we’ll add the State/Territory field to job postings and to News and Media. For this exercise we have a controlled vocabulary, limiting input to one State/Territory, so we’ll use a select list.
Go to Structure → _Content types.
Click on Manage fields to the right of the Job posting content type name.
To associate the State/Territory vocabulary with a particular content type we need to add our new Term reference field.
Under /admin/structure/types/manage/job_posting/fields, click Add field. Under Add a new field, select Reference → Taxonomy term, then complete the fields as shown in the screenshot below:
Now that job postings can be categorised by states/territories, News and media articles need to use the same State/Territory vocabulary. Follow the instructions above but add the existing taxonomy field to the News and Media content type.
Configure the form display and page display to show the new field.
Content editors/authors will spend about 80% of their time on 20% of tasks. Find out what these common tasks are. Think about the CMS’s audience and find out about their goals and needs.
Make sure you give the content team permissions for:
"Use contextual links"
“Access GovCMS Media Editor Browser pages”
“Access GovCMS Media File Browser pages”
“Access GovCMS Media Image Browser pages”
“Access Image browser pages”
“Access the Files overview page”
“Use the administration pages and help”
“Use the toolbar”
“Use the site in maintenance mode”
"View the administration theme"
modules to users who maintain the site
There are a variety of input options that control how you use terms on your website. Below you can see the options available for the Manage form display page:
There are a couple of options to manage the taxonomy terms:
Controlled vocabularies allow you to set the terms and restrict the options available to content authors. You can limit inputs by setting up a specific widget, such as select list, checkboxes or radio buttons.
Tagging allows users with the corresponding permissions to add new terms. You can also have an autocomplete text field.
Help drive adoption of your GovCMS site by getting staff involved early, including during the testing process. To supplement the Content Administration Manual, you can also create documentation for common, everyday tasks to improve content users’ experiences.
Finally, test out the new vocabulary by going into a Job posting or News and Media post you created earlier. When you click Edit, you should see a new taxonomy field called “State/Territory”. Select Victoria. Save the content page and then confirm it appears in the frontend.
The screenshot below shows the Job Posting content form, including the dropdown list for the State/Territory vocabulary.
This screenshow shows the News & Media content form, including the dropdown list for the State/Territory vocabulary.
Test content editing with the people who will actually be creating and editing content on the site. Have you set up all the necessary fields? Are they in the best order? Can all the content ‘fit’ into the content types you’ve set up?
In this unit we learned about the Taxonomy system and how to use it to categorise content. We also learned how to create new vocabularies, taxonomy terms and how to add a taxonomy field to content types.
In this exercise you’ll learn how to set up the rich text editor.
Make sure you’re logged in as a user with the role that allows editing of text formats.
Go to Configuration → Content authoring → Text formats and editors.
Click the Configure link in the Operations column next to Rich text.
Review the Roles section, which allows you to configure the roles allowed to access Rich text format.
The Toolbar configuration allows you to manage editor buttons/plugins.
As a rule, give users as few buttons as possible, for as long as possible.
The CKEditor plugin settings allow you to configure some additional options, such as Embed Media.
Check the Enabled filters section.
Note that the Limit allowed HTML tags and correct faulty HTML option is selected. It’s important to keep this options enabled for increased security.
If additional HTML tags are required to be supported, update the Allowed HTML tags field with the tags that you need. Avoid whitelisting the <script> tag, since it may introduce a backdoor to malicious scripts.
The Filter processing order section allows you to arrange the execution order of filters. Avoid modifying the default order unless necessary.
Now you can test the editor out by creating a new Page.
Add some text, and then make it bold. Also try adding a list, an image and a link.
Tip: You can get some sample images at Dynamic Dummy Image Generator: http://dummyimage.com/
Click Save.
See how your page looks. Is the page being displayed as you expected?
In this exercise, we want to set up a new text format that allows trusted editors to input iFrames. This will let trusted users embed widgets and videos from popular sites.
Your new text format should have these properties:
Only available to Content Authors and Site Administrators
Allow a variety of regular HTML tags
Allow a video from YouTube
Some notes on text formats:
The filters in the text format setting are applied sequentially, with the output of each filter being passed onto the next filter.
Text formats should be assigned by role. Anonymous users should only have access to plain text input format, whereas trusted users can have access to Rich text privileges so they can add links, images, and so on.
The HTML filter only allows the following tags by default:
<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img src alt data-entity-type data-entity-uuid> <u> <s> <sup> <sub> <table> <caption> <tbody> <thead> <tfoot> <th> <td> <tr> <p> <drupal-entity data-entity-type data-entity-uuid data-entity-embed-display data-entity-embed-display-settings data-align data-caption data-embed-button>
The site administrator can add or remove HTML tags from this list in the Filter settings section from Configuration → Content authoring → Text formats and editors → Rich text.
A more detailed explanation of Input Formats and Filters can be found here: https://www.drupal.org/docs/user_guide/en/structure-text-format-config.html
Cross-site scripting (or XSS) is a security vulnerability sometimes found in websites. In a site that is not well protected, malicious users can enter script into web pages that are viewed by other users (for example, in a comment or in the body of a page). A cross-site scripting vulnerability may be used by attackers to login as another user. It’s important to configure the text formats of your website to prevent such abuse.
The good news is that GovCMS comes with two preconfigured text formats:
Rich text (CKEditor-enabled)
Plain text
As a site builder, you can always add your own text formats and configure the roles allowed to use them.
Follow these and other best practices to keep your site safe:
The Rich Text format is intended for trusted users only (Content Authors or Administrators). Even though it has HTML tags filter applied (see the Allowed HTML Tags in Rich Text format configuration under Configuration → Content authoring → Text formats and editors → Rich text), some sites may request that no restriction is in place and no HTML tag restriction can be in place.
This can represent a severe security risk.
2. The **Plain text** format is intended for anonymous users, and does have CKEditor enabled. 3. When working with user-generated content, it's always best to keep input format settings as secure as possible. Select the least amount of functionality possible for each role; for example, don't allow anonymous users to have access to **Rich Text** format.
Note: Certain inputs are restricted by default on GovCMS (such as the tags needed to display video properly) to protect the system from malicious code. Rich text format should only be accessible by trusted users.
Source: https://xkcd.com/327/
Comic reproduced under a Creative Commons Attribution-NonCommercial 2.5 License.
In this unit, we covered how to customise text formats using the CKEditor module in GovCMS.
Website security is a serious consideration. After weak passwords, cross-site scripting is the next biggest security risk. By default, GovCMS’s permissions are strict.
This session also showed you how to control what’s displayed on your site and demonstrated how filters control the HTML elements rendered on your site. By allowing trusted users to add iFrames you can include embedded remote content on your site while also protecting your site from malicious codes in <iframes>.
In this exercise we’ll build an Employment news page/listing by creating a new view. This view page will list all job posts.
Go to Structure → Views to see the Views admin page - /admin/structure/views.
Click the Add view button at the top of the page to access the view creation wizard. To create the Employment news view, enter the below details:
View name: Employment news.
Description: “Displays a list of news about Employment on the site.” This allows Site administrators to easily see what the view does.
Show: Content.
of type: Job Post.
sorted by: Newest first.
These dropdown selections set up the page with the Job Post content displaying, showing the most recent job first.
Next, check the Create a page checkbox to create the new views page. Leave the Page title and Path fields as-is - they should already contain Employment news as the name of our view.
In the page display settings area, select:
Unformatted list and teasers.
Items per page: 10.
Use a pager.
Create a menu link to expand options.
Menu: Main navigation.
Leave default Link text as Employment news.
Click Save and edit.
Review your changes.
After saving the view, navigate to the frontend of the site. Check if the Employment news appears in the main navigation at the top. If the menu does not initially appear in the primary navigation section, it can be due to caching. You can either ask your developer to clear the cache or wait 24hrs for the cache to be automatically cleared.
Click on the new menu to explore any Employment news that you may have published on your site.
If you only see one Job Post, create additional Job Posts to see how Views takes care of listing them automatically.
In this unit we’ll focus on Views, a popular core module in GovCMS and Drupal.
Using the Views module, we can fetch content from the database of our site and present it to the user as lists, posts, galleries, tables, maps, graphs, menu items, blocks, reports, forum posts, etc. Different content types including nodes, users, and other bundles can be displayed.
Views UI, a submodule within Views, provides a graphical interface underneath which lies a powerful SQL query builder that can access virtually any information in your database and display it in any format.
Different displays can present the query results as pages with fixed URLs on your site (or URLs accepting arguments), blocks, feeds, or panel panes.
You can also use Views to present related content or implement contextual filters. An example of presenting related content is when you want to display a list of users along with links to the content they have created.
As an introduction to Views, your instructor will go through some of its features. Views allows you to create filters using dynamic input and also connect content to other content pieces.
It’s important to remember that you’re limiting a data set by using filters and selecting the appropriate (and only the necessary) fields. If you’ve got a very large website and try to display full nodes on one page, you will destroy the site. Keep this in mind to avoid any issues.
Recommended reading:
Documentation for the Drupal 8/9 core Views module
Basic interface to create a view:
Choose what to query. Select content, users, taxonomy, files or any other type of data.
Limit your selection by filtering by content type, taxonomy term, etc.
Specify how to display, lists, tables, grid etc.
Set a display, such as a page, block, RSS feed, etc.
The screenshot below shows the Create View form.
In a previous unit we created the new content type of Job Posting for our Government Jobs website. However, we didn’t set up a way for the list content to be displayed anywhere on our site. In the next exercises we’re going to create a list of job postings on one page and a list of News and Media articles on another page. This will help you learn more about the Views module.
Views allows you to reuse existing configuration - in a good way. If you create a page listing of your content and need to provide a block of page titles or add an RSS feed (even create more pages) – View Displays can be used rather than duplicating views.
If you explore the existing GovCMS Block Article View – three Displays exist: Page, Feed and Block. Go to Structure → Views → GovCMS Block Article Views.
Views displays allows you to easily create a duplicate of any other display and add some customisations and overrides.
Views also allow you to speed up your site if you have two views that load similar fields. This is because with Views you can cache both the query and rendered output, which reduces the load on your database. You can learn more about Views caching in Unit 10.
The Views module includes some pre-built templates, which can be activated and edited to suit your requirements. Click on the links in the Format section to review these (see screenshot above).
In this section we’re going to look at the Views editing interface.
A. Displays: Create multiple displays from the same view. This might mean multiple pages with different filters or blocks, RSS feeds, etc.
B. Format: Output content into lists, tables, or show the full content (node) display.
C. Fields: Specify fields such as title, date, taxonomy, etc.
D. Filter criteria: This is the most important aspect, since you limit the selection this way.
E. Sort criteria: Specify ordering of the list - by created date, by title or any other property.
F. Header: Add arbitrary HTML to the top and bottom of your views.
G. Pager: Specify how many items to display or whether or not to show a "previous/next" pager.
In the Unit 6 exercises, we used filters in Views to limit the data displayed (e.g. to show certain content types or show content categorised with a specific taxonomy term. For our Jobs website, we want to show related content when we view a job listing for a specific state/territory, without having to build a new view for each new state. The solution is to use context to control the items displayed. We can set up GovCMS to check the taxonomy terms from the article, and dynamically include content that’s categorised with the same term.
We can configure a view so that it’s filtered dynamically, depending on the context. For example, we could use a contextual filter to add a block that contains related content or that presents a list of articles by the same author.
In this exercise we’ll customise the Employment news View page we created earlier, making it show three items of recent content, then a bulleted list of titles of seven more jobs. Below is what the layout of the page will look like.
There are seven stages in this process:
Locate the View
Change the number of items to display
Add a new display: an attached list
Add a header to the attachment
Change the offset to exclude the first three articles
Change the attachment setting
Review your changes
Navigate to the admin/structure/views and edit the Employment news view.
Under Pager click "mini" to change the settings.
Select "Display a specified number of items".
Click Apply.
Change Items per page: 3.
Click Apply.
Now check your preview to confirm three items are displayed. Scroll down to the Preview section to check only three items are displayed.
Next we'll add a list of seven more recent jobs to the bottom of this view.
At the top, click the +Add button and select "Attachment".
You’ll now have more than one display available, with the one you’re editing highlighted. Make sure the correct one is always highlighted when you’re editing views.
Next click Unformatted list under Format in the left column. A new window will pop up, giving you the option to select the display you're changing.
Select "This attachment".
Select "HTML list".
Click the Apply (this display) button.
The next screen is “Attachment: Style options”. Leave all settings as default and click the Apply button.
Under Format → Show, click Content to change the settings. Select the Fields radio button.
Then click Apply on the final screen, leaving the settings as they are.
You'll see that Views added a Title field for us. If we needed more fields to be displayed, we could have added them using the Add button. Let’s continue with only the Title field for now.
Check the Preview pane at the bottom of the page to confirm our display is correct.
Under the Header section on the View page click Add.
Make sure you’re editing "This attachment (override)".
Search for and select "Text area". Apply changes.
Make sure the Text format for the Content field is Rich Text. Then type in the Content field: <p>More Jobs</p>
Apply the changes.
Check that the preview shows text ‘More Jobs’ above the list.
Our Attachment view will be displayed below the first three Jobs, so we need to exclude those from our list to avoid displaying duplicate content:
Make sure you're still editing the Attachment display. Under the Pager settings in the centre column, click "10 items" to change the setting.
Change the “Items to display” to 7 and the "Offset" to 3. Apply the changes.
Under "Attachment settings" in the centre column click the option: "Attach to:" Not defined.
Select "Page". Apply the changes.
Click "Attachment position:Before".
Select "After". Apply the changes.
Click the Save button to save your changes.
Return to the Employment news page and review the changes.
You may create more Jobs content to test it. Make sure you publish any new content before reviewing the Employment news page.
Site editors need a CMS that’s easy to use so they can input content without HTML knowledge.
Out-of-the-box, GovCMS provides a Rich Text editor (CKEditor) for writing content.
Rich text editors ensure that content can be added quickly and easily by people who don’t have any HTML experience. Rich text editors give users the ability to add images, create links, make text formatting changes such as bold text, etc.
Text formats change how HTML tags and other text is processed and displayed on your site. Text formats are composed of a series of filters, each of which transforms text. When users create content, a text format is associated with the content, and the full, original text is stored in the database. The content is then passed through the filters in the text format before it’s displayed on the site.
The core Filter module provides text format functionality, and the GovCMS installation profile sets up Rich text and Plain text text formats. Each text format has an associated permission, so that you can allow only trusted users to use permissive text formats. This restricts untrusted users to text formats like Plain text, which filters out dangerous HTML tags.
Each text format can be associated with an editor, such as a visual WYSIWYG (What You See Is What You Get) HTML editor. The core Text Editor module provides the ability to associate editors with text formats, and to configure the editors (such as adding and removing buttons from their toolbars). The core CKEditor module provides the industry-standard editor known as CKEditor, so that it can be used to edit HTML content on your site.
Duplicate a previously created View and modify its filters to display a full blog article content item and five more most recent blog article titles below it. Use the same techniques as in the previous exercise.
Site visitors would like to see content related to a specific state/territory. To do this, we need to set up an automatically generated list of States/Territories in a block with the following features:
When we click on a term such as “ACT” we go to a term listing page that shows all content tagged or categorised with that term.
If we then select a specific article such as “Volunteering” we see the full content page.
In the sidebar of the “Volunteering” full node page we also see a “related content” block. This will pull in a list of content that’s been tagged or categorised with the same taxonomy term.
In the following exercises we'll make a “list of terms” block and then we'll make the related content block.
If you have extra time, challenge yourself to extend this content type by making one or more of the following changes:
Change the content type so you can add external links to registration pages
Set up the content type so you can add multiple images
Add a related field that will show the Agency that’s sponsoring the event
In this exercise we’ll add a list of the States and Territories in the sidebar, so the page looks like the screenshot below.
Go to Structure → Views. Click + Add new View. Add in these settings:
View name: States/Territories.
Select to enable Description: A list of State and Territory terms.
Show Taxonomy terms of type State/Territory sorted by Unsorted.
Select Create a block.
Block title: States/Territories.
Display format: HTML list of Fields.
Items per block: 0.
Use a pager: Leave unselected.
Click Save and edit.
Go to Structure → Block Layout.
In the Sidebar area click the Place block button.
Find States/Territories block in Lists (Views) category and click the Place block button.
Configure block visibility settings to only display it on the Job Posting content type.
Click Save block.
Scroll down and click Save Blocks to complete.
Navigate to a Job posting content page and locate your block.
Next we’ll add the related content block, as per the screenshot below.
Make sure you have some Job posting content tagged with the State/Territory terms.
Follow the process outlines in Exercise 6.5 to create a new View called Related content.
Your view should look like the following screenshot on the edit View page. Note that the Advanced section has been expanded, as it is used in the next steps
The contextual filter allows us to show a list of the content with the same tags as the current content.
Expand the Advanced items on the right hand side.
Click Add next to Contextual filters.
Search for "Has taxonomy term ID" then select the checkbox.
Click Add and configure contextual filters.
Under "When the filter value is NOT available" select the "Provide a default value" option. For the Type, select "Taxonomy term ID from URL". Also check "Load default filter from term page" and "Load default filter from node page, that's good for related taxonomy blocks"
Click Apply.
Click Save on the View page.
Go to Structure → Block layout and scroll down to the “Sidebar” area.
Click the Place block button.
In the pop-up, filter by text “Related content” in the Lists (Views) category.
Click Place block.
Under Visibility settings, configure block to display on all pages except the homepage. Remember to use the <front> token as the homepage identified. You may also use “/”. In addition, filter the block to only show on the Job Posting content type.
Click Save block.
Go to the frontend of your site and check that the Related content block has been added, as in the below screenshot.
Check that you have some content in certain states/territories, so you can see how the block works.
When you click on a state (tag) on a specific article you should see a list of related content, listed by the taxonomy term. You should not see the block.
You should see the Related Content block when you view a Job posting.
While testing the Related content block, did you notice anything unusual?
The Related content block displays the article title of the currently displayed page:
Let’s remove it by adding one more Contextual Filter.
Return to editing the Related Content view.
Expand the Advanced pane and you should see the Contextual Filter Content: Has taxonomy term ID that we created earlier.
Add another contextual filter.
Search for ID (in Category Content).
Select Provide default value in the When the filter value is NOT available pane → Content ID from URL.
Under the More pane, select Exclude.
Apply the changes.
Save the View.
Test your block from the previous example. Now it should not display the current page in the block.
For this exercise, we’ll provide hints - try to configure the event listing content type without looking back on the notes/previous instructions.
First, we’ll look at a simple view to filter out past events, then we’ll make a calendar entry using templates.
In this exercise we’re going to prepare the date settings and configure the event content type to get it ready for the next exercise.
Using experience from the earlier tutorials about content types and fields, go to the Manage Fields page of the Event content type. Review fields available in GovCMS.
Move to the Manage form display page and reorder the fields in the Event content type, moving all custom fields (pattern field_[field-name]) except the Components field above the Body field. Leave the Components field below the Body.
Go to Content → Add content → Event and test the form, making further adjustments to the field position if required.
Check permissions - whenever you create a new content type, you always need to check the permissions. Allow Content Authors to create events. Ensure that site visitors can leave comments (the Comment module must be activated and configured).
This once-off step is required to ensure the website date and time is set in the correct way
Note: You can also add custom data formats via the Add format button.
Given events are in the future, we can’t use the date created date to list events. We need to add a date field. Follow instructions from earlier activities to create an event date field with these details:
Field name
field_event_date
Field type
Date range
Widget
Date and time range
Test the form by creating a new event entry. Notice the date field is in the middle of the form, but would be better placed higher up.
Change the order of fields, so the Event date is under the title.
We’d like to set up the URLs so that all events are in a /events URL path, for example a URL path could be: /events/job-fair
Hint: The Event path pattern is preconfigured in GovCMS, but if you find it different to the required pattern, then follow instructions for editing URL alias patterns. Use a pattern such as: events/[node:title]
To test your changes, create another new event. Now, the date should appear under the event title and when you publish content it will have a unique URL following the /event path.
Content editors and authors like to see common content management tasks easily and should also be able to quickly see a list of new content. There are several features you can setup to enable this.
You could create a custom view for administrators that lists all new content with quick “edit” links. You could also set up a default filter so administrators can also see unpublished content.
Below you can see the screenshots for setting up administration permissions.
GovCMS’s default content listing shows each page of content with easy access to operations such as delete and unpublish. In some cases, site administrators will need to manage content in a bulk way, rather than individually.
The module Views bulk operations (VBO) allows you to create custom content listings and perform bulk operations.
GovCMS has extended the Content administration page so more content actions can be performed.
This unit gave us an insight into how the Views module works and how you can use it to customise your website. Views is a great way to build complex queries into your database administration. Later in the course we will see other ways to make the most of Views.
You can use caching with Views to save the results of a query for the next site visitor. All views can have a Tag based or Time based cache. If all views are set up with a cache of at least fifteen minutes or more it will reduce the load on the database. Tag based cache is the default configuration and is suitable for most caching scenarios.
Note: Very short times in the Time based caching may negatively impact your website performance.
When you're not developing Views directly you should disable the UI. This will reduce the load on your server’s memory, but Views will still work.
In this exercise, we'll create a way for content approvers to view all content waiting for approval, so they can quickly and easily review and publish new content.
In the current setup, content editors can create and publish job postings. We’re going to change this, so that new job postings must be reviewed by a Content Approver before being published. To do this, we’ll introduce a moderation workflow.
Go to Configuration → Workflow → Workflows.
Edit the existing “Editorial” workflow. We’re going to reuse the existing workflow states and transitions as-is, to match the moderation workflow of the rest of the site.
Scroll down to This workflow applies to section and press Select in the Content types row.
Select the Job Posting checkbox, Save the changes.
Press the Save button in the Edit Editorial workflow page.
Create a new View with the following settings:
Hint: Go to Structure → Views → Add View.
Click Save and edit.
Tip: Select multiple fields at a time and configure them sequentially.
Add these fields:
Content: Node operations bulk form
Content: Authored on
Content: State
Configure the Bulk operations: Available actions:
Delete content
Save content
Update URL alias
Note that we did not select the “Publish content” and “Unpublish content”. Since we have a moderation workflow in place, these actions won’t work on our site.
Keep other defaults for the remaining fields. Remember to Save your changes to the View.
Click the dropdown next to the Add button in the Fields pane and select Rearrange.
The filter Content: Published (= Yes) can be removed as we will be replacing it in the next section.
To only see Job Postings that are pending approval, add the Content: Moderation state filter. Configure the following options:
Tip: Hold down the Command key (Control for Windows) to select multiple options.
Edit the table settings. Ensure any column that can be sortable is selected. Set the default order for Authored on to Descending.
Adding a “no results” message will clearly show that the view IS working properly if/when there isn’t any content waiting for approval.
In the middle column, under NO RESULTS BEHAVIOR, click Add.
Select Global: Text area
Then set the message “There are no job postings currently waiting for review!”.
Apply the changes.
Lastly, we will change the access/permission settings for this new view, from View published content to Administer content. Note that you can only do this with a user belonging to a role that has the necessary permissions.
Save the view and review. Go to admin/submitted-jobs. If there are no Job Listings in Draft status you should see the screen below:
You can change it to a Time based cache in the right-hand column. Choose a setting based on how often your site is updated.
Show
Content of type: Job Posting
Page title
Submitted jobs
Page path
admin/submitted-jobs
Display format
Table
Items to display
50
Use a pager
Selected
Create a menu link
No
Create a block
No
There are a variety of ways you could list events. For this exercise, we’ll create a simple view that shows all upcoming events.
Add in 5-10 new events (either manually or using Devel generate)
Make sure all events are published
Include events with both past dates and future dates in the Event Date field
Go to Structure → Views and edit the GovCMS Events Views view.
Customise the display
Filter out old events
Site visitors like to access content from friendly and easy-to-remember URLs. Before we look at URLs in more detail, it’s important to understand GovCMS site structure. Your instructor will show you how GovCMS sites are assembled based on conditions you set.
When adding content to your site, GovCMS automatically assigns a URL alias*. A URL alias uses the following format “/sanitised-item-title”. This may be useful for many generic purposes, but you could customise the paths.
When a new content type is created, the URL pattern has to be configured in order to get the automatic URL aliases to generate.
The Path module adds a URL ALIAS fieldset to the content creation (and editing) form so that you can set up URL aliases for your pages. This provides two main advantages:
Search engines give better rankings to user-friendly URLs so it’s a good SEO strategy.
The URLs look better and are more intuitive for the user.
Refer to the following documentation for more information https://www.drupal.org/docs/user_guide/en/content-paths.html
Each new content item has a permanent URL that uses numbers, such as node/1. You’ll see this URL in the address bar when you click the Edit tab. This link does not change, even if you change the content's Title.
When you add content, you can create a custom URL alias and override the default settings.
If you use the content's menu settings to add this to the Main menu, the link will be updated automatically:
In GovCMS, we can include a specific URL pattern for our content pages, perhaps based on content type.
Examples:
Blog articles: blog/[node:title]
Events: events/[node:title]
In this exercise, we’re going to automatically assign a URL alias pattern to the Job Posting content type so that all Job posting nodes will be assigned the URL alias format - http://example.com/jobs/[node:title]
Go to Configuration → Search and metadata → URL aliases, then click on the Patterns tab.
Our new content type Job posting is not listed yet, so let’s create a new Pathauto pattern.
Click the Add Pathauto pattern button.
Select Content in the Pattern type selector.
Select the Job Posting checkbox in the Content type selector.
Enter Job Posting in the Label field.
We need to find out which token to use in the Path pattern field so that it automatically takes our Job posting title and converts it into a safe URL. To explore available tokens, click the Browse available tokens link. In the Available tokens pop-up, expand Nodes and find Title field. Copy the token provided ([node:title]) and update the Path pattern field with jobs/[node:title]
Review the values and Save the form.
Now that we’ve created the new path alias, we also want to apply this new pattern to existing content, in this case Job Posting nodes. To do this, we’ll update all nodes on the site.
Click on the Bulk generate tab at the top of the Patterns admin page.
Select Content paths.
Select Generate a URL alias for un-aliased paths only.
Click Update.
The new URL alias pattern has now been applied to existing content on your site.
To test it out, create some new Job Postings and you’ll see Pathauto automatically adding the new URL alias pattern to the pages when they’re saved.
Note: The URL alias field will only be populated after saving the content (as Draft, Needs review or Published).
In this exercise we will configure automated content redirection when content alias changes.
Navigate to the Configuration → Search and metadata → URL Aliases → Settings.
Scroll down to the Update action section.
Select the option Create a new alias. Leave the existing alias functioning.
Save configuration.
Test it out. Navigate to a Page of your choice.
Note the page URL alias – you’ll need it in the next step.
Change the page title and publish the page. This should change the URL alias of the page.
Confirm that the URL alias of your page changed.
Manually enter the previous URL alias – from step 6
Confirm the page redirected to the latest URL alias – as noted in the step 8.
Now that we’ve added a custom URL alias and all job postings inherit the common URL pattern, let’s link our breadcrumb to the URL alias and explore how we can improve the user interface by manipulating breadcrumb links.
In Unit 6 we created a View called Job Posting and added a link to the top Main Navigation menu (Exercise 6.2).
The Breadcrumb link Job Postings was added by GovCMS for you.
At the moment, when we access any of the Job Posting content, the breadcrumb does not show the link to the Job Postings page. This creates a UX problem as site visitors don’t have a visual guide of the site section they’re currently in:
We want to change the breadcrumbs so that when a Job Posting page is displayed, the breadcrumb shows the link to the parent Jobs page:
The Breadcrumb links are constructed from the URL of the current page and checking if the sub-path matches any page on the site. If it does, the system pulls the title of that page and creates a breadcrumb link.
Our parent page (Jobs) URL is /job-postings and our Job Posting content URL pattern is /jobs/[node:title]. To get the Jobs page link added to the breadcrumb, all we have to do is to change its URL from /job-postings to /jobs. This way it will natively flow into the existing URL pattern for Job Posting content type and the link will be automatically generated in the breadcrumb.
Navigate to the Structure → Views and edit our Job Postings view.
Locate Path under Page Settings (middle top section).
Edit the Path, change it to /jobs.
Save the view
Test the breadcrumb by navigating to any Job Posting content. You should now get the Job Posting link in the breadcrumb.
In the next unit, we’ll follow a series of tutorials to strengthen our learnings.
While you can disable menu items, we recommend removing any hidden or unused menu items that you won’t use in the future. This will keep the menu links list tidy and organised.
There are many different ways to extend content types by adding extra fields. One example is Link, which lets you enter in HTTP addresses.
In this exercise we’ll add a new link field to the Job Posting content type. The link will go to “More information” on another website.
Go to Structure → Content types → Job Posting and click on the Manage fields tab.
Add a new field and use the following settings:
Click Save and continue. This will take you to the Field settings page.
There are no changes so just click Save settings.
This takes you to the settings for this field on the Job posting content type.
Go to a Job posting and search for the 'More information' section and Link field.
You can also make the link title field a required field. Follow the instructions below:
Go back to the Manage Fields page of the Job Posting content type.
Edit the Link field.
Change the Allow link text to “Required”.
Save settings.
Update your Job posting content page from the previous example and enter the link title.
Compare the look of the content page.
The More information fields should now be required fields.
Each government agency offering a job on the site should have its own page with a logo. In addition, each job posting should clearly show which agency is offering the job.
In our next exercise we’ll create a new content type called “Agency”. The content type will include an area to upload the agency’s logo.
When setting up media uploads for content types, consider these two important settings:
File path settings
When you add a field for file type, you’ll configure the “file directory”. The file directory settings are hard to change once they’ve been set up, so make sure you consider the settings carefully. The file directory will help you keep track of a file’s location and why they were uploaded.
Keep your directories organised as you go by adding a file path for each new file field.
Public versus private files
Go to Configuration → Media → File system
You’ll find the default global directory for file uploads in this area of the admin interface. Files in this area are public, meaning anyone with the link can view/download them. If you’ve got private files you’d like to secure, see this tutorial http://drupal.org/node/344806.
The Agency name is there, and it's a link. We configured it in one of the previous steps.
Most people looking at jobs websites like a quick way to sort the job postings. For example, jobs could be sorted by the type of employment - full-time, part-time, etc.
In this unit you learned how to control URL aliases and how to improve your site’s navigation through breadcrumb changes.
Content Reference is a useful tool in GovCMS. It helps you create new relationships between content. There are many ways to leverage this connection with Views. For example, when you’re viewing an agency page, you could show which jobs “back reference” to that agency.
Using what we’ve covered so far on content types, create a new content type using these settings:
Description
A government agency listing jobs or services on this site.
Title field label
Agency name
Publishing options
NOT Promoted to front page
Display settings
Don’t Display author and date information.
Menu settings
No menu
Click Save and manage fields.
Note: Make sure you check permissions, allowing Content Authors to create agencies.
We’re now going to add the Image field to the agency content type. When adding the field, make sure you also configure the form display and the display of the field. Use the following settings:
Label: Agency Logo
Field name: field_agency_logo
Field type: Media Reference (not Dynamic media reference)
Number of values: 1
Required: Leave unselected
Help text: “If available, please upload a logo for this agency.”
Media type: Image
Click on the Manage form display tab. Select Entity browser from the Widget dropdown, then click the cog icon next to the Agency logo field.
Adjust the settings as shown in the screenshot below:
When finished, click the Update button and then Save the Manage form display page.
Finally, we’re going to add a references field for job postings.
Go to Structure → Content types → Job posting and click the Manage fields link.
Add a new field using these settings:
Type: Reference → Content
Label: Agency
Field name: agencyref (click to edit the machine name)
Content type: Agency
Sort by: - None -
Click Save settings.
You’ll also need to configure the form display. Use the Select list widget for the Agency field. Note: You can also move the Agency field on the form so it’s above the Job description field.
You’ll also need to configure the display. Set the Agency field to display as a link.
Your job posting fields will now look something like the screenshot below.
You may rearrange any new fields we’ve added and bring them above the Job description field.
Now that you’ve added the new fields, it’s time to try them out.
In this exercise we’ll configure the job listing so it filters by terms of employment.
If you’ve already created the Job list view, skip to the step
If you don’t have the job listing view, we’ll create it and set the filter criteria.
Go to Structure → Views → Add new view. Configure with these settings:
View name: Job listing
Show “Content” of type “job posting” sorted by “Newest first”
Select the Create a page checkbox
Keep the defaults for the page setting
Select Create a menu link
Menu: Select Main navigation Link text: Jobs
Click Save and edit
Based to knowledge acquired from previous units in this manual, add a filter by terms of employment, and expose to the site visitors. Use the preview section located below the view configuration form to accomplish this task. Once you are happy with how it has been configured, save the view.
Hint: Use the screenshot below if you need some guidance.
Review your changes by checking your homepage. “Jobs” will be part of the main navigation (because you added it to the menu) and you’ll now see a dropdown menu that filters the job postings.
Content types often share information such as taxonomy terms, authors, and so on. We may also want to add in a relationship between content types so that we can share data (fields) from one content type with another. When you first set up a view, you select your “base table”. By adding in View relationships, you can share information from tables of other content types.
In this exercise, we’ll add in the logo of the agency offering the job, by setting up a View relationship. In the current setup, the agency’s logo is part of the Agency content type, and the view of Job Posting doesn’t allow us to show it. If we link the two content types together, we can display the agency logo in the job posting (like the screenshot below).
Add some new Agency content and upload a logo for each. See the screenshot below for an example.
Update some existing Job postings to link to the agencies setup in step 1. See the screenshot below for an example.
Next, we need to add a relationship to the main Job Listing View so that we can join the data from the Agency content type (specifically the logo) into the Job posting content type.
Without the relationship set up, if you tried to add a new field of “agency logo” to the Job posting content type the results would be blank.
Go to the edit screen of your Job Listing view Click on Advanced in the right column. Under "Relationships" click Add.
Next, search for "agency".
Select Content referenced from field_agency
Click Add and configure relationships. This will take you to the next configuration screen. Do NOT check the box "Require this relationship".
Click the Apply button.
In the Fields section of your Job Listing view, click on Add field. Then search for logo (this is the logo field in your Agency content type).
In the fields setting, apply the following settings as show in the screenshot. - Set the relationship to the one you created in previously. - Give it a Label - Set an appropriate Image style - Optionally set "Link image to" content.
Important! Remember to set the Relationship to reference the relationship created in the preceding steps.
Change the Format to "Table" so the final output will look similar to the screenshot at the top of this page.
Save your View and visit your job listings page to view the results.
URL Aliases are generally the best URL for site visitors to use. However, sometimes site visitors may need an alternative URL. This may be because an incorrect URL was published in print or on another website or because you want to create a shorter URL for a marketing campaign.
Redirects are also created by GovCMS to make sure only one (usually the latest) URL alias is functional and to ensure previously created URL aliases do not return “404 Not Found” response.
Illustration of how Redirects are forwarding all traffic to the latest Alias
Tip: Redirects are generally a better option because extra URL aliases can mean you end up with duplicate content issues, which has a negative impact on SEO.
Out-of-the-box, GovCMS sites may not handle redirects the way your client would expect. Navigate to the Configuration → Search and metadata → URL Aliases then go to the Settings tab and explore how the update action of URL aliases is handled.
In this default configuration the old alias will be deleted. This may not be the best way to handle changes of URL aliases in content.
A better way to handle URL aliases is to create a redirect automatically when an URL alias is getting updated. This will ensure that links to content stay valid whenever the URL alias of a content page is changed.