Skip to content

Commit

Permalink
Routes redirects fix (#1719)
Browse files Browse the repository at this point in the history
* Refactor themes,books,integrations, showcase redirects

* Fix index header test

* Remove xo ecmaVersion 3 override

* Fix tests end

Co-authored-by: Dmitriy Akulov <[email protected]>
  • Loading branch information
xbpcb and jimaek authored Jun 30, 2021
1 parent 478f589 commit 4a02282
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 91 deletions.
18 changes: 1 addition & 17 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,14 @@ app.locals.semver = semver;
// routes
app.use('/', routes.indexRoute);
app.use('/about/', routes.aboutRoute);
app.use('/alpha/?|/beta/?|/jobs/?|/privacy-policy/?', routes.redirectToRoot);
app.use('/alpha/?|/beta/?|/jobs/?|/privacy-policy/?|/themes/?|/books/?|/integrations/?|/showcase/?', routes.redirectToRoot);
app.use('/bootlint/', routes.bootlintRoute);
app.use('/bootswatch/', routes.bootswatchRoute);
app.use('/bootswatch4/', routes.bootswatch4Route);
app.use('/data/bootstrapcdn.json', routes.dataRoute);
app.use('/fontawesome/', routes.fontawesomeRoute);
app.use('/legacy', routes.legacyRoutes);
app.use('/bootstrapicons/', routes.bootstrapIconsRoute);
app.use('/themes/', routes.themesRoute);
app.use('/books/', routes.booksRoute);
app.use('/integrations/', routes.integrationsRoute);
app.use('/showcase/', routes.showcaseRoute);

const map = sitemap({
url: 'www.bootstrapcdn.com',
Expand Down Expand Up @@ -163,18 +159,6 @@ const map = sitemap({
},
'/sitemap.xml': {
hide: true
},
'/themes/': {
hide: true
},
'/books/': {
hide: true
},
'/integrations/': {
hide: true
},
'/showcase/': {
hide: true
}
}
});
Expand Down
12 changes: 12 additions & 0 deletions config/_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,15 @@ redirects:
- name: privacy-policy
from: /privacy-policy/
to: /
- name: themes
from: /themes/
to: /
- name: books
from: /books/
to: /
- name: integrations
from: /integrations/
to: /
- name: showcase
from: /showcase/
to: /
4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,6 @@
"envs": [
"browser"
],
"parserOptions": {
"ecmaVersion": 3,
"sourceType": "script"
},
"strict": true,
"rules": {
"unicorn/no-abusive-eslint-disable": "off",
Expand Down
1 change: 1 addition & 0 deletions public/assets/js/google-tag-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
function gtag(...params) {
window.dataLayer.push(params);
}

gtag('js', new Date());
gtag('config', 'G-WWCYVX0YTQ');
})();
15 changes: 0 additions & 15 deletions routes/books.js

This file was deleted.

10 changes: 1 addition & 9 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ const indexRoute = require('./home');
const legacyRoutes = require('./legacy');
const redirectToRoot = require('./redirectToRoot');
const bootstrapIconsRoute = require('./bootstrapIcons');
const themesRoute = require('./themes');
const booksRoute = require('./books');
const integrationsRoute = require('./integrations');
const showcaseRoute = require('./showcase');

const routes = {
notFoundRoute,
Expand All @@ -28,11 +24,7 @@ const routes = {
indexRoute,
legacyRoutes,
redirectToRoot,
bootstrapIconsRoute,
themesRoute,
booksRoute,
integrationsRoute,
showcaseRoute
bootstrapIconsRoute
};

module.exports = routes;
Expand Down
15 changes: 0 additions & 15 deletions routes/integrations.js

This file was deleted.

15 changes: 0 additions & 15 deletions routes/showcase.js

This file was deleted.

15 changes: 0 additions & 15 deletions routes/themes.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/index_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('index', () => {
});

it('has page header', (done) => {
helpers.assert.pageHeader('Official CDN of Bootstrap and Font Awesome', response, done);
helpers.assert.pageHeader('Quick Start', response, done);
});

it('has body class', (done) => {
Expand Down
4 changes: 4 additions & 0 deletions test/sitemap_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ describe('sitemap.xml', () => {
it('works', (done) => {
helpers.assert.itWorks(response.statusCode, done);
});

after((done) => {
helpers.stopServer(done);
});
});

0 comments on commit 4a02282

Please sign in to comment.