XF 2.1 Any way to make specific link forum links target="_blank"

entelechy

Active member
Any way to make specific link forum links target="_blank"

I can have a link forum link going off-site, and I'd like it to open in another tab instead of dragging the user away from the forum.

Is this possible without customization?
 
For link forums you can edit the node_list_link_forum template, around line 42

Find:
HTML:
<a href="{{ link('link-forums', $node) }}" data-xf-init="{{ $descriptionDisplay == 'tooltip' ? 'element-tooltip' : '' }}" data-shortcut="node-description">{$node.title}</a>

Replace:
HTML:
<a href="{{ link('link-forums', $node) }}" data-xf-init="{{ $descriptionDisplay == 'tooltip' ? 'element-tooltip' : '' }}" data-shortcut="node-description" target="blank_">{$node.title}</a>
 
For link forums you can edit the node_list_link_forum template, around line 42

Find:
HTML:
<a href="{{ link('link-forums', $node) }}" data-xf-init="{{ $descriptionDisplay == 'tooltip' ? 'element-tooltip' : '' }}" data-shortcut="node-description">{$node.title}</a>

Replace:
HTML:
<a href="{{ link('link-forums', $node) }}" data-xf-init="{{ $descriptionDisplay == 'tooltip' ? 'element-tooltip' : '' }}" data-shortcut="node-description" target="blank_">{$node.title}</a>
Thanks Ozzy, and is there any way to only affect a specific link forum?
 
For link forums you can edit the node_list_link_forum template, around line 42

Find:
HTML:
<a href="{{ link('link-forums', $node) }}" data-xf-init="{{ $descriptionDisplay == 'tooltip' ? 'element-tooltip' : '' }}" data-shortcut="node-description">{$node.title}</a>

Replace:
HTML:
<a href="{{ link('link-forums', $node) }}" data-xf-init="{{ $descriptionDisplay == 'tooltip' ? 'element-tooltip' : '' }}" data-shortcut="node-description" target="blank_">{$node.title}</a>

Thank you very much, this solved the problem!
 
Implemented in my add-on (paid):
 
Back
Top Bottom