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.