Forum

Thread tagged as: Question, Problem

How do I give a content editor the ability to make text links without invoking o...

I have really fallen out of love with the concept of providing any of the text editors for my clients to use or abuse. It just opens up a whole can of uncontrolled worms.

Blocks and repeaters do most of the work but for some reason I keep drawing a blank when it comes to providing a method of including text based links that don't rely on using one of the text editors.

Anybody figured a way of achieving this please?

William File

William File 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What do you mean by text based links? If you're using Markdown, you'd use the link syntax like:

[this is a link](https://example.com)

If linking to other pages in your site, you could use the Pagelist field type https://addons.perchcms.com/archive.

Simon Clay

Simon Clay 127 points

I suspect you’re referring to text links within a praragraph William, is that right?

I don’t know of any way around that, other than using Redactor which is the best of the editors in my opinion.

Simon Clay said:

I suspect you’re referring to text links within a praragraph William, is that right?

I don’t know of any way around that, other than using Redactor which is the best of the editors in my opinion.

Simon, yes that's it. Poorly structured question on my part! I find the text editors are often used by editors to "redesign" the content so I am not using them.

It's easy enough to dispense with the text editors generally speaking but when it comes to including links within a run of text I just cant see a way to achieve it.

Hi Simon, sounds like a frustrating issue. When you say redesign, what do you mean exactly?

Mark - including a text editor for the client to use can and does allow them to do things to the content that is outside the design, huge text, coloured text, pictures of all sizes and aspect ratios to name but a few.

I am trying to produce templates that allow control of the content but that also adhere to the site design criteria.

Steve

Go watch the tutorial videos.

** ** said:

Go watch the tutorial videos.

Any particular tutorial video in mind or just all of them?

I've encountered the same problem. You can customise Redactor to prevent users adding images or files and restrict text formatting options. I give users a few sensible text editor options and only allow images to be uploaded via image fields so I can ensure they adhere to the site design criteria (as far as is possible).

Perch Blocks are great for this kind of issue as they allow you to impose reasonable limits on content while giving users options.

My customised Redactor config.js code is below. Add or remove items from the buttons and/or formatting arrays as you please. There are also many support threads in the forums and some articles out in the wild with Redactor customising solutions that may work better than mine.

Hope that's helpful though.

Perch.UserConfig.redactor = function(){

  var get = function(profile, config, field) {

    return {
      buttons: ['link', 'format','ul', 'bold', 'italic', 'deleted', 'source'  ],
      formatting: ['p', 'h2', 'h3', 'h4'],
      plugins:['source']
     }

    if (config.plugins.indexOf('source') === -1) config.plugins.push('source');

    return config;
  };

  var load = function(cb) {
    if (typeof jQuery.Redactor.prototype.source == 'undefined') {
        jQuery.getScript(Perch.path+'/addons/plugins/editors/redactor-plugins/source.js', cb);
    } else {
      cb();
    }
  };

  return  {
    'get': get,
    'load': load
  }

}();

Good redactor config example Mark.

Stick that up in Github? And I'll add to the next Perchology newsletter.

It's based on one of your posts Clive, that's why it's good.