A customer of ours had created his own news page. It consisted of one big HTMl page that he had added to over the past 15 years. Unfortunately it was one big HTMl page and thus not very practical for Search Engine Optimization. At least we thought we could do more.

To restructure it according to our SEO’s requirements in Typo3 we manually created a page for each news item. That was a bit of work, but I couldn’t think of a better solution. Each new page was then put below a page for the appropriate year to make things easier to find. (And to create more pages for our SEO). I then added a sitemap with abstract to the yearly pages to help the users navigate. But even with all kinds of CSS formating that just didn’t cut it.

The yearly pages themselves were supposed to make the visitors want to go and look at the  detail pages a sort of teaser effect. For that we needed a ‘more’ button and a teaser image from the content element. – At first I thought of adding the images to each page resource and then creating a menu from that. We had done that often enough. That would have meant editing each page property though and would have meant more work for the customer when he later adds news items.

So what I did, was to re-write the standard Typo3 sitemap with abstracct. Now the yearly pages look really great and they are easily added to.
OK, so here’s the code:

menu {
 news = HMENU
 news {
 special = directory
 special.value.field = pages
 wrap = <div>|</div><hr>
 1 = TMENU
 1 {
 NO = 1
 NO {
 allWrap = <hr><div>|</div>
 stdWrap {
 htmlSpecialChars = 1
 }
 ATagParams = target = "_top"
 afterWrap =  |
 linkWrap = <h2>|</h2>
 after.cObject = COA
 after.cObject {
 wrap = | 

 10 < styles.content.get
 10 {
 select {
 pidInList.field = uid
 max = 1
 }
 renderObj = COA
 renderObj {
 wrap = <table cellpadding="0" cellspacing="0" border="0"><tr>|</tr></table>
 10 = TEXT
 10 {
 wrap = <td>|</td>
 field = bodytext
 stdWrap {
 crop = 360 | &nbsp;[...]
 parseFunc < lib.parseFunc_RTE
 parseFunc.nonTypoTagStdWrap.HTMLparser {
 keepNonMatchedTags = 0
 htmlSpecialChars = 2
 allowTags = img,u,ul,ol,b,strong,li,em,i,p,br,h1,h2,h3
 removeTags = a
 }
 }
 }
 20 = IMAGE
 20 {
 wrap = <td>|</td>
 file {
 import = uploads/pics/
 import.field = image
 width = 110
 }
 altText.field = header
 titleText.field = header
 }
 }
 }
 20 = TEXT
 20 {
 required = 1
 data = field : tx_gstaliaspro_aliaspro
 wrap = <a href="|">more...</a><br />
 }
 } # after.cObject
 } # NO
 target = page
 } # 1
 } # news

Now overload the standard definition of sitemap 4:

tt_content.menu.20.4 < menu.news

For all those that like me find formating code very important, I excuse myself. WordPress just went and swallowed most of the spaces – as it should according to the HTML definition. One of these days when I have lots of time I will go and find a better solution for posting code.


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *