Wp-calypso: Editor: "View post" href is in Permalink section incorrect if not yet published

Created on 7 May 2020  路  9Comments  路  Source: Automattic/wp-calypso

Steps to reproduce

  1. Create a new post.
  2. Set a permalink.
  3. Save it as a draft or as a scheduled post.

What I expected

Clicking on the "View post" link should take me to the /%year%/%monthnum%/%postname%/ URL, e.g.:

https://example.com/2020/05/07/my-permalink/

If the anchor text is a URL, the link should actually link to where it claims. Granted, both links will ultimately work to load the same place, but if I'm prepping a marketing campaign or something, I'd want the pretty link when I copy/paste it.

What happened instead

Clicking on the "View post" link takes me to the ?p=xxxx URL, e.g.:

https://example.com/?p=3142

Notice the discrepancy:

image

Browser / OS version

Google Chrome 81.0.4044.129 + macOS 10.15.2

Context / Source

Reported in 20916942-hc:

now if I copy this permalink to word and then want to open it it tells that there are no link to it: https://example.com/?p=2833

I see the permalink name is long showing all the title, but when I copy it to word now it is smth short: https://example.com/?p=2833. Before those changes it was not short, it was the same what I copied

As a sidenote, they also liked having the permalink next to the title:

hi, there was a permalink available close to the title of a post, but now it is gone

I dont agree with the new version of permalink, please put the standard version back for me:)

Editor [Goal] Gutenberg [Pri] Low [Type] Enhancement

Most helpful comment

All 9 comments

20947881-hc:

so the url paste comes up with a number - not the name - what am I missing?

I believe this is the expected behavior, permalinks are public-facing features and don't make sense for drafts.

The permalink is a clickable link to a previewable URL. It's true that the URL the link points to is different from the text of the link, but this is a user experience decision that seems reasonable to me.

This is core Gutenberg behavior.

I'm closing this as I don't believe this is a bug. Feel free to reopen if you disagree.

permalinks are public-facing features and don't make sense for drafts.

Fair enough, but what about for scheduled posts? Yes, they're essentially drafts, but as far as the user is concerned, they're a finished product. There's no clear way to grab the URL for a scheduled post and reference it in a newsletter, marketing spiel, etc.

As for drafts, the slug permalink is valid, so what would be the benefit of not always using that if a custom slug is set?

I don't see any upside in mismatching the href vs. the text link. Whatever is displayed, I'd expect (as a user) the displayed text to match the underlying link.

@sirreal

Should we confirm with our UX designers before making the change?

Should we confirm with our UX designers before making the change?

@jeyip Since this is core behavior I think the appropriate course is to raise the issue in Gutenberg. There doesn't seem to be strong motivation to diverge from core behavior for this.

Thanks for the clarification. Ultimately, if this is how core already behaves, this seems more like an enhancement than a regression of functionality. I'm going to modify the issue label accordingly.

permalinks are public-facing features and don't make sense for drafts.

Fair enough, but what about for scheduled posts? Yes, they're essentially drafts, but as far as the user is concerned, they're a finished product. There's no clear way to grab the URL for a scheduled post and reference it in a newsletter, marketing spiel, etc.

I think a lot of the rationale here is historical -- AFAICT, WP always used the ?p=123&preview=true (non-permalink) format to point to previews in the _old_ (pre-Gutenberg) editor, and continues to do so in the Posts wp-admin screen, so Gutenberg chose to be consistent. Now there _might_ be a good reason for that (maybe the ?preview=true query arg isn't guaranteed to work with all permalink structures? :thinking: Seems unlikely though) -- or maybe it's really just historical.

It's true that Scheduled posts, unlike Drafts, use the proper permalink in the old editor tho. So this is something we could change at a minimum.

As for drafts, the slug permalink is valid, so what would be the benefit of not always using that if a custom slug is set?

I can confirm that slug permalinks work for me for drafts (I had to verify since I'd never tried that before).

I don't see any upside in mismatching the href vs. the text link. Whatever is displayed, I'd expect (as a user) the displayed text to match the underlying link.

I think we can file a PR against Gutenberg to get the ball rolling. (Edit: I phrased that poorly -- we already have Yan's https://github.com/WordPress/gutenberg/pull/24380 :slightly_smiling_face: )

I can confirm that slug permalinks work for me for drafts (I had to verify since I'd never tried that before).

Thanks for verifying that!

Was this page helpful?
0 / 5 - 0 ratings