File tree 1 file changed +8
-3
lines changed
src/pydata_sphinx_theme/theme/pydata_sphinx_theme/sections
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 7
7
fetch ( "{{ theme_announcement }}" )
8
8
. then ( res => { return res . text ( ) ; } )
9
9
. then ( data => {
10
- div = document . querySelector ( ".bd-header-announcement" ) ;
11
- div . classList . add ( ...{ { header_classes | tojson } } ) ;
12
- div . innerHTML = `<div class="bd-header-announcement__content">${ data } </div>` ;
10
+ if ( data . length === 0 ) {
11
+ console . log ( "[PST]: Empty announcement at: {{ theme_announcement }}" ) ;
12
+ return ;
13
+ } else {
14
+ div = document . querySelector ( ".bd-header-announcement" ) ;
15
+ div . classList . add ( ...[ "bd-header-announcement" , "container-fluid" ] ) ;
16
+ div . innerHTML = `<div class="bd-header-announcement__content">${ data } </div>` ;
17
+ }
13
18
} )
14
19
. catch ( error => {
15
20
console . log ( "[PST]: Failed to load announcement at: {{ theme_announcement }}" ) ;
You can’t perform that action at this time.
0 commit comments