* Load the 404 page * @param {String} path URL to be loaded * @param {*} qs TODO: define * @param {Function} cb Callback * @returns {Boolean} True if the requested page is not found * @private
(path, qs, cb = noop)
| 240 | * @private |
| 241 | */ |
| 242 | _fetch404(path, qs, cb = noop) { |
| 243 | const { loadSidebar, requestHeaders, notFoundPage } = this.config; |
| 244 | |
| 245 | const fnLoadSideAndNav = this._loadSideAndNav(path, qs, loadSidebar, cb); |
| 246 | if (notFoundPage) { |
| 247 | const path404 = get404Path(path, this.config); |
| 248 | |
| 249 | request(this.router.getFile(path404), true, requestHeaders).then( |
| 250 | (text, opt) => this._renderMain(text, opt, fnLoadSideAndNav), |
| 251 | () => this._renderMain(null, {}, fnLoadSideAndNav) |
| 252 | ); |
| 253 | return true; |
| 254 | } |
| 255 | |
| 256 | this._renderMain(null, {}, fnLoadSideAndNav); |
| 257 | return false; |
| 258 | } |
| 259 | |
| 260 | initFetch() { |
| 261 | const { loadSidebar } = this.config; |
no test coverage detected