File tree 2 files changed +15
-11
lines changed
2 files changed +15
-11
lines changed Original file line number Diff line number Diff line change 6
6
7
7
// You can delete this file if you're not using it
8
8
9
-
9
+ let firstRender = true ;
10
10
exports . onRouteUpdate = ( { location } ) => {
11
- console . log ( 'route updated ' )
12
- const carbon_container = document . getElementById ( 'carbon_container' ) ;
13
- carbon_container . innerHTML = ''
14
- const script = document . createElement ( 'script' ) ;
15
- script . setAttribute ( 'async' , '' ) ;
16
- script . setAttribute ( 'type' , 'text/javascript' ) ;
17
- script . setAttribute ( 'src' , '//cdn.carbonads.com/carbon.js?serve=CK7D52QE&placement=react-popupelazizicom' ) ;
18
- script . setAttribute ( 'id' , '_carbonads_js' ) ;
19
- carbon_container . appendChild ( script ) ;
11
+ if ( firstRender ) firstRender = false
12
+ else {
13
+ const carbon_container = document . getElementById ( 'carbon_container' ) ;
14
+ carbon_container . innerHTML = ''
15
+ const script = document . createElement ( 'script' ) ;
16
+ script . setAttribute ( 'async' , '' ) ;
17
+ script . setAttribute ( 'type' , 'text/javascript' ) ;
18
+ script . setAttribute ( 'src' , '//cdn.carbonads.com/carbon.js?serve=CK7D52QE&placement=react-popupelazizicom' ) ;
19
+ script . setAttribute ( 'id' , '_carbonads_js' ) ;
20
+ carbon_container . appendChild ( script ) ;
21
+ }
20
22
}
Original file line number Diff line number Diff line change @@ -30,7 +30,9 @@ const Sidebar = ({ pages }) => {
30
30
< div className = "sidebar website-sidebar" key = "SW" >
31
31
< div className = "sticky-sidebar" >
32
32
< Menu routes = { routes } />
33
- < div id = "carbon_container" />
33
+ < div id = "carbon_container" >
34
+ < script async type = "text/javascript" src = "//cdn.carbonads.com/carbon.js?serve=CK7D52QE&placement=react-popupelazizicom" id="_carbonads_js" />
35
+ </div>
34
36
</div>
35
37
36
38
</div>
You can’t perform that action at this time.
0 commit comments