Remove default "noopener noreferrer nofollow" options

I think it should be the ability to choose rel tags. Cos for internal link building this is a bad idea. Or give the ability in field settings to add or remove these tags.
I mean fields writer / lists that use app.js

toDOM:t=>["a",{...t.attrs,rel:"noopener noreferrer nofollow"},0]}}}
6 Likes

I agree with you. All links in a writer field or in paragraph block field get attached the rel attribute without any chance to adjust them.

For blogs and magazines is this behavior not optimal. Also from SEO perspective.

In Discord a workaround appears. May this helps you. Discord

My quick and dirty solution for this issue: I created a custom field method which do a simple search and replace in the HTML.

'fieldMethods' => [
    'toBlocksCustom' => function ($field) {
        $html = $field->toBlocks()->toHtml();
        $html = str_replace('rel="noopener noreferrer nofollow"', 'rel="noopener noreferrer"', $html);
        return $html;
    }
  ]
2 Likes

yes, but I think that in the core of Kirby should be functionality to choose rel settings.

1 Like

I agree too. These hardcoded rel attribute is not optimal for many things - SEO for example. IMHO there should be a field (simple input[type=β€œtext”] would be enough) where it’s possible to define the rel attribute

Just ran into this issue myself. Will use a hack in the meantime, but I’ve added a feature request on the official board if anyone wants to help vote it up.

Could you please post your solution if it is different from the one above?
And if not, then could you show please how your code looks like in the template where blocks are called?
Thank you.

I vote for this also to be optional or improved to add

rel="noopener noreferrer nofollow

only to external links.

ooh, interesting problem :slight_smile:

I’ve seen that in the meantime 3.6.0 has switched to "noopener noreferrer".

But for further customization here’s a workaround (maybe a bit less hacky than patching the panel dist file):

  1. Create a plugin

    index.js

    panel.plugin('rasteiner/oh-hai-mark', { 
      components: {
        'k-writer': {
          extends: 'k-writer',
          mounted() {
            this.editor.marks.link.toDOM = node => ["a", {
              ...node.attrs,
              // rel: "noopener noreferrer", // NOPE!
            }, 0]
          }
        }
      }
    });
    

    index.php:

    <?php 
    use Kirby\Cms\App as Kirby;
    
    Kirby::plugin('rasteiner/oh-hai-mark', []);
    
  2. Use it.

2 Likes

Great!

And I just saw this now kirbytext | Kirby CMS :partying_face:

Will this work with blocks?