SEO Link to book shows Tag-List instead of book

Started by le5, 16 September 2015, 14:15:28

Previous topic - Next topic
A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

le5

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


A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

federica

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
Al mondo ci sono 10 tipi di persone, quelli che hanno capito il codice binario e quelli che non l'hanno capito.
Informatizzati [url="https://informatizzati.org"]https://informatizzati.org[/url]
Stacca la spina [url="https://disconnessi.org"]https://disconnessi.org[/url]

le5

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