Astro Search Tutorial (Full Tutorial)

Поделиться
HTML-код
  • Опубликовано: 22 окт 2024

Комментарии • 28

  • @deatho0ne587
    @deatho0ne587 Год назад +1

    I like the concept and you do a good job of explaining it.
    FYI: Your CSS for the 100vh - grid - auto 1fr auto, is a bit off as you can see at roughly 10:50. What I have started doing is, might not work in IE but whatever
    HTML - without the
    body
    div.body
    header ... /header
    main ... /main
    footer ... /footer
    /div
    /body
    CSS - sass styleish
    .bodyContainer
    display: flex; flex-direction: column; height: 100vh; overflow: hidden;
    header
    flex-grow: 0;
    main
    flex-grow: 1; overflow: auto;
    footer
    flex-grow: 0;

  • @screen-looker
    @screen-looker 8 месяцев назад

    This is really great and worked seamlessly integrated in my project- the only thing missing is search pagination, but its not 100% necessary

    • @CodinginPublic
      @CodinginPublic  7 месяцев назад

      Awesome! Yeah, you could build in pagination with vanilla JS if you find it helpful. I've also recently moved to Pagefind myself and found it really helpful. Did a recent video about it on my channel. Cheers!

  • @eliasbrid3901
    @eliasbrid3901 5 месяцев назад +1

    Hey! And if I want to use it in a Navbar for example, how can I do it? because I got the nav in a component, and it shows in all pages that nav... can do all the logic in the same file?

  • @spyrosp
    @spyrosp Год назад

    You are a good coder - thank you for this 🙏

  • @Omar45
    @Omar45 Год назад

    Perfect tutorial, Thanks for the efforts!

  • @ryuse2568
    @ryuse2568 11 месяцев назад +1

    47:56 I wanted to ask you if there is a way to return an astro component, for example instead of a template string with the ... element and pass the data to said component by parameter.
    Thanks for your video, it helped me a lot :)

    • @CodinginPublic
      @CodinginPublic  11 месяцев назад

      You’re welcome! Yes! You can do that!

    • @ryuse2568
      @ryuse2568 11 месяцев назад

      @@CodinginPublic How can I do it? I have:
      ---
      import Card from '@/components/card.astro'
      ---
      ...
      const generateSearchList = (results) => {
      return results.map((r) => {
      return `${r.item.name}`
      }).join("")
      }
      ...
      I wouldn't know how to pass that Card component to the script to generate the list

    • @TehBestXD
      @TehBestXD 4 месяца назад

      @@ryuse2568 I have the same problem. How did you solve this?!

  • @samvelpetrosyan494
    @samvelpetrosyan494 8 месяцев назад

    Hi thanks for the course, could u please to make a video about astro internalization and make a small project connected with that

    • @CodinginPublic
      @CodinginPublic  7 месяцев назад

      Got a whole module planned on this!

  • @teinett
    @teinett Год назад

    I added the main content of Content Collection pages to SEARCH_DATA, not just the title and description. The more content files, the heavier search.json becomes on the frontend.
    Is it possible to move the search to the backend? If yes, how can it be done?

    • @CodinginPublic
      @CodinginPublic  Год назад +1

      Yes! It's especially easy if you build using SSR. As you hit the route, you could process the request and then return the results in the page from the server. Alternatively (and probably better for speed), you can have a JSON endpoint (like the one created here) that's ingested by an API you create on the server (edge functions would work well here). When you search, you can hit your API endpoint and pass it your query. It would then return a list of results you could display. Hope that points you in the right direction!

  • @freebird1663
    @freebird1663 Год назад

    Is there a way for the search function to access the markdown content of the blog posts, which is the content written under the fronmatter script? If that can be done, the search bar can determine whether or not the main body of the post contains the search words.

    • @CodinginPublic
      @CodinginPublic  Год назад

      Yes, you’d just included that rendered content in your .json file and then query it!

    • @freebird1663
      @freebird1663 Год назад

      @@CodinginPublic Thanks for the suggestion.

  • @screen-looker
    @screen-looker 9 месяцев назад

    where did the source code go?
    i only see a readme on github

  • @kevjimenez9809
    @kevjimenez9809 6 месяцев назад

    focus and value it marks me in red help pls

  • @lux_auram
    @lux_auram Год назад

    Duuude! Awesome tutorial as always! I send you an email, pls help me 😭😭😭

    • @CodinginPublic
      @CodinginPublic  Год назад +1

      Glad you enjoyed it! I'm a bit slow on email and can't always help. Hoping to get to my email later today.

    • @lux_auram
      @lux_auram Год назад

      @@CodinginPublic thank you so much dude! I supposed it’s an easy-stupid thing to solve but I’m really really noob and junior :(