#Trying to make a blog with builder io

7 messages · Page 1 of 1 (latest)

storm vapor
#

Interested in this!! Been trying to get a blog without errors with this since weeks ago and cant seem to find an answer!!😢 would be nice if they made some up to sate documentations of how to do blogs properly

upper patio
#

they have a blue print but it does not seem to work

#

the example i provided gets the blog index to generate but thats about it

#

with issues but im prolly just going to create a page and use the sections to generate the blog index for now

upper patio
#

i made this post it has more info

upper patio
#
import { component$, Resource, useResource$} from "@builder.io/qwik";
import { DocumentHead, routeLoader$ } from "@builder.io/qwik-city";
import { fetchOneEntry, RenderContent} from "@builder.io/sdk-qwik";
export const BUILDER_PUBLIC_API_KEY = "758eba9573244c6b8c2affff6df8e733";

export default component$(() => {


  const articleRsrc = useResource$(() =>
    fetchOneEntry({
      model: "blog-index",
      apiKey: BUILDER_PUBLIC_API_KEY,
      options: { includeRefs: true },
    })
  );


  return (
    <Resource
      value={articleRsrc}
      onPending={() => <div>Loading article...</div>}
      onResolved={(article) => (
        <>
 

          <div>
            <div>{article.data.title}</div>
            <RenderContent
              model="blog-index"
              content={article}
              apiKey={BUILDER_PUBLIC_API_KEY}
              options={{ includeRefs: true }}
            />
          </div>
        </>
      )}
    />
  );
});