Overwriting BackendMeta data values

jeroendesloovere's Avatar

jeroendesloovere

29 May, 2012 08:55 AM

In a module I want to overwrite the default meta description (title, keywords, ...).

For example:

// meta
$this->meta = new BackendMeta($this->frm, null, 'title');

I want to do this:

// BackendEdit: change default description
$this->meta->setDescription(sprintf('Please integrate this %1$s, it would be SEO-friendlier', $this->record['title']));

The only negative aspect I see is that in the BackendAdd, we don't have a title yet.
Maby this is fixible using jQuery?

What do you guys think?

  1. 1 Posted by jeroendesloover... on 29 May, 2012 09:03 AM

    jeroendesloovere's Avatar

    Would this be used in the Backend, or should we always do this in the FrontendMeta?

    Only doing it in the Frontend has one big disadvantage => user doens't see the correct description in the backend...

  2. Support Staff 2 Posted by tijs on 30 May, 2012 10:31 AM

    tijs's Avatar

    I think this is a nice feature, the only problem I see is context.
    I think you should do this in the backend, you could extend the query-meta plugin to capture the value of the title-field.

    Another way, more complicated way is to use a callback-function to populate the data, for instance, the description for a page should be different then for a blogpost. For a page it can be the the content of the first paragraph, for a blogpost it can be the introduction.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac