Edit button on live article if editor logged in
complete
Trent Bagshaw
Apologies if this is is already in another request I tried to find it but could not. Basically if I'm on a published article (not portal.d360) and I'm logged is as an editor it would be great to be able to go straight to that page in the portal.d360 editor from the article, rather than having to find it.
Workflow is:
Client points at documentation and says that it's incorrect/out of date. Editor looks at published article, confirms action needs to be taken. Currently has to go and find that article which is an extra few steps, would rather have the ability to go straight to edit page
Log In
Thiru
complete
Thiru
Trent Bagshaw we have the option to "Open in Portal" from the KB site that directly navigates to the respective article / page.
Trent Bagshaw
https://jsfiddle.net/0u47rwnd/1/ to anyone else who is too impatient to wait for this to be acted on, the linked jsfiddle shows (as of 18th May 2021) how you can add custom javascript and css to put a link on the H1 of your article if you are an admin
Joshua Cussen
Trent Bagshaw: Does this still work? I tried but it didn't work for me. I might be doing something wrong.
Do you add these as custom JS/CSS on the Document360 site or do you add them using a browser extension?
Joshua Cussen
I managed to get it working.
For anyone else wondering how, here's what I did:
- Publish a page that is private
- Get the anchor URL of this page in the sidebar (I use a browser extension to show page anchors)
- Replace '#aabbbcasdfasdfawsefqawefwa' in the jsfiddle with the anchor for the private page
- Add the JS part of the fiddle to the site custom javascript
- Add the CSS part of the fiddle to the site custom CSS
Shannon Greywalker
Joshua Cussen: I can verify this works on our site too. I tested myself and a few other people with "team member" accounts. I also tested some "reader accounts".
* Team member accounts see a small "click to edit on Admin Portal" link next to the article's H1 title. Clicking it does indeed work as expected, opening up a new browser tab and taking you right to that article in the Portal site, ready to click the Edit button.
* Reader accounts do NOT see the "click to edit on Admin Portal" link. Clicking around in that area does nothing. Seems safe/secure?
My question for Kovai is why aren't you implementing this as of yesterday? Someone has already figured out the javascript and css that can provide this feature. This is a SUPER convenient way to make occasional content contributors enjoy Doc360 a lot more. It makes the contribution workflow as seamless and frictionless as working on GitHub or many other SSG doc sites.
To anyone else trying to replicate this, the trick is understanding what to copy from your own site's "hidden page anchors" into the jsfiddle. You'll need to install some browser extension that shows you the hidden #anchor-slugs on a page. Then in the Portal site turn that extension on and hover your mouse over ANY of the _article_ titles in the left sidebar. Copy the full URL that the page anchors extension reveals. It should look something like this (not a real URL, BTW):
https://portal.document360.io/1bea3f9d-61bb-43f4-822e-5feb00f348fa/document/v1/view/f54d6f4c-f800-48b2-8d16-bd3643882ea3#f54d6f4c-f800-48b2-8d16-bd3643882ea3
All you care about is that last anchor segment that starts with
#f54...
in the preceding example. Copy that entire last anchor segment (including the hash sign), and use it to replace the #anchor string in the first line of the jsfiddle as Joshua Cussen describes above. Using the above example anchor URL, the first line of the jsfiddle would look like this.var adminQuery = $("#f54d6f4c-f800-48b2-8d16-bd3643882ea3").length > 0; //some article/category only visible to admins
Then you do steps 4 and 5 as Joshua explains above.