Skip to main content
Version: 2023.2

Documents

Documents are the CMS part of Pimcore and are the way to go for managing unstructured contents using pages, content snippets and navigations.

Document Types

Pimcore offers different types of documents and each of them offers functionality specific for the intended use-case.

TypeDescription
PageRepresents a typical web-page, the path in the tree is equal to the address in the browser.
SnippetMakes it easier to extract often used contents into reusable containers. Can be embedded in pages or nested into other snippets.
LinkA simple web-link to be used in navigation.
EmailA document like the page, but with special functionality for transactional emails.
HardlinkCreate links to other document structures and reuse them within a different structure / context. (see Hard link)
FolderJust like the folders you know from your local filesystem.

Document Configuration

Many documents types are tight to the MVC and therefore they need a underlying controller/action and a template. They are directly specified in the document settings in the admin interface:

Documents: controller and view settingsDocuments: controller and view settingsDocuments: controller and view settings

Not all of them are necessary, the table below shows which configurations are possible:

TypeControllerTemplateDescription
1XThe specified controller/action is executed. If the action returns a response object, it is used for rendering.
2XXSame as above but the template specified is rendered and not the auto-discovered template (only if action does not return a response).
3XRenders the template with the default controller/action, this is practical if there is only templating stuff.

Pimcore is shipped with a default controller containing a default action, which is called when only a template is given to the document.

You can set a default module/bundle, controller and action in the symfony configuration:

pimcore:
documents:
default_controller:App\Controller\DefaultController::defaultAction

Properties

Properties are very powerful in combination with documents. Below, you can find some examples where properties can be very useful for the use with documents.

  1. Navigation - If you build the navigation based on the document-tree, sometimes you need special settings for the frontend, like separators or highlightings.
  2. Header Images - Often there are header images on a website, if you don't want to define it for every page, you can use properties with inheritance. Then you can define a default one at the root document, and overrule this on a deeper level in the tree structure.
  3. Sidebars - You can easily manage visibility of sidebars in specific documents.
  4. SEO - It's also possible to use properties for SEO. It's very painful to define a nice title and description for every page on your site, with properties this is not necessary (inheritance).
  5. Protected Areas - Closed user groups
  6. Change the appearance of the website depending on the properties (eg. micro-sites, nested sites)
  7. Mark them for some automated exports (PDF, RPC's, …)

As you can see there are really useful cases for properties, feel free to use them for whatever they seem to be useful.

A Few Facts

  • Documents follow the MVC pattern; therefore, Pimcore requires that there is at least one controller with an action and a template file.
  • Pimcore comes with a DefaultController containing a defaultAction and a template file.
  • Because of the MVC architecture, there is a clear separation between your data, the functionality and the templates.
  • Templates for Pimcore are created with Twig.
  • As the templates are written in Twig, there is a clear separation of logic (controllers) and design (view / template).

Create Your First Document

Working with documents is described in detail in our Create a First Project manual.

Cleanup Documents Types

Uninstalling bundles may not always clean up data or database tables in the process to avoid data loss. Running the following command removes type specific tables and enum types from the documents table. The following types are protected and cannot be cleaned up via this command: page, link, snippet, folder,hardlink ,email

You can clean up multiple types at once.

bin/console pimcore:documents:cleanup <type1> <type2> <type3>

Document Topics