logo
kaimul
my 10th blog

my 10th blog

shareshareshareshare
kaimul
By Kaimul alam
0 mins to read

my 10th blog

jsx

import { client } from "@/sanity/sanityClient";
import { groq } from "next-sanity";

const query = groq`*[_type == "post" && slug.current == $slug][0]{
    _id,
    title,
    "date": createdAt,
    "image": mainImage.asset->url,
    "slug": slug.current,
    'author': author->{name, 'picture': image.asset->url},
    body
  }`;

export default async function getSinglePost(slug) {
  if (client) {
    return (await client.fetch(query, { slug })) || {};
  }
  return {};
}

Comments

    leave a comment

    related blogs

    post

    How Do You Do max-font-size in CSS?

    1 mins to read
    post

    my 10th blog

    0 mins to read
    post

    my 7th Blog

    0 mins to read
    post

    my 7th Blog

    0 mins to read

    categories

    icon

    Others

    (8)
    icon

    Featured

    (5)
    icon

    React

    (4)
    icon

    Scss

    (3)
    icon

    Css

    (3)
    icon

    next

    (3)
    icon

    Sanity

    (2)
    icon

    slider

    (1)
    icon

    Tailwind

    (0)
    icon

    MongoDB

    (0)