Migrating from enonic xp 5.x to 6.x


I’m trying to migrate some code from 5.x to 6.x and followed instructions from here http://xp.readthedocs.io/en/6.0/appendix/upgrade/index.html
but I get stuck at these lines of code
model.bodyModuleName = ‘m_’ + UTIL.module.getShortName();

Could anyone help?

var portal = require(’/lib/xp/portal’);
var UTIL = require(’/lib/enonic/util’);

// Handle GET request
exports.get = handleGet;

function handleGet(req) {
var me = this;

function renderView() {
    var view = resolve('home.html');
    var model = createModel();

    return UTIL.view.render(view, model);

function createModel() {
    me.site = portal.getSite();
    me.content = portal.getContent();

    var model = {};
    model.mainRegion = me.content.page.regions['main'];
    model.bodyModuleName = 'm_' + UTIL.module.getShortName();

    model.sitePath = me.site['_path'];
    model.pageTitle = getPageTitle();
    model.metaDescription = getMetaDescription();
    model.menuItems = UTIL.menu.get(3);


    return model;

function getPageTitle() {
    return me.content['displayName'] + ' - ' + me.site['displayName'];

function getMetaDescription() {
    var moduleNamePropertyName = module.name.replace(/\./g,'-');
    var metaDescription = null;

    if (me.content.x[moduleNamePropertyName]) {
        if (me.content.x[moduleNamePropertyName]['html-meta']) {
            if (me.content.x[moduleNamePropertyName]['html-meta']['htmlMetaDescription']) {
                metaDescription = me.content.x[moduleNamePropertyName]['html-meta']['htmlMetaDescription'];
    return metaDescription;

return renderView();



Just a side-note, you are using custom meta-data functions here. There’s an app for this in 6.x - SEO Metafields that will just take care of all that code for you so you don’t need to worry. If the fields have custom data stored in 5.0 they might be lost when using the app, but it’s worth testing it out.

Other than that, what is the specific line that fails?