Problem/Motivation

While working on #3489112: Integrate responsive preview with Navigation top bar, we realized that navigation toolbars were visible in the preview.

To have a more realistic experience, the preview could be rendered as an anonymous user.

This could lead to a possible issue when doing preview of an unpublished node, or in general a page where anonymous users don't have access, but preview could be valuable. Like unpublished nodes during review phase.

Another option would be to just add some extra CSS ot previews in order to hide Navigation.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#2 3501374.png78.7 KBplopesc
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

plopesc created an issue. See original summary.

plopesc’s picture

Issue summary: View changes
StatusFileSize
new78.7 KB
lauriii’s picture

How this is done by Next.js preview is they generate a token that allows the preview to be loaded with special permissions: https://github.com/chapter-three/next-drupal/blob/main/modules/next/src/.... This might be more complex than what we need but essentially what we'd want the preview to generate is the page as anonymous user, with permissions potentially elevated to view the specific piece of content regardless of it being unpublished.

A more pragmatic approach might be to just try to remove administrative items from the page similar to what's being done in https://git.drupalcode.org/project/same_page_preview/-/blob/2.1.x/same_p.... This might be acceptable even though it doesn't get us to a full solution because there could be custom administrative blocks that are hard for us to identify.

plopesc’s picture

I feel that Next.js preview could be more complex than we want and we could still have some issues about the exact permissions to assign to that anonymous user with steroids.

Could we start with the simpler path and iterate if that's not enough or the community asks for a more elaborated approach?

plopesc’s picture

Status: Active » Needs review

MR created.

rajab natshah’s picture

Thank you for this integration with navigation.
I'm hitting the following case.

Given that my home page is a Node,
And the alias for that page is /node
Then the review will show up a 404 page with https://drupal11x02x02b1.ddev.site:8443/node?responsive_preview=enabled

rajab natshah’s picture

Status: Needs review » Reviewed & tested by the community

rajeshreeputra made their first commit to this issue’s fork.

rajeshreeputra’s picture

Status: Reviewed & tested by the community » Fixed

Merged!

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.