MCPcopy Index your code
hub / github.com/IABTechLab/uid2docs / BlogPostItem

Function BlogPostItem

src/theme/BlogPostItem/index.tsx:17–52  ·  view source on GitHub ↗
({
  children,
  className,
}: Props)

Source from the content-addressed store, hash-verified

15}
16
17export default function BlogPostItem({
18 children,
19 className,
20}: Props): JSX.Element {
21 const containerClassName = useContainerClassName();
22 const {
23 isBlogPostPage,
24 metadata: { authors, tags },
25 } = useBlogPost();
26
27 const authorNames = authors
28 ? authors.map((author) => author.name).join(", ")
29 : undefined;
30
31 const tagNames = tags ? tags.map((tag) => tag.label).join(", ") : undefined;
32
33 React.useEffect(() => {
34 const pageViewData = {
35 event: "Initialize_dataLayer",
36 document_type: "Blog",
37 document_title: document.title,
38 article_author: authorNames,
39 tags: tagNames,
40 };
41 if (isBlogPostPage) {
42 pushGtmEvent(pageViewData);
43 }
44 }, [isBlogPostPage]);
45 return (
46 <BlogPostItemContainer className={clsx(containerClassName, className)}>
47 <BlogPostItemHeader />
48 <BlogPostItemContent>{children}</BlogPostItemContent>
49 <BlogPostItemFooter />
50 </BlogPostItemContainer>
51 );
52}

Callers

nothing calls this directly

Calls 2

pushGtmEventFunction · 0.90
useContainerClassNameFunction · 0.85

Tested by

no test coverage detected