File tree 4 files changed +6
-8
lines changed
4 files changed +6
-8
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " next-google-adsense" ,
3
- "version" : " 1.0.12 " ,
3
+ "version" : " 1.0.13 " ,
4
4
"description" : " Next.js Google AdSense" ,
5
5
"main" : " dist/index.js" ,
6
6
"type" : " commonjs" ,
Original file line number Diff line number Diff line change 1
- import React , { DetailedHTMLProps } from "react" ;
1
+ import type { DetailedHTMLProps } from "react" ;
2
+ import React from "react" ;
2
3
3
4
export type Layout = "display" | "in-article" | "custom" ;
4
5
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ export const AdUnit = ({
78
78
//? empty object can be passed via .push, see: https://github.com/soranoo/next-google-adsense/issues/6
79
79
80
80
return (
81
- < div key = { pathname . replace ( / \/ / g, "-" ) + "-" + slotId + "-" + comment . replace ( " " , "-" ) } >
81
+ < div key = { ` ${ pathname . replace ( / \/ / g, "-" ) } - ${ slotId } - ${ comment . replace ( " " , "-" ) } ` } >
82
82
{ Ad }
83
83
</ div >
84
84
) ;
Original file line number Diff line number Diff line change 3
3
4
4
import type { ScriptProps } from "next/script" ;
5
5
6
- import React , { useEffect } from "react" ;
6
+ import React from "react" ;
7
7
import Script from "next/script" ;
8
8
import { isPublisherId } from "./utils" ;
9
- import { usePathname } from "next/navigation" ;
10
9
11
10
interface GoogleAdSenseProps extends Omit < ScriptProps , "src" | "id" > {
12
11
publisherId ?: string ;
@@ -22,8 +21,6 @@ export const GoogleAdSense = ({
22
21
debug = false ,
23
22
...props
24
23
} : GoogleAdSenseProps ) : JSX . Element | null => {
25
- const pathName = usePathname ( ) ;
26
-
27
24
const _publisherId = process . env . NEXT_PUBLIC_ADSENSE_PUBLISHER_ID ?? publisherId ;
28
25
29
26
if ( ! isPublisherId ( _publisherId ) ) {
@@ -38,7 +35,7 @@ export const GoogleAdSense = ({
38
35
async = { true }
39
36
id = "next-google-adsense"
40
37
src = { `https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-${ _publisherId } ${
41
- debug ? ` google_console=1` : ``
38
+ debug ? " google_console=1" : ""
42
39
} `}
43
40
strategy = "afterInteractive"
44
41
crossOrigin = "anonymous"
You can’t perform that action at this time.
0 commit comments