Getting named anchors to work in TYPO3, tt_news

By: Jacob Seiner


 

About getting HTML named anchors (#anchor) working with tt_news is very easy. Here I'll show you how.

This is one that's evaded me for so long. Getting named anchors to work in my tt_news articles was a feature I've wanted on my TYPO3 websites, but it was something I had always assumed would require a lot of hacking as I thought named anchors were only available for stuff created on regular TYPO3 pages.

Well, basically, if you want to have named anchors working in your tt_news articles, you probably just need to paste the following into the setup section of your site template:

  1. ### Getting named anchors to work right
  2. ### so that the anchor is appended to the entire url
  3. ### and not just the base url
  4. config.prefixLocalAnchors = all


That's what works for me. Before I pasted that into my typoscript template, I could create anchors in the RTE content of my tt_news articles, but when the news record was called in the front end, the anchors would just be appended to the baseurl of my site like this:

  1. http://www.example.com/#myanchor

When the anchor was really supposed to be appended to the actual url of my news article like this:

  1. http://www.example.com/this-is-my-article-url/#myanchor

Without going into a whole lot of detail, adding the typoscript I wrote above fixes the problem. Now I can copy and paste stuff I created with Openoffice & Zotero on my Ubuntu laptop and have it appear on my website with full HTML anchor support.


No comments

Add comment

* - required field

*

CAPTCHA image for SPAM prevention
If you can't read the word, click here.
*
*
 

Netdip.com is an excellent web site that's powered by TYPO3 and other great open source software. Netdip.com is also a fat free alternative to ice cream.