Silverstripe 3.1.2 is modifying anchor links
Asked Answered
O

2

7

I tried to build tabs with jquery. But i recognized that my links

<a href="#tab-1">Tab 1</a>

are converted to

<a href="/#tab-1">Tab 1</a>

Because of the Slash at the beginning the tabs doesn't work. Why is Silverstripe modifiying my anchor links and how can I stop it from doeing this??

Omidyar answered 13/12, 2013 at 7:8 Comment(0)
N
6

On 2.4er setup I set in _config.php

SSViewer::setOption('rewriteHashlinks', false);

not tested with 3.x and the yml config layer

Nativeborn answered 13/12, 2013 at 8:35 Comment(6)
can you try, make it work the yml-way? somth like this (no tabs just space in /mysite/_config/config.yml) SSViewer: setOption: rewriteHashlinks: trueNativeborn
if i copy paste it, it doesn't work. edit: doesn't matter which constellation I try. It doesn't work :/ can you tell me the advantages of using the yml file instead of config.php?Omidyar
YML config are cached and so will give you a performance inscrease. Also, some of the old notation will most likely be depracated soon. Try this in your YML SSViewer.rewrite_hashlinks: false (Replacing the '.' with a new line and 2 spaces indentation, like for theme)Pocked
i tried this before. doesn't work. thank you for the explanation. Is there a guide or something like this where i could look up how to convert my _config.php configurations to a yml?Omidyar
did you ?flush the cache after updating the yml? Check the changelog doc.silverstripe.org/framework/en/3.1/changelogs/… there is all you need therePocked
still did not try myself but this guy says: SSViewer: rewrite_hash_links: false github.com/redema/silverstripe-patchwork/blob/master/_config/…Nativeborn
B
4

SSViewer::setOption() is deprecated in 3.2

Use one of the following examples to set rewrite_hash_links

config.yml

SSViewer:
  rewrite_hash_links: false

_config.php

Config::inst()->update('SSViewer', 'rewrite_hash_links', false);

(http://api.silverstripe.org/3.1/class-SSViewer.html#_setOption)

Blues answered 8/8, 2014 at 4:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.