diff --git a/docs/static_site/Makefile b/docs/static_site/Makefile index 94cedec0a112..f28b9e2a6421 100644 --- a/docs/static_site/Makefile +++ b/docs/static_site/Makefile @@ -19,6 +19,7 @@ all: html html: mkdir -p build + wget -O src/assets/js/jquery-3.3.1.min.js https://code.jquery.com/jquery-3.3.1.min.js cd src && bundle install && JEKYLL_ENV=production bundle exec jekyll build --config _config_prod.yml -d ../build/html && cd .. wget https://mxnet-website-static-artifacts.s3.us-east-2.amazonaws.com/versions.zip && unzip versions.zip -d build/html && rm -rf build/html/__MACOSX && rm versions.zip diff --git a/docs/static_site/src/.htaccess b/docs/static_site/src/.htaccess index a67efcfe1fc1..21cb83a11dd6 100644 --- a/docs/static_site/src/.htaccess +++ b/docs/static_site/src/.htaccess @@ -3,6 +3,25 @@ DirectorySlash off RewriteEngine on RewriteOptions AllowNoSlash + + ExpiresActive on + + # Images + ExpiresByType image/png "access plus 7 days" + ExpiresByType image/jpg "access plus 7 days" + ExpiresByType image/jpeg "access plus 7 days" + ExpiresByType image/svg+xml "access plus 7 days" + + # CSS, Javascript, HTML + ExpiresByType text/css "access plus 1 days" + ExpiresByType application/javascript "access plus 1 days" + ExpiresByType text/html "access plus 0 seconds" + + # Web fonts + ExpiresByType application/font-woff "access plus 1 month" + + + # Redirect Chinese visitors to Chinese CDN, temporary solution for slow site speed in China RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^CN$ RewriteCond %{HTTP_HOST} !cdn diff --git a/docs/static_site/src/_includes/head.html b/docs/static_site/src/_includes/head.html index 76004e4463fc..f0710ccf1f5f 100644 --- a/docs/static_site/src/_includes/head.html +++ b/docs/static_site/src/_includes/head.html @@ -6,57 +6,18 @@ {%- seo -%} - + {%- feed_meta -%} {%- if jekyll.environment == 'production' and site.google_analytics -%} {%- include google-analytics.html -%} {%- endif -%} - - - - - - + {%- if jekyll.environment == 'production' -%} + + {%- else -%} + + {%- endif -%} + + + + diff --git a/docs/static_site/src/_sass/generalVersionDropdown.scss b/docs/static_site/src/_sass/generalVersionDropdown.scss new file mode 100644 index 000000000000..32990cd70199 --- /dev/null +++ b/docs/static_site/src/_sass/generalVersionDropdown.scss @@ -0,0 +1,41 @@ +.dropdown-option-active { + color: #ff4500 !important; + font-weight: lighter; +} + +.dropdown { + position: relative; + display: inline-block; +} + +.dropdown-content { + display: none; + position: absolute; + background-color: #f9f9f9; + min-width: 160px; + box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2); + padding: 12px 16px; + z-index: 1; + text-align: left; +} + +.dropdown:hover .dropdown-content { + display: block; +} + +.dropdown-header { + color: #ffffff; + display: inline-flex; +} + +.dropdown-caret { + width: 18px; +} + +.trigger .dropdown-caret { + height: 57px; +} + +.dropdown-caret-path { + fill: #ffffff; +} diff --git a/docs/static_site/src/assets/main.scss b/docs/static_site/src/assets/main.scss index 21755b16f5b0..9816a84b1175 100644 --- a/docs/static_site/src/assets/main.scss +++ b/docs/static_site/src/assets/main.scss @@ -7,3 +7,4 @@ body { @import "minima"; @import "globalSearch"; +@import "generalVersionDropdown";