13 entries for 19 methods. Each entry runs its example on this page and shows its code.
| htmx in yf | How the framework uses htmx: the asset, the request and response helpers of _class('htmx'), and the features built on them. |
| _is_hx(), _get_req() | Tell an htmx request from a plain one and read its HX-* headers: is_hx, req[target], req[trigger], req[boosted]... |
| Headers: _cache(), _cache_none(), _robot_none() | Cache-Control and X-Robots-Tag of an htmx answer (yf_api): no-store for live data, none for fragments search engines must not index. |
| Refusals: _firewall(), _reject(), _forbidden(), _error() | Keep an endpoint for htmx only (_firewall()), or end a request with 503, 403 or 500 and no page. |
| Partial responses: _result(), _wants_fragment(), _vary() | Answer an htmx request with a fragment of the page and end the request; other requests (and a history restore) get the whole page. |
| Redirects: _redirect(), _location(), _refresh() | Send htmx to another page (HX-Redirect), load a page into the current one without a reload (HX-Location), or reload (HX-Refresh). |
| _reswap(), _reselect() | Let the server decide how (HX-Reswap) and which part (HX-Reselect) of its answer htmx swaps, over hx-swap / hx-select of the request. |
| _toast() | Add a Bootstrap 5 toast to an htmx response (HX-Trigger event yf-toast); the response goes on. |
| Admin confirm over htmx | An htmx GET to a state-changing admin action gets a confirm form in its target; Confirm posts the same URL with the token. |
| Boosted links | hx-boost turns plain links and forms into ajax page loads; the framework treats them as page views, not as fragment requests. |
| HX-Redirect and HX-Refresh of the framework | How the framework answers htmx where a page would redirect: HX-Redirect after an admin action, 401 + HX-Refresh for a logged-out admin. |
| Refresh control | A quick-settings button for live parts of a page: 5, 10, 30 s or Off, kept per account and page in a cookie; here it drives an htmx poll. |
| table2 paging, sort and live filter | table() with the htmx option: sort headers, a live filter and a pager or a "Load more" row, answered as fragments of the same URL. |