File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- < script type ="text/javascript " src ="/assets/js/custom.js "> </ script >
1+ < script type ="text/javascript " src ="/assets/js/custom.js?_={{ site.time | date: " %Y-%m-%d-%H " }} "> </ script >
Original file line number Diff line number Diff line change @@ -17,9 +17,17 @@ function loadGoatCounterViews() {
1717}
1818
1919function loadCustomCSS ( ) {
20+ const now = new Date ( ) ;
21+ const year = now . getFullYear ( ) ;
22+ const month = String ( now . getMonth ( ) + 1 ) . padStart ( 2 , '0' ) ; // Months are 0-based
23+ const day = String ( now . getDate ( ) ) . padStart ( 2 , '0' ) ;
24+ const hour = String ( now . getHours ( ) ) . padStart ( 2 , '0' ) ;
25+ const cacheBuster = `${ year } -${ month } -${ day } -${ hour } ` ;
26+
2027 const css = document . createElement ( 'link' ) ;
2128 css . rel = 'stylesheet' ;
22- css . href = '/assets/css/custom.css' ;
29+ // year-month-day-hour
30+ css . href = '/assets/css/custom.css?_=' + cacheBuster ;
2331 document . head . appendChild ( css ) ;
2432}
2533
You can’t perform that action at this time.
0 commit comments