Ever had a problem where you would like to open or get the full public address of a page from the editor view in Episerver? Or is it a problem at all?
So, we have a few ways to get the full public url:
Navigating the site, if you have a navigation for those pages. Pages could also be hidden from the navigation and be accessible only by direct url.
Using search in the site and hope it finds the page.
From the editor, select Page > Options > View on website (opens by the way in the same window).
There’s probably more, but I’ll settle for these.
I’d like to introduce another option which is quite handy and very simple to implement. Navigating straight from the page tree’s context menu without loading or selecting the page on the editor.
Basically, we want to create a client module with a command: ViewOnWebsite and plug it in to the NavigationTreePluginArea.
This is all the logic we need for this to work: var publicUrl = location.protocol + “//” + location.host + this.model.publicUrl; window.open(publicUrl, “_blank”);
Here you can see the final file structure in the VS solution:
And here is the full source code:
This work is based on Tahir Naveed’s blog post about adding an item in the context menu. So, thanks Tahir! https://world.episerver.com/blogs/Tahir-Naveed/Dates/2016/11/adding-a-menu-item-into-context-menu—episerver-10-1-way/
Update: There is also a similar solution by Marija Jemuovic. You can find it from her blog: http://mariajemaria.net/open-unselected-page-new-tab-episerver-tree