Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display only default language in link browser #40

Open
webian opened this issue Nov 30, 2016 · 1 comment
Open

Display only default language in link browser #40

webian opened this issue Nov 30, 2016 · 1 comment

Comments

@webian
Copy link
Contributor

webian commented Nov 30, 2016

Hi @cobwebch,
first of all I'm sorry for the long post, this is a small problem but a little hard to analyze.

Actually in the link browser there are displayed both the default language records and the translated records.
I found out that, at least in my installations, if an editor picks a translated record then the generated link causes problems with the fragile Realurl 2.
Instead if the editor picks the default language records there are no problem and even the translated pages display the links to the right translated records.

By instance, these are the links that appear in EXT:news list for default and second language:
Default language:
index.php?id=44&L=0&tx_news_pi1%5Bnews%5D=100181&tx_news_pi1%5Bcontroller%5D=News&tx_news_pi1%5Baction%5D=detail&cHash=6c102a4644eba9390869bb79afd60104
Second language:
index.php?id=44&L=1&tx_news_pi1%5Bnews%5D=100181&tx_news_pi1%5Bcontroller%5D=News&tx_news_pi1%5Baction%5D=detail&cHash=6c102a4644eba9390869bb79afd60104

Everything is ok and the only thing that changes is the L parameter.

Now, if we use instead the link browser and we pick the second language record the link becomes:
index.php?id=44&L=1&tx_news_pi1%5Bnews%5D=100182&tx_news_pi1%5Bcontroller%5D=News&tx_news_pi1%5Baction%5D=detail&cHash=68d9bb161c64e5bc17baf08180d21202

Here what changed are the parameters: L; news uid; cHash.
For Realurl 2 obviously it is a different url even if it display the correct content.

The real problem is that at the end we have 2 different urls with the same content, bad for SEO.

I tried to find a way to display only the default language record in the link browser but I'm unable to find a viable solution.

The problem could be easily solved if there was a way to set to false $this->localizationView of DatabaseRecordList so only the default language records would be displayed in the link browser but I can't find a way to set it without hacking the core.

One ugly solution could be to temporary store $GLOBALS['TCA'][$table]['ctrl']['languageField'] and then unset it before calling DatabaseRecordList->getTable(). But this need also to use getTable hook to change the where clause.

Please, do you have any other idea?

@webian
Copy link
Contributor Author

webian commented Dec 1, 2016

As a temporary fix I added this css to hide non-default language records in link browser:
#typo3-browse-links-php .recordlist tr { display: none; } #typo3-browse-links-php .recordlist tr[data-l10nparent="0"] { display: table-row; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant