0

As path aliases now seem revisionable (from 8.8.x, see Convert path aliases to full featured entities) what is the best way to set an unpublished page (that was unpublished by a content moderation—as per accepted answer in How to unpublish content that is under moderation) to not have the alias enabled? This seems to be what the status field is for, so what code should be used to set this when I know the entity (or is there already an existing module that does this when a page is unpublished)? Does cache need to be invalidated after status field change too?

Of note, the desire is to effectively remove all traces of a page from public view (i.e. for an anonymous user) but the page's history needs to be kept for retention/record keeping purposes, so hence the requirement to only unpublish the page (and not delete it, which would remove the alias record). If the alias isn't disabled for an unpublished page (like it is by default) then users are taken to the login page, thus not achieving the "remove all traces of it" goal. I understand authenticated users probably won't be able to access this page by its alias path with status set to 0, but this is an acceptable (even preferred, for consistency) outcome.

Thanks

2
  • 1
    I don't think that has changed with revisions, I believe it is more a matter of HTTP 403 vs. HTTP 404, see Returning alternate HTTP codes for unpublished node
    – Hudri
    May 4, 2021 at 13:58
  • The 403 is an outcome of the path being found and a user not permitted to open it (otherwise they get presented the page), so isn't adding the override an after-the-fact solution? Wouldn't it now be better to use the new status field to solve the problem? This seems to be its intended use (see intro description of drupal.org/project/drupal/issues/3007669). It has now been integrated in path alias table and seems to be ready for use (e.g. setting a path alias record manually now to a status of 0 does disable the record/alias form being used), so shouldn't it be used?
    – GlenA
    May 11, 2021 at 1:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.