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

entelechy

Active member
Licensed customer
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?
 
If it is in the navigation, in the options of the navigation entry for that one you should be able to put that.
 
My bad, mental glitch - it's a link forum in the node list. I've just had a look then and it doesn't seem like I can use html for the url in the options.
 
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