Skip to main content
Keel Docs Showcase

Page URLs & preview

Keel shows Website and Preview in the editor when it knows an object's page on the website. It asks, in this order:

  1. ObjectUrlProviderInterface services of the project (the first one that knows the object wins),
  2. the urls configuration,
  3. the class's Pimcore link generator.

urls configuration

yaml
keel:
    urls:
        Product: '/products/{slug}'           # short form: just the path
        Article:
            path: '/{scope.blog_path}/{slug}'
            site: '{scope.site}'              # Pimcore site id → its main domain
            # domain: https://blog.example.com  # or a public domain instead of a site
            published_only: true              # default
KeyDescription
pathPath with placeholders (required)
sitePimcore site id, or a placeholder such as {scope.site}; its main domain makes the public URL
domainPublic domain instead of a site, e.g. https://shop.example.com or {scope.domain}
published_onlyPreview only published objects – the site serves only those (default true)

Placeholders

PlaceholderValue
{id}, {key}Object ID and key
{locale}Content language
{scope}Key of the chosen switcher option
{scope.<name>}Any extra value of that option in the scope.options config
{<field>}Any field of the object (localized fields in the current language)

Placeholders are filled per scope option – the chosen one first, with its locale – otherwise per content language. The first option where every placeholder has a value wins. So a slug set only in the Slovenian field links to the Slovenian site. URL slug fields use the slug of the main site.

In code: ObjectUrlProviderInterface

php
use Keel\Bundle\Url\ObjectUrlProviderInterface;
use Pimcore\Model\DataObject\Concrete;

final class TourUrls implements ObjectUrlProviderInterface
{
    public function urlFor(Concrete $object): ?array
    {
        if (!$object instanceof \Pimcore\Model\DataObject\Tour) {
            return null;                             // not mine – ask the next provider
        }

        return [
            'path' => '/tours/' . $object->getSlug(),
            'site' => null,                          // Pimcore site id, null/0 = main site
            'preview' => $object->isPublished(),     // can the page render right now?
        ];
    }
}

The service is autoconfigured – no tags needed. Return null for objects that have no page.