Skip to content

(Question) Best way to emulate hx-boost/turbolinks behavior #48

@ajusa

Description

@ajusa

Hello,

I have a small website that is already fully server rendered. I'd like to start adding bits of interactivity to it. HTMX has an attribute that automatically "boosts" regular HTML links and forms to not do a full page reload (https://htmx.org/attributes/hx-boost/).

https://github.com/turbolinks/turbolinks did something similar, but for all links on a website.

For a form, it looks like the only attribute that needs to be added is

  <form action="/posts/$post.id/delete" method="post" ts-req>

Links seem to be more confusing to me. I looked at the example and it doesn't seem to handle a standard link navigation through twinspark (https://github.com/vsolovyov/ecomspark-flask/blob/4c556954f73596cd2bc6f8012c2aea7451dca674/templates/base.html#L20).

After experimenting locally, it seems like the equivalent behavior for a link is

    <a href="/posts/$post.id/edit" ts-req ts-target="body" ts-req-history>Edit</a>

Is that correct? Is there a shorter way to make links dynamic?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions