dotnet / docfx

Static site generator for .NET API documentation.
https://dotnet.github.io/docfx/
MIT License
4.04k stars 860 forks source link

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

Open lidermanrony opened 8 years ago

lidermanrony commented 8 years ago

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

saguiitay commented 8 years ago

+1

pascalberger commented 7 years ago

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.

lidermanrony commented 7 years ago

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 notifications@github.com 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 .

lanthonyneville commented 6 years ago

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.

stale[bot] commented 5 years ago

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

lanthonyneville commented 5 years ago

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

superyyrrzz commented 5 years ago

@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.

filzrev commented 6 months ago

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.