Recipes
Improving iron levels doesn't have to be boring. Try out these iron-packed recipes!
 1) {
        activeParams.push({
          key: 'page',
          value: activePage,
        });
      }
      const gridDiv = '.blog';
      const grid = $el.closest('section');
      const filteredSortedUrl = `${blogUrl}${activeParams.length > 0 ? `?${activeParams.map(v => `${v.key}=${v.value}`).join('&')}` : ''}`;
      fetch(filteredSortedUrl)
        .then((response) => response.text())
        .then((responseText) => {
          const html = new DOMParser().parseFromString(responseText, 'text/html');
          // Update items
          const gridUpdated = html.querySelector(gridDiv).closest('section');
          grid.innerHTML = gridUpdated.innerHTML;
          $store.ajaxWorking = false;
          history.pushState({}, '', filteredSortedUrl);
          // Scroll to top.
          const scrollTop =
          grid.getBoundingClientRect().top + window.scrollY - document.querySelector('.site-header').getBoundingClientRect().height - 40;
          window.scrollTo({ top: scrollTop, behavior: 'smooth' });
        })
        .catch((e) => {
          console.error(e);
          $store.ajaxWorking = false;
        });
    "
    @paginate="
      activePage = $event.detail;
      $dispatch('update');
    ">