ankitskvmdam / clean-jsdoc-theme

A beautifully crafted theme / template for JSDoc 3. https://ankdev.me/clean-jsdoc-theme/v4
https://www.npmjs.com/package/clean-jsdoc-theme
MIT License
167 stars 41 forks source link

AJAX navigation #136

Open Viiprogrammer opened 2 years ago

Viiprogrammer commented 2 years ago

Is your feature request related to a problem? Please describe.

No

Describe the solution you'd like

Add AJAX navigation for menu / @link and other links

Additional context

It's a little more convenient than page reload transitions, and on mobile it's faster and a little more economical.

ankitskvmdam commented 2 years ago

@Viiprogrammer Could you explain this a little bit more?

Viiprogrammer commented 2 years ago

With ajax navigation no page reload needed (when you click to the link it load content of page / page with fetch or XMLRequestHttp and insert getted HTML to current page HTML, after this push new url to browser history.

Examples of realization:

https://habr.com/ru/post/154617/ (available in Russian only :( )

https://stackoverflow.com/questions/2586661/url-navigation-in-an-ajax-based-website

https://developer.mozilla.org/en-US/docs/Web/API/History_API/Example

ankitskvmdam commented 2 years ago

Oh.. I think it is something like SPA (Single Page Application).

Do you have any opinion/recommendation on how to implement this?

Viiprogrammer commented 2 years ago

yes, this technology was before spa and even now it is, where there is no spa, but unlike spa, it is usually there where ssr is used and it is easier to integrate it into any application, it is not necessary to rewrite it on spa

the only thing that is possible after «go to new page» with ajax is to call a couple of functions to initialize code highlighting and other things for the new HTML

ankitskvmdam commented 2 years ago

@Viiprogrammer does it mean that now we have to export files in .php, if so then it will change the overall workflow.

I have very limited (or no) knowledge of ajax navigation.

Viiprogrammer commented 2 years ago

I thought to do it without a backend (without php, node...) because there is no need for a backend, it will greatly complicate life) and will not give any profit

maybe it has some other name besides ajax/pjax, but I never thought about it

backspaces commented 1 year ago

11ty may be what you're looking for?

ankitskvmdam commented 1 year ago

@backspaces @Viiprogrammer I am working on a new version of clean-jsdoc-theme in which I will use next js. Do you have any opinions?

I have created a repo to test the possibilities. https://github.com/ankitskvmdam/clean-jsdoc-next

backspaces commented 1 year ago

I don't use React so don't know it's advantages. 11ty is so dead simple yet quite powerful especially for multi page apps. Otoh if you are looking for ready made components, React may be a win,

Viiprogrammer commented 1 year ago

@backspaces @Viiprogrammer I am working on a new version of clean-jsdoc-theme in which I will use next js. Do you have any opinions?

I have created a repo to test the possibilities. https://github.com/ankitskvmdam/clean-jsdoc-next

I was thinking about Vue / React options, but they have a problem in that they need SSR if you need to get Server side render and at the same time keep what SPA has.

Maybe It's possible to get both without actually rendering on the server side with Svelte But I have never used Svelt and don't know for sure if there are any problems

ankitskvmdam commented 1 year ago

@backspaces I looking to directly port Nextra or something similar to this.

@Viiprogrammer There is an option in Next.JS to directly export all the static files.

The biggest advantage of using React is its ecosystem.

Viiprogrammer commented 1 year ago

@backspaces I looking to directly port Nextra or something similar to this.

@Viiprogrammer There is an option in Next.JS to directly export all the static files.

The biggest advantage of using React is its ecosystem.

In any case, a pretty good idea, I think it would be cool