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: Preview pane shows homepage when trying to preview non-default language

Status Resolved
Add-on / Version Publisher 3.3.1
Severity
EE Version 6.0.6

Paul Nash

Jun 11, 2021

Preview pane shows homepage when trying to preview an entry in a secondary/non-default language.

Steps to replicate:
Create a channel with some fields, set up a preview template.
Add a second language in Publisher
Go to edit an entry, switch to new language variant and attempt to preview.

This seems to happen regardless of draft/published state on entries with and without existing translations.

Tested on two development installs and on multiple channels using a recently supplied bugfix version and the version available from ee addon store.

Have tried setting preview template to an empty template with the word “test” in it: English showed “test” in the preview pane, second language (Spanish) instead showed the homepage (default group/index)

#1

Paul Nash

This is a blocker for our current build so i’ve been looking closer at the settings incase it’s helpful to debug:

Under draft settings, we default to draft on view and save, we have publish previews enabled and “Use EE’s native channel Preview URL” enabled, though have tried with that off also.

The Save and Preview pop up is working for non-default languages, but the live preview slide out still redirects to home.

We do not have url translations on, but we do have url prefix + homepage prefix enabled with prefix hidden for default language.

Under miscellaneous settings, auto redirect is disabled.

All utilities say Good to go!

#2

BoldMinded (Brian)

Sorry this is a blocker right now I’m not sure when I can find time to take a look at this. In the mean time if you can provide screenshots of your relevant settings pages and a video of this occurring it’ll help. The more you can provide the better because I have to take time to replicate the issue.

#3

Paul Nash

Comment has been marked private.

#4

BoldMinded (Brian)

Thanks for this. I’ll try to look into it soon.

#5

BoldMinded (Brian)

What is the value for your Live Preview URL in the channel settings?

#6

BoldMinded (Brian)

Can you also share the template code used to display the live preview? Specifically the channel:entries opening tag?

#7

Paul Nash

the channel from the demo was blog: blog/{url_title}/preview

in that test site, the spanish previews seem to work for the other channels which use: page-preview/{url_title} home/index

the difference in fields between those channels: pages and home use bloqs blog uses 2 textarea’s and a file

but on our other install, preview settings like the following do not work: about-us/index case-studies/preview/{url_title}

#8

Paul Nash

Comment has been marked private.

#9

BoldMinded (Brian)

Comment has been marked private.

#10

Paul Nash

Unfortunately unsuccessful. I have tried this on both the test install and the site in development, Spanish is still showing the home template in the live preview. I uploaded twice incase some files hadn’t updated, but they have & Publisher says the right build number in the CP: 3.3.1 build 7ed7d65c.

Just to be sure, I tested against multiple entries with and without a published Spanish version, attempting to preview both the draft and published versions.

I’m not sure if this is related to the same bug, but i’ve noticed another fairly major bug which makes the plugin unusable with Bloqs (vice versa) and a bit of a major blocker to using draft functionality. See below video for what I’m seeing happen:

https://download.fifty50.co.uk/publisher/EE_Publisher_DraftPublish_bug.mp4 First I show the published version with one of everything. Then I go and show the draft version with different header and save as published. Now the published version has double everything (double the root bloqs, not nested items)

Should I copy this info to another ticket? Bloqs related or Publisher related?

Update before editing: publishing the draft actually broke the homepage of the test install with the following stack trace: (deleting the duplicated bloqs/new content from the published version seems to have fixed it)

Error Caught
Call to a member function getId() on null
user/addons/bloqs/Controller/TagController.php:417

Stack Trace: Please include when reporting this error
#0 user/addons/bloqs/Controller/TagController.php(227): BoldMinded\Bloqs\Controller\TagController->_renderBlockSections(Array, '{!-- bloqs:star...', Object(BoldMinded\Bloqs\Controller\TagOutputBlockContext), Array)
#1 user/addons/bloqs/ft.bloqs.php(576): BoldMinded\Bloqs\Controller\TagController->replace('\n\n {cta_...', Array, Array, Array)
#2 ee/legacy/libraries/api/Api_channel_fields.php(377): Bloqs_ft->replace_tag(' ', Array, '\n\n {cta_...')
#3 ee/legacy/libraries/channel_entries_parser/components/Custom_field_pair.php(177): Api_channel_fields->apply('replace_tag', Array)
#4 ee/legacy/libraries/channel_entries_parser/Parser.php(283): EE_Channel_custom_field_pair_parser->replace('\n \n\n {page_c...', Object(EE_Channel_data_parser), Array)
#5 ee/legacy/libraries/Channel_entries_parser.php(172): EE_Channel_data_parser->parse(Array, Array)
#6 ee/ExpressionEngine/Addons/channel/mod.channel.php(2449): EE_Channel_parser->parse(Object(Channel), Array, Array)
#7 ee/ExpressionEngine/Addons/channel/mod.channel.php(255): Channel->parse_channel_entries()
#8 ee/legacy/libraries/Template.php(1702): Channel->entries()
#9 ee/legacy/libraries/Template.php(1386): EE_Template->process_tags()
#10 ee/legacy/libraries/Template.php(560): EE_Template->tags()
#11 ee/legacy/libraries/Template.php(228): EE_Template->parse('{!-- ra:0000000...', false, 1, false)
#12 ee/legacy/libraries/Template.php(163): EE_Template->fetch_and_parse('', Array, false)
#13 ee/legacy/libraries/Core.php(647): EE_Template->run_template_engine('', '')
#14 ee/legacy/controllers/ee.php(53): EE_Core->generate_page()
#15 [internal function]: EE->index()
#16 ee/ExpressionEngine/Core/Core.php(251): call_user_func_array(Array, Array)
#17 ee/ExpressionEngine/Core/Core.php(111): ExpressionEngine\Core\Core->runController(Array)
#18 ee/ExpressionEngine/Boot/boot.php(161): ExpressionEngine\Core\Core->run(Object(ExpressionEngine\Core\Request))
#19 public/index.php(164): require_once('...')
#19 public/index.php(164): require_once('...')
#11

Paul Nash

For reference I tried the above with Bloqs 4.5x but have just upgraded the test site to Bloqs4.7.1 downloaded from the EE addon store, to make sure, and it’s still breaking when saving draft to published.

#12

BoldMinded (Brian)

Try to replicate that without doing the Live Preview… take the LP out of the equation. Just save the entry in the same pattern to see if it duplicates the bloqs then.

#13

BoldMinded (Brian)

I can replicate this locally. While this is an unfortunate bug, I wouldn’t classify this as a blocker. It can be worked around, especially during the early part of site development. This is a bit of a complex scenario, so I’m not sure when I’ll have a fix available.

Regarding the live preview loading the home page template… that could be any number of things. Check your network log to make sure it’s not performing a redirect. I’m going to focus on the bloq duplication issue first b/c that is more critical.

#14

Paul Nash

Not sure which you were confirming on locally but LP out of the equation = same result of bloq duplication.

RE live preview showing home: Checking network log in DevTools, there is no redirect, both languages load the same url with different referer http://ee6dev/?ACT=4&channel_id=2&entry_id=18

I will post a copy of the response headers and post data for both languages in following comment to prevent breaking the character limit here.

#15

Paul Nash

Spanish live preview:

spanish response headers:
POST /?ACT=4
channel_id=2
entry_id=18 HTTP/1.1
Host: ee6dev
Connection: keep-alive
Content-Length: 2041
Pragma: no-cache
Cache-Control: no-cache
Accept: text/html, */*; q=0.01
X-CSRF-TOKEN: 5c681f94dcc90878624e848bbd969c42d040110f
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Origin: http://ee6dev
Referer: http://ee6dev/ee6dsys.php?/cp/publish/edit/entry/18
lang_id=2
publisher_status=draft
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Cookie: exp_publisher_prev_status=open; PHPSESSID=umd35vm64quoau53s0lmphfnij; exp_publisher_prev_status_cp=open; exp_remember=dafee0b910accdabbfd23e2bdc697c066e127304; exp_publisher_site_prev_language=2; exp_publisher_site_language=1; exp_last_visit=1623775718; exp_publisher_save_status_cp=open; exp_publisher_tracker=%5B%7B%22uri%22%3A%22http%3A%2F%2Fee6dev%2F%22%2C%22is_ajax%22%3A%22n%22%7D%2C%7B%22uri%22%3A%22http%3A%2F%2Fee6dev%2F%22%2C%22is_ajax%22%3A%22n%22%7D%5D; exp_tracker=%7B%220%22%3A%22index%22%2C%221%22%3A%22page1%22%2C%222%22%3A%22index%22%2C%223%22%3A%22page1%22%2C%22token%22%3A%226b06816988016a203ecba89a4a075d7a193a449b669dd26c7ab3abec81272fa7ff24a4c8c67ca991302b1a24bfde34dd%22%7D; exp_sessionid=12b9e700fd0827bf3a23a95ea54e38e6fd94e784; exp_flash=%7B%22%3Aold%3Aentry_id%22%3A14%2C%22%3Aold%3Aalert%3Ainline%3Aentry-form%22%3A%7B%22title%22%3A%22Entry+Updated%22%2C%22body%22%3A%22%3Cp%3EThe+entry+%3Ca+href%3D%27ee6dsys.php%3F%2Fcp%2Fpublish%2Fedit%2Fentry%2F14%27%3E%3Cb%3Ehome%3C%2Fb%3E%3C%2Fa%3E+has+been+updated.%3C%2Fp%3E%22%2C%22severity%22%3A%22success%22%2C%22can_close%22%3Atrue%7D%7Deece19df5cdbc3ce6bcd13dc8f420128c8f9cee68beae9311215fa01f91231087493dd150f3fab340102662fc1c7963f; exp_publisher_site_language_cp=2; exp_last_activity=1623789359


spanish post data:
send_approval=n
publisher_save_status=draft
publisher_view_status=draft
site_language=2
csrf_token=5c681f94dcc90878624e848bbd969c42d040110f
title=A+short+Entry
url_title=a-short-entry
field_id_3=Spanish+TEST+Tail+t-bone+andouille%2C+aute+rump+elit+culpa+in+sunt.+Hamburger+duis+irure+sint%2C+laborum+cillum+ea+officia+proident+corned+beef+et.+Beef+ribs+meatloaf+rump+short+loin+turkey+nulla+cow+ex+voluptate+strip+steak+dolore+occaecat.+Esse+quis+excepteur+sirloin+reprehenderit+lorem+shoulder+pastrami+flank+pig+shank+nisi+short+ribs+bacon.%0D%0A%0D%0AIrure+ut+ut+jerky+id+voluptate.+Dolore+andouille+pancetta+chicken%2C+deserunt+jowl+enim+strip+steak+ea+ball+tip+cillum+ham.+Dolore+picanha+in+prosciutto+esse+porchetta+ullamco+salami+cupim.+Tri-tip+non+esse%2C+veniam+spare+ribs+pastrami+bresaola+fatback.%0D%0A%0D%0A%3Cul%3E%0D%0A%3Cli%3EThis+is+a+list+item%3C%2Fli%3E%0D%0A%3Cli%3EAnd+another%3C%2Fli%3E%0D%0A%3Cli%3EOne+more+list+item%3C%2Fli%3E%0D%0A%3C%2Ful%3E%0D%0A%0D%0AExercitation+voluptate+capicola+ut%2C+fatback+sed+t-bone+id.+Mollit+meatloaf+pig+meatball+brisket+ea+sed+shank+cupim+spare+ribs+magna+kevin+sirloin+deserunt.+Flank+minim+incididunt+velit+consequat.+Laborum+ground+round+filet+mignon+chicken+officia.+Capicola+shankle+dolore%2C+veniam+adipisicing+reprehenderit+ut+est+laborum+pork+chop.+Pork+rump+cillum+turkey%2C+sausage+salami+non+tongue+ex+t-bone+minim+duis+lorem+voluptate.+Aute+pariatur+elit%2C+est+rump+in+corned+beef+cupidatat+pork+pig+tri-tip+culpa+aliqua.
field_ft_3=xhtml
field_id_12=%7Bfiledir_5%7D500x500.png
field_id_13=Tail+t-bone+andouille%2C+aute+rump+elit+culpa+in+sunt.+Hamburger+duis+irure+sint%2C+laborum+cillum+ea+officia+proident+corned+beef+et.+Beef+ribs+meatloaf+rump+short+loin+turkey+nulla+cow+ex+voluptate+strip+steak+dolore+occaecat.+Esse+quis+excepteur+sirloin+reprehenderit+lorem+shoulder+pastrami+flank+pig+shank+nisi+short+ribs+bacon.
entry_date=5%2F1%2F2021+10%3A39+PM
expiration_date=
categories%5Bcat_group_id_1%5D%5B%5D=
channel_id=2
status=open
author_id=1
versioning_enabled=y
#16

Paul Nash

English live preview:

english response headers:
POST /?ACT=4
channel_id=2
entry_id=18 HTTP/1.1
Host: ee6dev
Connection: keep-alive
Content-Length: 2041
Pragma: no-cache
Cache-Control: no-cache
Accept: text/html, */*; q=0.01
X-CSRF-TOKEN: 5c681f94dcc90878624e848bbd969c42d040110f
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Origin: http://ee6dev
Referer: http://ee6dev/ee6dsys.php?/cp/publish/edit/entry/18
lang_id=1
publisher_status=draft
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Cookie: exp_publisher_prev_status=open; PHPSESSID=umd35vm64quoau53s0lmphfnij; exp_publisher_prev_status_cp=open; exp_remember=dafee0b910accdabbfd23e2bdc697c066e127304; exp_publisher_site_prev_language=2; exp_publisher_site_language=1; exp_last_visit=1623775718; exp_publisher_save_status_cp=open; exp_publisher_tracker=%5B%7B%22uri%22%3A%22http%3A%2F%2Fee6dev%2F%22%2C%22is_ajax%22%3A%22n%22%7D%2C%7B%22uri%22%3A%22http%3A%2F%2Fee6dev%2F%22%2C%22is_ajax%22%3A%22n%22%7D%5D; exp_tracker=%7B%220%22%3A%22index%22%2C%221%22%3A%22page1%22%2C%222%22%3A%22index%22%2C%223%22%3A%22page1%22%2C%22token%22%3A%226b06816988016a203ecba89a4a075d7a193a449b669dd26c7ab3abec81272fa7ff24a4c8c67ca991302b1a24bfde34dd%22%7D; exp_sessionid=12b9e700fd0827bf3a23a95ea54e38e6fd94e784; exp_flash=%7B%22%3Aold%3Aentry_id%22%3A14%2C%22%3Aold%3Aalert%3Ainline%3Aentry-form%22%3A%7B%22title%22%3A%22Entry+Updated%22%2C%22body%22%3A%22%3Cp%3EThe+entry+%3Ca+href%3D%27ee6dsys.php%3F%2Fcp%2Fpublish%2Fedit%2Fentry%2F14%27%3E%3Cb%3Ehome%3C%2Fb%3E%3C%2Fa%3E+has+been+updated.%3C%2Fp%3E%22%2C%22severity%22%3A%22success%22%2C%22can_close%22%3Atrue%7D%7Deece19df5cdbc3ce6bcd13dc8f420128c8f9cee68beae9311215fa01f91231087493dd150f3fab340102662fc1c7963f; exp_publisher_site_language_cp=1; exp_last_activity=1623789100

english post data:
send_approval=n
publisher_save_status=draft
publisher_view_status=draft
site_language=1
csrf_token=5c681f94dcc90878624e848bbd969c42d040110f
title=A+short+Entry
url_title=a-short-entry
field_id_3=English+TEST+Tail+t-bone+andouille%2C+aute+rump+elit+culpa+in+sunt.+Hamburger+duis+irure+sint%2C+laborum+cillum+ea+officia+proident+corned+beef+et.+Beef+ribs+meatloaf+rump+short+loin+turkey+nulla+cow+ex+voluptate+strip+steak+dolore+occaecat.+Esse+quis+excepteur+sirloin+reprehenderit+lorem+shoulder+pastrami+flank+pig+shank+nisi+short+ribs+bacon.%0D%0A%0D%0AIrure+ut+ut+jerky+id+voluptate.+Dolore+andouille+pancetta+chicken%2C+deserunt+jowl+enim+strip+steak+ea+ball+tip+cillum+ham.+Dolore+picanha+in+prosciutto+esse+porchetta+ullamco+salami+cupim.+Tri-tip+non+esse%2C+veniam+spare+ribs+pastrami+bresaola+fatback.%0D%0A%0D%0A%3Cul%3E%0D%0A%3Cli%3EThis+is+a+list+item%3C%2Fli%3E%0D%0A%3Cli%3EAnd+another%3C%2Fli%3E%0D%0A%3Cli%3EOne+more+list+item%3C%2Fli%3E%0D%0A%3C%2Ful%3E%0D%0A%0D%0AExercitation+voluptate+capicola+ut%2C+fatback+sed+t-bone+id.+Mollit+meatloaf+pig+meatball+brisket+ea+sed+shank+cupim+spare+ribs+magna+kevin+sirloin+deserunt.+Flank+minim+incididunt+velit+consequat.+Laborum+ground+round+filet+mignon+chicken+officia.+Capicola+shankle+dolore%2C+veniam+adipisicing+reprehenderit+ut+est+laborum+pork+chop.+Pork+rump+cillum+turkey%2C+sausage+salami+non+tongue+ex+t-bone+minim+duis+lorem+voluptate.+Aute+pariatur+elit%2C+est+rump+in+corned+beef+cupidatat+pork+pig+tri-tip+culpa+aliqua.
field_ft_3=xhtml
field_id_12=%7Bfiledir_5%7D500x500.png
field_id_13=Tail+t-bone+andouille%2C+aute+rump+elit+culpa+in+sunt.+Hamburger+duis+irure+sint%2C+laborum+cillum+ea+officia+proident+corned+beef+et.+Beef+ribs+meatloaf+rump+short+loin+turkey+nulla+cow+ex+voluptate+strip+steak+dolore+occaecat.+Esse+quis+excepteur+sirloin+reprehenderit+lorem+shoulder+pastrami+flank+pig+shank+nisi+short+ribs+bacon.
entry_date=5%2F1%2F2021+10%3A39+PM
expiration_date=
categories%5Bcat_group_id_1%5D%5B%5D=
channel_id=2
status=open
author_id=1
versioning_enabled=y
#17

Paul Nash

Comment has been marked private.

#18

BoldMinded (Brian)

Comment has been marked private.

#19

BoldMinded (Brian)

Thanks for including the headers on those requests. If Publisher were performing a redirect you would see a “X-Publisher-Redirect” header. At the moment I can’t think of what would be causing the preview to show the home page template without Publisher performing a redirect. If it were showing a blank page or incorrect content it would make more sense to me, but the redirect isn’t adding up. Have you tried stripping your template code down to the bare necessitates just to show the entry title tag? I’m wondering if something in the template is causing the preview to get confused?

#20

Paul Nash

That build does appear to fix the duplicate bloqs issue on my local installs, testing a few pages, I will test more tomorrow on staging and let you know if it occurs again.

Below is now the only thing in template, no layouts or embeds, only this. But same functionality showing the homepage on the second language, title on english/default

{exp:channel:entries channel="blog" status="{publisher:entry_status}"}
{title}
{/exp:channel:entries}

Have also tried with/without channel and status, same result.

Curiously, on the test site I sent earlier, some channels are working and the blog is not. I’ve tried matching all channel settings, including the preview url (which was obviously wrong, i tried all settings incrementaly) and as expected in english i got a blank page with wrong preview template and title with cut down one, but spanish showed me the homepage again.

#21

BoldMinded (Brian)

Glad to hear the duplicate thing is fixed. I’ll take another look at the live preview stuff. They slightly changed how LP actually loads in the CP in v6, so something might be out of whack.

#22

BoldMinded (Brian)

Comment has been marked private.

#23

Paul Nash

Comment has been marked private.

#24

BoldMinded (Brian)

Comment has been marked private.

#25

Paul Nash

The preview and draft functionality now seems to be all working! Thank you very much! Tested on local, staging and my test install.

  • livepreviews working across multiple languages.
  • saving from draft to publish no longer causes bloqs duplicates.
  • saving second language draft to publish now correctly shows second language bloqs in new draft instead of primary language.

I think I have one other bug but I’m hoping there’s a variable i’ve missed as a workaround?! In my layout i’m using the {is_live_preview_request} global variable to hide navigation … is there a way to detect it being the popup preview when saving a draft? I ask because not all phrase variables are being parsed in either preview and I’m using phrases to translate a fixed navigation. Oddly, it’s the primary language that has translations which is the issue!

I’ll follow up with a video in case that helps.

#26

Paul Nash

Comment has been marked private.

#27

BoldMinded (Brian)

I think you need to save the default translated phrase values to the second language as well.

#28

BoldMinded (Brian)

Yeah, you need to save the phrase values to all languages, even if it’s the same text. I had to make this change awhile back because there are some cases where maybe the non-default languages shouldn’t have a value for the phrase. After you do that it should work.

#29

Paul Nash

I’ve gone through and done that, it seems to be all working as expected now, ready for the client. Thank you again!

Login to reply