Yancy::Plugin::Editor - Yancy content editor, admin, and management application


version 1.088


    use Mojolicious::Lite;
    # The default editor at /yancy
    plugin Yancy => {
        backend => 'sqlite://myapp.db',
        read_schema => 1,
        editor => {
            require_user => { can_edit => 1 },

    # Enable another editor for blog users
    app->plugin->yancy( Editor => {
        moniker => 'blog_editor',
        backend => app->yancy->backend,
        schema => { blog_posts => app->yancy->schema( 'blog_posts' ) },
        route => app->routes->any( '/blog/editor' ),
        require_user => { can_blog => 1 },
    } );


This plugin contains the Yancy editor application which allows editing the data in a Yancy::Backend.


This plugin has the following configuration options.


The backend to use for this editor. Defaults to the default backend configured in the main Yancy plugin.


The schema to use to build the editor application. This may not necessarily be the full and exact schema supported by the backend: You can remove certain fields from this editor instance to protect them, for example.

If not given, will use "read_schema" in Yancy::Backend to read the schema from the backend.


Instead of "schema", you can pass a full OpenAPI spec to this editor. This is deprecated; see Yancy::Guides::Upgrading.


The default controller for API routes. Defaults to Yancy::Controller::Yancy. Building a custom controller can allow for customizing how the editor works and what content it displays to which users.


The name of this editor instance. Used to build helper names and route names. Defaults to editor. Other plugins may rely on there being a default editor named editor. Additional instances should have different monikers.


A base route to add the editor to. This allows you to customize the URL and add authentication or authorization. Defaults to allowing access to the Yancy web application under /yancy, and the REST API under /yancy/api.

This can be a string or a Mojolicious::Routes::Route object.


The URL to use for the "Back to Application" link. Defaults to /.


The title of the page, shown in the title bar and the page header. Defaults to Yancy.


The host to use for the generated OpenAPI spec. Defaults to the current system's hostname (via Sys::Hostname).


An OpenAPI info object, as a Perl hashref. See the OpenAPI 2.0 spec for what keys are allowed in this hashref.



    $app->yancy->editor->include( $template_name );

Include a template in the editor, before the rest of the editor. Use this to add your own Vue.JS components to the editor.

    $app->yancy->editor->menu( $category, $title, $config );

Add a menu item to the editor. The $category is the title of the category in the sidebar. $title is the title of the menu item. $config is a hash reference with the following keys:


The name of a Vue.JS component to display for this menu item. The component will take up the entire main area of the application, and will be kept active even after another menu item is selected.

Yancy plugins should use the category Plugins. Other categories are available for custom applications.

    app->yancy->editor->include( 'plugin/editor/custom_element' );
        'Plugins', 'Custom Item',
            component => 'custom-element',
    @@ plugin/editor/custom_element.html.ep
    <template id="custom-element-template">
        <div :id="'custom-element'">
            Hello, world!
    %= javascript begin
        Vue.component( 'custom-element', {
            template: '#custom-element-template',
        } );
    % end
screenshot of yancy editor showing custom element


Get the route where the editor will appear.


    my $openapi = $c->yancy->openapi;

Get the Mojolicious::Plugin::OpenAPI object containing the OpenAPI interface for this Yancy API.


To override these templates, add your own at the designated path inside your app's templates/ directory.


This is the main Yancy web application. You should not override this. Instead, use the "yancy.editor.include" helper to add new components. If there is something you can't do using the include helper, consider asking how on the Github issues board or filing a bug report or feature request.


Yancy::Guides::Schema, Mojolicious::Plugin::Yancy, Yancy


Doug Bell <>


This software is copyright (c) 2021 by Doug Bell.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.