Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: exp:publisher:languages - Parameter to show alternate URL’s only when translation of entry exists?

Status Resolved
Add-on / Version Publisher 1.2.2
Severity Critical
EE Version 2.7.2

Nick Benson

Mar 18, 2014

Quick / hopefully easy question for you. Let’s say the page at /foo has a German translation, at /de/foo. Spanish is also setup as a language on our site, but, /foo hasn’t been translated yet.

Is it possible to generate a list of alternate links that only contains the English and German versions, but no Spanish?

When I use this, I’m getting links to the current page in all of the languages configured in Publisher, not the languages the particular entry is available in.

{exp:publisher:languages show_current="yes"}
    <link rel="alternate" hreflang="{short_name}" href="{translated_url}">
{/exp:publisher:languages}

That code is giving me:

<link rel="alternate" hreflang="{short_name}" href="http:www.example.com/foo">
<link rel="alternate" hreflang="{short_name}" href="http:www.example.com/de/foo">
<link rel="alternate" hreflang="{short_name}" href="http:www.example.com/es/foo">

Desired output:

<link rel="alternate" hreflang="{short_name}" href="http:www.example.com/foo">
<link rel="alternate" hreflang="{short_name}" href="http:www.example.com/de/foo">
#1

BoldMinded (Brian)

That languages list isn’t entry specific. I’m not sure what hoops I’d have to jump through to get it to work that way. The main issue at hand is it would be really difficult on a non-Pages/Structure page b/c I don’t know what the main entry is for the page otherwise.

#2

Nick Benson

Good to know… perhaps an entry_id parameter could be added to reduce your implementation hoop count?

{exp:publisher:languages entry_id="{entry_id}"}
    <link rel="alternate" hreflang="{short_name}" href="{translated_url}">
{/exp:publisher:languages}

Is there any other way to list the languages a specific entry is available in to the front-end?

#3

BoldMinded (Brian)

That was my other thought, and it was pretty easy to add. I’ll email you a new build.

#4

BoldMinded (Brian)

Added to 1.2.3 release.

Login to reply