Our guides are always evolving. If you have a request for a guide, please
get in touch.
1 - How to avoid outdated configuration
Managing config across versions of a module can result in unexpected challenges.
Sometimes, in the process of making successive config changes, we need to maintain old config files so that outdated update hooks can still run successfully for sites who are running a module that might be many releases behind.
When a new update runs into an error like:
Configuration ______ depends on the ____ configuration that will not exist after import.
the error most often means that some configuration that’s expected in a prior update hook has been removed from the codebase.
In order to enable our modules to move quickly and minimize the need for developers to
stop their update process at important versions, we have come up with a process of retaining “outdated” configuration when necessary.
Overview
This process ends up with a configuration directory that looks like:
Adding or removing major features or fields could also result in the error.
2 - How to customize your locations map
YMCA Website Services includes robust mapping functionality defined in the
openy_map subproject. Maps typically are displayed on the /locations page using the
Location Finder component and are highly customizable.
These are a few common customizations:
Changing Map Options
By default, content types have these labels on the map:
Branch = YMCAs
Camp = Camps
Facility = Facilities
These labels can be customized in the Drupal administration pages to better suit your YMCA’s more member-focused terminology. To do so:
In the Admin Menu, go to YMCA Website Services (or Open Y on prior versions) > Settings > Map Settings
In the Branch/Camp/Facility Content Type sections you can:
edit the label names,
show or hide the content type on the Locations page,
set the filter to be on or off by default, and
set the map icon.
Edit each content type as needed then Save the form.
Reload /locations and you should see your changes.
Adding Additional Location Types
You can add new content types to the map with a few steps. This may require some trial and error, so be sure to work in a testing environment first. You will need to have the Field UI module enabled to do this through the Drupal admin UI.
Create a new content type via Structure > Content types > Add content type
Add these existing fields to the content type:
field_location_coordinates - required
field_location_address and field_location_phone - suggested for display on the map and location teasers.
field_location_amenities - if the location should be searchable with the Amenities search.
Set up the Teaser display on the new content type:
Navigate to Manage display then Teaser
Update these settings to match the Branch Teaser display at /admin/structure/types/manage/branch/display/teaser
Go back to the Map Settings at admin/openy/settings/openy_map and configure the options for your new location type.
3 - How to install Cachet (the official Y Font)
Cachet, the Y’s primary font, should be used for all internal and external materials whenever possible.
Typography is an important element of our brand identity. Cachet and Verdana, the only two fonts used on YMCA collateral, help provide our words with a distinctive look and welcoming feel. And Cachet, as our primary font, should be used for all internal and external materials whenever possible.
To help Ys incorporate the Cachet font into their online applications, Y-USA is now licensing the web font version of Cachet for all YMCAs. Previously, Ys could only access the desktop version of the font from the Brand Resource Center (BRC).
YMCA development partners can take advantage of a custom module which allows for automation of this process.
Get in touch or reach out in #developers on the YUSA Slack for more details.
For site builders
Once you’ve downloaded the WOFF files, you’ll need to add them to your site. These instructions mirror the
walkthrough in this video.
Visit Admin > Extend and ensure the “@fontyourface” and “@fontyourface - Local Fonts” modules are enabled.
Click + Add Custom Font and add each of the Cachet font files you downloaded above with the following settings:
Label
Font Family
Font Style
Font Weight
Font Classification
Font File
Cachet Extra Light
Cachet
Normal
300
Sans Serif
CachetW05-ExtraLight.woff
Cachet Book
Cachet
Normal
400
Sans Serif
CachetW05-Book.woff
Cachet Medium
Cachet
Normal
500
Sans Serif
CachetW05-Medium.woff
Cachet Bold
Cachet
Normal
700
Sans Serif
CachetW05-Bold.woff
After you’ve added each font, Enable them.
Your site should now use the Cachet font in headers and other areas. Usage is dependent on the YMCA Website Services theme you choose.
4 - How to integrate with social media
Embedded social feeds or posts can help share your message with users.
Social media is a great platform for communicating with your Y community, and it’s often helpful to embed feeds or posts on a page to share topical content with users.
The distribution has used several methods over the years to add social content to sites, but all of them are dependent on the specific platforms maintaining open APIs. Unfortunately, many social networks are now locking down and restricting their APIs.
How to embed social content in your YMCA website (in 2023)
Currently, we recommend using embed codes from the specific platform to embed social posts or feeds on your YMCA Website Services website.
Find the embed code
Each platform has its own way of doing embeds. For posts, you can often find an “Embed” button in the options or share menu. For feeds, you often need to use a separate builder. Here are some options we’ve found:
Note: Social platforms may break these embeds at their whim. Use at your own risk.
Embeds using Paragraphs
Navigate to a content page on your site, then click Edit.
Add a
Code Paragraph to the section where you’d like to do the embed.
Paste in the embed code generated above.
Save the page.
Embeds using Layout Builder
Navigate to a content page on your site, then click Layout.
Add a
Code Blockto the section where you’d like to do the embed.
Paste in the embed code generated above.
Save the block, then Save layout on the page.
Alternatively, try Social Feeds Fetcher
The
Social Feeds Fetcher module that comes with the distribution allows your site to import social media content for syndication.
To configure fetching:
Open the configuration page at /admin/config/social_feed_fetcher_settings or Configuration > Web Services > Social Feed Fetcher Settings
Select the checkbox for your chosen social networks and add additional settings. Every social network has its own API and requires different configuration.
When all settings are completed, click Run Cron. The import is started and if the configuration is correct, items will appear in the content list.
How to share content from your site to social media
All mobile browsers — Firefox, Edge, Safari, Chrome, Opera Mini, UC Browser, Samsung Internet — make it easy to share content directly from their native platforms.
AddToAny is the perfect drop-in replacement for AddThis.
As of December 2023, the
AddToAny module is included in the YMCA Website Services distribution. It is not enabled out of the box, but if you need to supplement native platforms’ sharing services, here’s how:
Go to Admin > Extend (/admin/modules) and enable the AddToAny module.
Configure the module at Admin > Configuration > Web Services > AddToAny (/admin/config/services/addtoany)
Edit a single Page Layout or the Content Type Layout.
Decide where to add the share block. We recommend the right side of the footer, above or below the “Stay Connected” block, but any section of the page would work.
In Layout Builder, Add block, then choose All system blocks > AddToAny share buttons.
Set a Title like “Share this”.
Choose to Display title.
Leave other configuration as their defaults.
In the Style settings, expand Spacing and add a top or bottom margin of 32px to ensure the block is spaced properly from the block above or below it.
Layout Builder components for YMCA Website Services were developed and released throughout 2023. The plan at the outset was that Paragraphs-based components would be supported for one year from the time of the Layout Builder components’ completion, then would cease being supported. Site owners can begin migrating their content at any time. Upon the deprecation of Paragraphs components, they will not “disappear”, but they will no longer be supported by the YMCA Website Services core team.
As of October 2023, the timeline is:
December 2023 - Layout Builder components are considered “feature complete”
2024 - refinement and bug fixing of Layout Builder components, basic bug fixing only for Paragraphs components.
December 2024 - end of support for Paragraphs components.
Site owners are encouraged to plan a migration of their content to Layout Builder in 2024, after which point they will be responsible for maintaining Paragraphs components.
(Timeline is subject to change based on community feedback and priorities.)
Plan your migration
The migration from Paragraphs to Layout Builder is not a small one, but it can be done in bite-sized pieces and spread out over some time if necessary. We recommend working with a
partner agency to assist you through the process.
TIP: As you work through the migration, the new pieces of your site will look different than others. Help members through the process with some messaging in an
Alert or
news post letting them know that things will be changing.
Decide where to start
If you’re doing your migration throughout your regular business, without starting from scratch (sometimes called a “lazy migration”), it helps to identify a strategy for planning the migration. These are a few possible strategies:
A campaign or goal
If you have an upcoming marketing campaign you could build one or a few brand new Landing Pages with Layout Builder to try out the process. This way you’re easing both your editors and members into the new designs without getting too deep.
If you have a natural pause in events (maybe over a holiday) or a big series coming up you could use that as the break point for new events. Old events don’t necessarily have to be converted to the new design as they’re not often viewed after their date has passed.
A section of the site
Maybe you want to ease into the process with some lesser-used pages, maybe you want to change the home page and top-level menu items to show off the new designs right from the outset. Either way, you can decide on a section and carve off a few pages at a time.
A content type
Events or News articles are a good option to try out the new designs, although you’ll need to ensure any Landing Pages that display lists of that content are also updated. Branch pages can be converted one by one without changing their listing on the Locations page.
Prepare your content
Once you know what you’re going to move, you’ll want to get the content ready to migrate. Most text will need to be copied and pasted to the new pages (this is a great opportunity for review), but images and documents will be able to be re-used from the
Media Library.
It could be helpful to print or screenshot pages (Firefox can capture a
full-page screenshot) and then annotate them to decide how each section of the page will map to its Layout Builder component. You could even use the
Wayback Machine to save a snapshot of the page.
Component mapping
While the exact mappings are up to each site’s content editors, here are some possible mappings from Paragraphs to Layout Builder
Paragraph
the Layout Builder component it maps to.
1 Column
2 Columns
3 Columns
4 Columns
Secondary Description and Sidebar
These paragraphs can be replicated using 1-4 column
Layouts
Once you have a plan, go build it! Use the
Layout Builder documentation to help you through the process. Building each page might look something like this:
Create a new, unpublished, Landing Page (with Layout Builder)
Add blocks and content to the new page
Ensure the URL Alias of the new page matches that of the old page
Un-publish the old page and publish the new page.
Test out the new page in a new browser, an incognito window, or your phone or tablet
Get help
If at any point in this process you need help, be sure to reach out to
our community. The functionality is always being improved, and we have a wide variety of developers and builders from other Ys who are happy to help.
6 - How to perform a content audit
Content audits help get an overview of how your site is structured and can assist with migrations, SEO analysis, and more.
Doing a content audit is a useful first step to planning a migration. You can use our
content audit template and watch our walkthrough on the
May Monthly Call to get started, then follow these steps:
Audit
List current website pages in a spreadsheet by menu section.
This will give you a visual overview of how your site is structured.
Be sure to audit your Drupal Admin back end for unpublished pages that can be removed/deleted!
Review
Visit each page and review content.
Identify key pages & content types
Locate content that is outdated, duplicated, needs further review, consolidation etc.
If you are starting with an internal toolchain, composer require ycloudyusa/yusaopeny at the root of the project.
Go to Admin > Configuration > Basic site settings and configure the website name and slogan.
Enable Layout Builder modules
The core functionality of the Layout Builder features is packaged inside the
Y Layout Builder module (y_lb). This module is required by the profile and comes with it out of the box.
Layout Builder modules could be disabled by default. The complete
list of available components is available in y_lb/composer.json. There are two different methods to enable them:
To install only selected modules: Go to Admin > Extend (/admin/modules) and enable only the components that you choose to use.
To install all the modules: Go to Admin > YMCA Website Services > Extend > Install (/admin/openy/extend/list). Check the box for Layout Builder, then Install.
Configure layouts & listings
Layout Builder relies on a system of
Layout Defaults and
Layout Overrides. An important concept to understand from these pages is:
Once a Layout is overridden on an entity, that entity will not be impacted by changes to Layout Defaults.
In building Landing Pages, we will override the Default Layout for every page (by placing content blocks). For this reason, it is important that we configure the desired defaults before building pages.
Configure its
content type styles at /admin/structure/types/manage/landing_page_lb/display first. Configure:
Colorway
Border style
Border radius
Text/button alignment
Button position
Button fill
Locations
You will use the
Branch,
Camp, and
Facility content types to build pages that contain the contact and amenity details for each location.
For new sites, you may set the Use Layout Builder checkbox to be true by default at /admin/structure/types/manage/branch/fields/node.branch.field_use_layout_builder.
Configure the default layout and settings for each type on their corresponding layout settings pages:
Enable openy_node_session, openy_node_program, openy_node_category, openy_node_activity, and openy_node_class to set up the Program Event Framework (PEF) if you plan to use Schedules or Activity Finder on the project.
To get started, you should first create a GA property. Use the
Analytics Help for assistance.
Configuration
Configuration is done at the standard module configuration page: /admin/config/services/google-analytics.
Google Analytics Version Compatibility
In the
9.2.11 release in November 2021, YMCA Website Services
added support for Google Analytics 4. If your site has been updated to YMCA Website Services 9.2.11 or greater AND the google_analytics module has been updated to 4.x you should be able to use GA4. Otherwise you’ll need to stick with GA3.
Search Tracking with Google Analytics
Prerequisites
Google Analytics account to track you site should be created.
Google Analytics contrib module should be enabled and configured to use existing GA account.
Steps
Log in to Google Analytics account that configured to track your YMCA Website Services site.
Click Admin button in bottom right corner of main screen
Click View Settings
Scroll to “Site Search Settings” section and enable “Site Search Tracking” switch
Fill query parameter field with q, query values and click Save
Reports about the search tracking you can find at main screen in Behavior → Site Search Section
Attention: Data processing latency for search tracking reports is 24-48 hours
(see
Google’s support doc).
The Data Layers module output data on the page in a json format. By default it will output properties (langcode, vid, name, uid, created, status, roles) and related taxonomy for any node, user, or any route based entity.
A limited set of properties are available via the Data Layers configuration form at /admin/config/search/datalayer (langcode, vid, name, uid, created, status, roles).
Adding additional properties can be done through use of hook_datalayer_meta().
Altering which properties will be output can be done via hook_datalayer_meta_alter().
functionmy_module_datalayer_meta_alter(&$properties){// Override module norm in all cases.
unset($properties['entityUid']);// Specific situation alteration...
$type=false;if($obj=_datalayer_menu_get_any_object($type)){if($type==='node'&&in_array(array('my_bundle','my_nodetype'),$obj->type)){// Remove author names on some content type.
if($key=array_search('name',$properties)){unset($properties[$key]);}}elseif($type==='my_entity_type'){// Remove some property on some entity type.
if($key=array_search('my_property',$properties)){unset($properties[$key]);}}}}
Adding additional data can be done using datalayer_add().
To alter the data to be output use hook_datalayer_alter().
functionmy_module_datalayer_alter(&$data_layer){// Make the title lowercase on some node type.
if(isset($data_layer['entityBundle'])&&$data_layer['entityBundle']=='mytype'){$data_layer['entityLabel']=strtolower($data_layer['entityLabel']);}}
Cross-domain Tracking
This configuration enables cross-domain tracking (also known as “cross-domain measurement”) to work through internal redirects like those in
Membership Calculator (that use TrustedRedirectResponse).
When enabled, cookies matching any configured tag will be added to any redirect destination matching a configured domain. For example, a redirect to https://example.com will be transformed to https://example.com/?_gl=.....
Analytics provides code that does this automatically with standard <a> links, but this module is required to enable similar functionality with “server-side” links/redirects.
NOTE: Configuration and testing of analytics is required outside the scope of this module, refer to
[GA4] Set up cross-domain measurement for more information.
Successful cross-domain tracking also requires the destination application to retain the passed query strings and load them into the corresponding tracking property.
Requesting cross-domain tracking support
Many Customer Relation Management (CRM) systems and Member Management Systems integrate with YMCA websites. Those systems often need guidance on hwo to maintain cross-domain tracking support.
Entrance to the CRM/MMS often involves multiple redirects which may drop the required query strings.
When discussing cross-domain support with your vendor, we recommend requesting:
Please support passing query strings/parameters through redirects, specifically maintaining the _gl parameter.
You may also need to request that your GTM/GA code be added to the CRM/MMS to report back these parameters.
Configuration
Enable the “YMCA Website Services Cross-domain Tracking (XDT)” module at Administration > Extend, or via drush:
drush en openy_xdt
Configure the module at Administration > YMCA Website Services > Settings > Cross-domain Tracking Settings (/admin/openy/settings/xdt)
The cookie defaults to the standard for GA4, but can be modified for use with different systems.
The module will not have any effect until a domain is configured. Add the domains of any external sites where you would like to enable tracking.
9 - How to leverage structured data
Structured data helps the machines reading your site - search engines, AI models, and more - understand your content.
Adding structured data can enable search results that are more engaging to users and might encourage them to interact more with your website
Press Release →
Article (there is currently no other appropriate Schema)
Customizing Articles
This mapping is set in code (y_lb_article_metatags_alter in
y_lb_article.module), but all other settings are configurable via the Metatag configuration (/admin/config/search/metatag/node__article_lb).
Any time the Branch Hours are updated, that content will also be reflected in the Structured Data that’s read by search engines.
Customizing Branches
The mapping is configurable in the Metatag configuration (/admin/config/search/metatag/node__branch). Hours configuration uses the
Open Y Hours_metatag tokens.
If an Accordion section contains Frequently Asked Questions, check the FAQ? checkbox to output them as structured data.
Tips for writing good FAQ content:
Ensure the content contains individual sets of questions (“How old does my child need to be to swim at the YMCA?”) and answers (“The YMCA offers swim classes starting at age 3 and the pool is open to children of all ages with parental supervision”).
Only one FAQ should be added to a page. If more than one is added, only the first will be output to the structured data.
Customizing FAQs
Due to the complexity of the FAQ data, the structured data is
managed entirely in code and is not customizable via the Drupal admin. If you need specific customizations, please post your ideas in Slack or suggest them on
the Roadmap for the core team to discuss and implement.
10 - How to use the Canadian Colourway for Layout Builder
With a few clicks, Canadian YMCAs can use their own set of brand-compliant, accessible styles.
YMCA of the USA has partnered with
YMCA Canada to create a brand-compliant and accessible colourway for use by Canadian YMCAs.
The Canadian Colorway package includes four options for content type or page-level colorways. Each colourway uses the same three primary colors - dark red, lighter red, and grey, along with a highlight color of blue, purple, green, or black.
Banners
The Canadian Colorway for Banners package contains 4 banner variations that utilize the unique Y Canada chevron:
Black
Red
White
Short (no image, title and subtitle only)
These can be selected in the
Y Styles selector for each banner on your site.
Y Canada sites can also use the existing “Overlay” Banner style as it does not utilize any YUSA-specific styling.
Setup
Enable the required modules
Warning
Enabling ws_colorway_canada will immediately changes the site logo from the Y-USA logo to the Y Canada logo, so this should be done on a development environment first.
Y Canada site developers may want to hide the existing YUSA styles in order to prevent unintentional usage. This is not possible through configuration at the moment, but some custom css can do the trick:
Enabling multiple levels of identity verification can protect your site from malicious users.
Enabling two-factor authentication (2FA or TFA) adds a layer of security to selected roles like admin while allowing other users to log in to the site only with basic authentication with a Drupal username and password.
The community-contributed
TFA module is the recommended path to requiring 2FA for users.
Requirements
The TFA module requires the PHP OpenSSL extension. This is installed with most modern stacks, but you can check to see if it is running with: php -i | grep openssl.
Once you configure an encryption key and an encryption profile, you will then be able to enable TFA at Admin > Configuration > People > TFA (/admin/config/people/tfa).
Once you enable TFA, you will have the option to require it for specific roles.