Made in Builder.io

Announcing Visual Copilot - Figma to live in half the time

Builder.io logo
Talk to Us
Platform
Developers
Talk to Us

Blog

Home

Resources

Blog

Forum

Github

Login

Signup

×

Visual CMS

Drag-and-drop visual editor and headless CMS for any tech stack

Theme Studio for Shopify

Build and optimize your Shopify-hosted storefront, no coding required

Resources

Blog

Get StartedLogin

You can use Builder Sections to create reusable content across multiple pages. You can manage the code within your codebase, and teammates in the UI can iterate in the Visual Editor.

Examples include:

This tutorial shows you how to create and add an announcement bar section to a page.

For more conceptual information Section Models, refer to the Section Models documentation.

To follow along with this tutorial, you should have the following:

  • a Builder account
  • an app in the framework of your choice with the appropriate Builder SDK installed

Tip: If you need to create an app, follow the steps for your framework in the Create an app section of Integrating Page Building.

Create a Section model so you can make an announcement bar content entry.

  1. Go to Models.
  2. Click +Create Model.
  3. Select Section.
  4. Enter Announcement bar as the name for your new Section model.
  5. Click Create.
  6. For all frameworks except Swift: change the Preview URL on the Model Options page to the URL of the page that you added code to display your section. This example uses /announcements, but yours might be different.

The video below demonstrates this process:

Depending on the framework, the path and port can vary. Localhost does not apply to Swift.

Check your framework according to the below:

Frameworklocalhost URL

Angular

http://localhost:4200

Gatsby

http://localhost:3000

Qwik

http://localhost:5174

Remix

http://localhost:3000

When you create or edit an announcement bar section, the Visual Editor displays your content embedded within your Preview URL page, providing visual context and importing styles from your site. It's a live view of your section, as it will look on one of your pages when you publish.

Tip: Published sections typically appear across multiple pages with different URLs depending on how they're targeted. When previewing in the editor, however, they only appear within the Preview URL's page. For more information, refer to Editing and Previewing Your Site.

For more information what Section Models are and how to use them, refer to the Section Models documentation.

Now that your Section model is set up, you can create an announcement bar content entry to add an announcement bar to your site.

  1. Go to Content.
  2. Click the + New button and select Announcement bar.
  3. Build and style your announcement bar.
  4. Name the content entry.
  5. Click Publish.

The video below demonstrates this process:

To make your announcement bar display based on targeting, in the section content entry; for example, in the announcement bar:

  1. Click on the Targeting icon.
  2. For Where, select URL path.
  3. Add the URL path you'd like to target.
  4. Click the Publish button.

The video below shows this process in an integrated Remix app where the targeted URL path is /builder so that the announcement bar doesn't show up on any other URLs. This process is the same, regardless of the framework you use. The URL path you target, however, might differ.

Tip: If you're using Gatsby, you may need to restart your app to render the announcement bar.

For more examples of what you can do with Builder, check out the Blueprints, which cover varied use cases at a high-level with code examples.

Was this article helpful?

Product

Visual CMS

Theme Studio for Shopify

Sign up

Login

Featured Integrations

React

Angular

Next.js

Gatsby

Get In Touch

Chat With Us

Twitter

Linkedin

Careers

© 2020 Builder.io, Inc.

Security

Privacy Policy

Terms of Service

Newsletter

Get the latest from Builder.io

By submitting, you agree to our Privacy Policy