(path, qs, cb = noop)
| 201 | } |
| 202 | |
| 203 | _fetchFallbackPage(path, qs, cb = noop) { |
| 204 | const { requestHeaders, fallbackLanguages, loadSidebar } = this.config; |
| 205 | |
| 206 | if (!fallbackLanguages) { |
| 207 | return false; |
| 208 | } |
| 209 | |
| 210 | const local = path.split('/')[1]; |
| 211 | |
| 212 | if (fallbackLanguages.indexOf(local) === -1) { |
| 213 | return false; |
| 214 | } |
| 215 | |
| 216 | const newPath = this.router.getFile( |
| 217 | path.replace(new RegExp(`^/${local}`), '') |
| 218 | ); |
| 219 | const req = request(newPath + qs, true, requestHeaders); |
| 220 | |
| 221 | req.then( |
| 222 | (text, opt) => |
| 223 | this._renderMain( |
| 224 | text, |
| 225 | opt, |
| 226 | this._loadSideAndNav(path, qs, loadSidebar, cb) |
| 227 | ), |
| 228 | () => this._fetch404(path, qs, cb) |
| 229 | ); |
| 230 | |
| 231 | return true; |
| 232 | } |
| 233 | |
| 234 | /** |
| 235 | * Load the 404 page |
no test coverage detected