Site
Pala makes it easy to define content at the site level, cascading down to pagers and blocks across your site. This guide covers how to create and manage site content effectively.
Defining Site Fields
Site Fields defines content available across your entire site. This is useful for content that needs to be consistent across multiple blocks, such as:
Navigation menus
Contact information
Social media links
Footer content
Company information
Global CTAs
Creating a Site Field
Select the "Site" icon in the toolbar to open the Site editor
Click 'Create Field'
Choose a field type appropriate for your content.
Integrating Site Content in Head
Site Field can be integrated into your page head for site-wide elements like favicons, meta tags, analytics, and social media profiles.
Note: Everything in your site head will be statically generated on every page you publish, so making any content changes there will cause your entire site to regenerate.
Accessing Site Fields in Blocks
Site Fields are available in all blocks using the 'Site Field' field type. When using a Site Field item in a block, any changes to the entry will update across all instances.
To use Site Field in a block:
From within the content view of the Block editor, create a new field
Select the 'Site Field' field type
Select the site field to retrieve
Note: Site Fields used in blocks will be indicated with a 'Site Field' label in the block editor.
Example: Setting Up Site Navigation
Let's walk through creating and using site content:
1. Creating Navigation Properties
First, from the site editor create a 'Repeater' field containing a 'Link' child field for site navigation:
Navigation Links
- Home
- About
- Services
- Contact
2. Using Site Fields in Blocks
Create a 'Site Field' field within a block and select the 'Navigation Links' site property, then integrate it into your HTML.
<nav>
{#each site.navigation_links as {link}}
<a href={link.url}>{link.label}</a>
{/each}
</nav>
FAQ
When should I use Site Fields vs Page Fields?
Site Fields is best for content that needs to be shared across multiple pages or blocks, like navigation menus or contact information. Page Fields are for content specific to a certain type of page, like blog post metadata or product details.
Can I update Site Fields from within a block?
Yes, when you edit a Site Field within a block, you're editing the source entry itself. Any changes will automatically update everywhere that content is used across your site. It's generally easier to make these edits directly from blocks rather than going through the Site Editor.
Can I have different values for Site Content on different pages?
No, Site Fields are meant for content that's consistent across your entire site. If you need page-specific variations, you should use Page Fields instead.