docfx icon indicating copy to clipboard operation
docfx copied to clipboard

Have the option (configurable in docfx.json) for search results to open on same tab

Open lidermanrony opened this issue 9 years ago • 8 comments

Currently search results are being opened on a new tab.

For a lot of sites it makes more sense to open the search result on the same tab (just like your typical search engine).

Using the back browser button should return the user back to search results page

lidermanrony avatar Mar 21 '16 09:03 lidermanrony

+1

saguiitay avatar Mar 22 '16 16:03 saguiitay

As a workaround, you can quite easily achieve this by overwriting the docfx.js file in a custom theme. See How-to: Create A Custom Template.

In the custom theme remove the .attr("target", "_blank") on this line.

The drawback is that you'll need to keep the docfx.js file in your theme up to date with the one from the default theme.

pascalberger avatar Dec 02 '16 10:12 pascalberger

Yeah that's what I ended up doing. Another issue with that is that the back button doesn't return you to search results after you clicked on a link

On Fri, Dec 2, 2016, 02:18 Pascal Berger [email protected] wrote:

As a workaround, you can quite easily achieve this by overwriting the docfx.js file in a custom theme. See How-to: Create A Custom Template http://dotnet.github.io/docfx/tutorial/howto_create_custom_template.html .

In the custom theme remove the .attr("target", "_blank") on this line https://github.com/dotnet/docfx/blob/0213400ab3cfc4193548ed4c1bea3b760b7e1395/src/docfx.website.themes/default/styles/docfx.js#L243 .

The drawback is that you'll need to keep the docfx.js file in your theme up to date with the one from the default theme.

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/dotnet/docfx/issues/227#issuecomment-264420848, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMLVTXudY_Bvl1RzUO8j8-7PhCqvhiRks5rD_BggaJpZM4H0-YH .

lidermanrony avatar Dec 02 '16 16:12 lidermanrony

Can this be looked at please? This feature doesn't make a lot of sense to me .... its so easy in browsers these days to manually control whether to open in a new tab/window, but with the link target hard-coded you have no choice.

For me, as I embed a DocFX site in another site via an IFrame, clicking search links means the user leaves the context of the parent site and it is not intuitive for them often how to get back.

The ability to control the link target via a meta-data property would be best. As others have said, making a whole new template just for this is not ideal.

lanthonyneville avatar Aug 30 '18 16:08 lanthonyneville

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Mar 06 '19 03:03 stale[bot]

This is still an issue. Please can this be looked at.

lanthonyneville avatar Mar 06 '19 15:03 lanthonyneville

@lanthonyneville bot will not close this issue any more as it is marked as feature-request.

Back to this issue, #956 provides an implementation but back button cannot work. I think it need to change the search experience with concrete result URL to support this.

superyyrrzz avatar Mar 06 '19 15:03 superyyrrzz

Back to this issue, https://github.com/dotnet/docfx/pull/956 provides an implementation but back button cannot work. I think it need to change the search experience with concrete result URL to support this.

Modern browser supports bfcache (Back-forward cache) by default.

It seems to works as expected by removing target="_blank" attribute. When Back event occurred. search-results view states are automatically restored.

filzrev avatar Mar 18 '24 16:03 filzrev