Skip to content

Commit

Permalink
Update recipes.markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
amitaibu authored Oct 2, 2023
1 parent ec409f3 commit df47676
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Guide/recipes.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,8 @@ case post of
Let's say you have a page with comments, and you link to them with `<a href="#comment-<comment ID>">`. You can build it like this (assuming you have a `comment.id`):

```haskell
[hsx|
<a { ...[ ("href", "#comment-" ++ show comment.id)
, ("id", "comment-" ++ show comment.id)
]}
|]
[hsx|<a href={"#comment-" ++ show comment.id} id={"comment-" ++ show comment.id}>|]
```

The browser will scroll to the relevant comment when you follow the link, but let's say you also want to highlight the linked comment — like GitHub does. You could use the `:target` selector, but it doesn't play well with Turbolinks.

Expand Down

0 comments on commit df47676

Please sign in to comment.