Welcome to the OpenCities help centre. Search for what you're after, or browse the categories.
Can't find what you're looking for? Submit a support ticket and we'll be in touch.

Follow

Change Site Text and Buttons with Text Snippets

avatar of OpenCities Product Team

OpenCities Product Team

Last updated

This task is for users with the OC Developer or OC System Administrator roles.

On your site, you will find many pieces of text that are coded into the content types and templates. These text areas use text snippets to control what they display. For example, the text within "View more..." buttons, search bars, and search filters use text snippets.

You can add variants to specific text snippets to edit them, making your site more accurate and user-friendly or applying different wording for different scenarios. You can also use text snippets to ensure they appear correctly in multiple languages.

text snippets on an event listing page

Some common uses of text snippet variants are:

  • Editing the default search bar text
  • Customizing search filters on listing pages
  • Adding language variants for popular pages

If you suspect some text on your site is a text snippet, go to More > Text Snippets and use the search function to search for the snippet.

Check out this video to learn how to edit text snippets:

Add a Variant for a Text Snippet

When adding variants to text snippets, you create them based on specific scenarios, such as the site type, content type, template, or particular pages. Here's how to do it:

  1. Go to More > Text Snippets.
  2. Use the search bar to Search by name or text, and select the snippet you want to edit from the list. You can't edit the Name or any System defaults, but you can add a variant.
  3. Select Add Variant.
  4. From the Based on drop-down menu, select whether you want to add the variant based on the Site type, site, content type and/or template, or if you want to add it based on A specific page.
  5. If you're basing it on a page, type the Page name into the When the page is predictive text field and select it from the list.
  6. If you're basing the variant on a Site type, site, content type and/or template, use the further options to narrow down the scenario. For example, if you want to change the "Event Snapshot" text for an event page on your Theater subsite, you would use the following settings:
    • Based on: Site type, site, content type and/or template
    • When the site type is: Subsite
    • And the site is: Theater
    • And the content type is: OC Event
    • And the template: Any 
  7. Enter the text you want to display in the Show field. You'll need to add the text for each language if you have multiple language packs.
  8. Select Add, then Save.

Check a page with the altered text snippet to ensure it's displaying correctly when you're finished.

Different types of variants are weighted differently. The system default is overridden by your default (which is only applicable in text snippets you've created yourself), and your default is overridden by variants you add.

If you add multiple variants, the system will use them in order of specificity. For example, a variant that works from A specific page will be used first as it is the most precise. If you have multiple variants involving Site type, site, content type and/or template, the system will use the variant that specifies the template first, then the one specifying the content type, then the site, and lastly, the site type.

Create a Text Snippet

This task is for users with the OC Developer role.
 

Developers can create text snippets for templates and listing pages they create themselves. Once you've made a text snippet, you can add further variants as needed. Here's how to make a text snippet:

  1. Go to More > Text Snippets.
  2. Select Create Text Snippet.
  3. Enter a Name for your text snippet.
  4. Enter the text you want for each language installed on your site in the fields under Your default.
  5. When you're finished, Save your text snippet.

You can now select this text snippet when creating or editing a template.

Please note that any variants you create may be removed upon new product release if that release targets the area of the site on which the snippet displays. To avoid losing them, we recommend documenting which variants you add to which snippets so they can be recreated if they get removed.

What Else?

Was this article helpful?
1 out of 1 found this helpful