Sometimes you find yourself needing a policy you can't find in the Policy Library, or you need to tweak something you have found in the library. A Custom Policy is most likely your answer.
The instructions below show you the settings needed in the Rules section for each policy. If you need help on how to get started creating a custom policy, enabling for sites or Page Sets or assigning to a category, review our Creating a Custom Policy article.
Table of Contents
Find a specific piece of text in your content
Create a policy to find specific words or phrases that need attention across your site. Some possible uses: find unwanted words, find names or department names that need to change or find outdated content or phrases.
Rules:
Search By > Word or Phrase
Rule > enter the word or phrase you are looking for
Word Matching Behavior > select either Find this exact word/phrase OR partial matches -- depends upon your use case
Case Sensitivity > Do you want to match the word or phrase exactly as you typed it or does the case not matter?
Page Content Check Behavior > Do you want to search the text on the page and the source code OR check only the text on the page?
Matching Behavior > Do you want to flag pages that do OR don't match this rule?
Add Another Rule to Policy > Select this if you want to look for more than one item on the page.
If you have more than one rule, select if all rules are required to match a page. Select Match all rules or Match Any Rule.
Find content in a link
Links with a certain content in the Link URL
Create a policy to identify any content in a Link URL. Some uses include: links that are legacy links, that contain a certain extension (e.g. .php or .aspx), or links that contain a certain file path, for example, /index/.
Rules:
Search By > Link URL
Rule > enter the content you are looking for - for example, an extension (.aspx) or domain (oldserver.com)
URL Option > select Equals / Starts With / Ends With / Contains -- depends upon your use case
Case Sensitivity > Do you want to match the word or phrase exactly as you typed it or does the case not matter ?
Matching Behavior > Do you want to flag pages that do OR don't match this rule?
Add Another Rule to Policy > Select this if you want to look for more than one item on the page.
If you have more than one rule, select if all rules are required to match a page. Select Match all rules or Match Any Rule.
Search for a particular HTML tag
Find occurrences of a particular tag within a page. This particular example is looking for H4 headings, but can be easily modified to find other types of headings.
Rules:
Search By > XPath
Rule > enter the tag you want to find -- for example, enter
//h4
to search for the H4 tag.Case Sensitivity > Do you want to match the word or phrase exactly as you typed it or does the case not matter?
Matching Behavior > Do you want to flag pages that do OR don't match this rule?
Add Another Rule to Policy > Select this if you want to look for more than one item on the page.
If you have more than one rule, select if all rules are required to match a page. Select Match all rules or Match Any Rule.
Identify Long Paragraphs
For online texts, the recommended length of a paragraph is 40-50 words, or four to five lines. Keeping your paragraphs short helps boost comprehension and keeps your reader’s focus.
Rules:
Search By > XPath
Rule >
//p[string-length(text()) > 400]
-- Want to use a different value for your check? Just change the number 400 to reflect your new number.Case Sensitivity > Do you want to match the word or phrase exactly as you typed it or does the case not matter?
Matching Behavior > Do you want to flag pages that do OR don't match this rule?
Add Another Rule to Policy > Select this if you want to look for more than one item on the page.
If you have more than one rule, select if all rules are required to match a page. Select Match all rules or Match Any Rule.
Consistent phone number formatting
For the sake of consistency your team might have a goal of using (or not using) parentheses & dashes, every time a phone number is utilized.
For example, you may want (404) 555-1212 versus 404-555-1212. The following check will flag phone numbers that DO NOT have parentheses.
Rules:
Search By > Regular Expression
Rule >
\(?\d{3}\)?-?\s?\d{3}-?\d{4}
Case Sensitivity > Case-Sensitive
Page Content Check Behavior > Check only text on page
Matching Behavior > Flag pages that match this rule
Add Another Rule to Policy > Select this if you want to look for more than one item on the page.
If you have more than one rule, select if all rules are required to match a page. Select Match all rules or Match Any Rule.
Improper Combination of Two Words
Search for improper usage of a combination of two words on your site, usually something from your writing style guide.
In this case, the word "Campus" should be capitalized when used in conjunction with city names associated with the client. This policy is written to identify campus being lowercase when it is prefaced by specific city names.
Rules:
Search By > Regular Expression
Rule > update
CityName
with your appropriate name(s)One City:
(CityName\s)(campus)
Two possible cities:
((CityName\s)|(CityName\s))(campus)
Three possible cities:
((CityName\s)|(CityName\s)|(CityName\s))(campus)
Case Sensitivity > Case-Sensitive
Page Content Check Behavior > Check only text on page
Matching Behavior > Flag pages that match this rule
Add Another Rule to Policy > Select this if you want to look for more than one item on the page.
If you have more than one rule, select if all rules are required to match a page. Select Match all rules or Match Any Rule.
Find Pages that contain specific HTML elements for manual quality review
Some page elements simply need a manual review to ensure they follow accessibility guidelines.
Rules:
Search By > XPath
Rule > enter the tag you want to find -- for example, enter
//input[@type="checkbox"]
to search for a checkbox in a form.Case Sensitivity > Do you want to match the word or phrase exactly as you typed it or does the case not matter?
Matching Behavior > Do you want to flag pages that do OR don't match this rule?
Add Another Rule to Policy > Select this if you want to look for more than one item on the page.
If you have more than one rule, select if all rules are required to match a page. Select Match all rules or Match Any Rule.
Note: this policy does not indicate that there is something necessarily wrong with the input field. This policy should just be used to create a list of pages for reviewing that the display of the input field and label provides an intuitive experience for users interacting with the form field.
Remember ~ Contact us if you need help!