bigskysoftware / htmx

</> htmx - high power tools for HTML
https://htmx.org
Other
38.06k stars 1.29k forks source link

SEO and History API considerations #237

Closed BigGitWorld closed 3 years ago

BigGitWorld commented 3 years ago

Hi! I'm a senior java developer with some experience in javascript frameworks. I read the htmx doc and really love its idea!

But I did not find any doc about the following topics: **1. SEO

  1. History API (back, forward button) support**

I have developed several SPA applications with:

I always was thinking about this scenario:

Also one of the main notes for JAVA back end developer is that java have several powerful HTML template engines to decorate pages and connect them to the back end logic and return a final HTML as a full page or fragment in the response to AJAX request).

Therefore, I always was thinking about this idea why would I have to use javascript front end frameworks (react-based: next.js, angular and etc) to create a SPA, E-commerce site and etc. and NEVER DID NOT LIKE DO IT! because:

But one of the my main concern with my approach is how about my SPA is SEO Friendly or successful in using HTML5 History API.

Can you please clarify me about two above concerns (SEO and History API support) in Htmx?

1cg commented 3 years ago

Hi There,

History support is documented here:

https://htmx.org/docs/#history

If you want transparent SEO support, you can use the hx-boost attribute to boost anchor tags:

https://htmx.org/docs/#boosting

This will give you pjax/turbolinks like behavior on anchor tags and still allow crawlers that do not interpret javascript to navigate the side.

I am a long time java developer as well, and I hope htmx is useful in that community.