Vox Populi(x) forum

Alexandria Book Library => Supporto (Support) => Topic started by: le5 on 16 September 2015, 14:15:28

Title: SEO Link to book shows Tag-List instead of book
Post by: le5 on 16 September 2015, 14:15:28
Hello

I successfully adapted a template with alexandria book.
I'm using it multilanguage (de/fr/it) with following 3 menus: Search, Authors and Tags.

Now I noticed a problem, when I use SEO friendly url's.
As example:
- I got to search
- Klick on the first book
- Klick in the detail view of the book on a tag (menu search is still highlighted)
- I get the Tag-View with all books to this tag (menu tag is highlighted correctly)
- I klick again on a title in this list
without SEO
- correctly the book details are shown (menu tag is still highlighted correctly)
with SEO
- it doesn't show the book details, it shows me an other Tag with its book (menu tag is still highlighted correctly)

now i analyzed the url and I notized that the ID of the book and the ID of the Tag are the same.
example: index.php?option=com_abook&view=book&id=1249:basisdaten-bioenergie-deutschland&catid=3:test-franz&Itemid=150&lang=de
- So when without SEO the ID (1249) of the book will load the correct book.
- With SEO on, the ID will first search in the Tags for a corresponding ID (and there exists a Tag with the ID 1249) and if found it will show me the Tag-List instead of the book.

For any advise how to solve this problem I would be happy, if it at all can be solved.

Greetings Pawel

Title: Re: SEO Link to book shows Tag-List instead of book
Post by: federica on 20 September 2015, 19:24:32
Hi le5,
you are right!
Edit file components/com_abook/ router.php then modify line 235 from:
case 'tags':
to:
                case 'tags':
                        if ($count == 2){
                                $vars['view'] = 'book';
                                $catid = explode(':', $segments[0]);
                                $vars['catid'] = (int) $catid[0];
                                $id = explode(':', $segments[1]);
                                $vars['id'] = (int) $id[0];
                        }

If you would like unique url you have to publish a hidden category menu. Create a new menu, create a new menu item (abook category) then publish the related menu module but not assign the position
Title: Re: SEO Link to book shows Tag-List instead of book
Post by: le5 on 21 September 2015, 10:03:16
Hello Federica

I tried this, so I inserted the code at line 235:


case 'tags':
if ($count == 2){
$vars['view'] = 'book';
$catid = explode(':', $segments[0]);
$vars['catid'] = (int) $catid[0];
$id = explode(':', $segments[1]);
$vars['id'] = (int) $id[0];
}
if ($count == 1){
        $vars['view'] = 'tag';
$id = explode(':', $segments[0]);
$vars['id'] = (int) $id[0];
}
if ($count == 0){
$vars['view'] = 'tags';
}
return $vars;
break;
case 'authors':
...


and did add a hidden menu with the category-view (just got one).

but now I only can see the home-screen... all other menus or (home is the book-search view) on the results, I get right away an not found error.

did I oversee anything.

Thanks Pawel