Skip to content

Instantly share code, notes, and snippets.

@cavellblood
Last active November 15, 2022 18:14
Show Gist options
  • Save cavellblood/4607d4f0efe0b52565508a87fbf85824 to your computer and use it in GitHub Desktop.
Save cavellblood/4607d4f0efe0b52565508a87fbf85824 to your computer and use it in GitHub Desktop.
Marketing Page for Hydrogen
import groq from 'groq';
import useSanityQuery from '~/hooks/useSanityQuery';
export default function MarketingOverview({params, response}) {
response.doNotStream();
const {handle} = params;
const {data: entry} = useSanityQuery({
query: QUERY_SANITY,
params: {slug: handle},
});
if (!entry) {
if (response) {
response.status = 404;
}
console.log(response);
return 'not found';
}
return (
<div>
<h1>{entry.title}</h1>
</div>
);
}
const QUERY_SANITY = groq`
*[
_type == 'marketingOverview'
&& slug.current == $slug
][0]{
title,
}
`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment