-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Dynamically generate sitemaps [resolves #97] * Remove interval when rendering on server [fixes #99] * 1.3.8
- Loading branch information
1 parent
95ec6ec
commit 8bb7dc6
Showing
8 changed files
with
116 additions
and
41 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { Observable, Observer } from '../src/app/services/observable'; | ||
import * as https from 'https'; | ||
|
||
export class Sitemap { | ||
|
||
static DATABASE_URL: string = 'https://bolingbrook-church.firebaseio.com'; | ||
static HOST: string = 'https://bolingbrook.church'; | ||
static PAGES: string[] = [ | ||
'/', | ||
'/about', | ||
'/beliefs', | ||
'/connect', | ||
'/events', | ||
'/friends-family-sabbath', | ||
'/giving', | ||
'/locations', | ||
'/newsletter', | ||
'/sermons', | ||
'/serve', | ||
'/serve/ask', | ||
'/serve/fusion', | ||
'/serve/media', | ||
].map(p => Sitemap.HOST + p); | ||
|
||
sermons(): Observable<string[]> { | ||
return Observable.create((observer: Observer<string[]>) => { | ||
https.get(`${Sitemap.DATABASE_URL}/data/sermons.json`, res => { | ||
let body = ''; | ||
res.on('data', data => { body += data; }); | ||
res.on('end', () => { | ||
const sermons = JSON.parse(body); | ||
observer.next(Object.keys(sermons)); | ||
observer.complete(); | ||
}); | ||
}); | ||
}) | ||
} | ||
|
||
render(): Observable<string> { | ||
return this.sermons() | ||
.map(dates => dates.map(d => Sitemap.HOST + '/sermons/' + d)) | ||
.map(sermons => Sitemap.PAGES.concat(sermons)) | ||
.map(urls => urls.join('\n')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Aperture } from './aperture'; | ||
import { Observable } from './observable'; | ||
|
||
export class MockAperture extends Aperture { | ||
|
||
browser = true; | ||
|
||
constructor( | ||
private _ga: Function = () => { } | ||
) { | ||
super(); | ||
} | ||
|
||
scrollTo(options?: ScrollToOptions): void { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
open(url?: string, target?: string, features?: string, replace?: boolean): Aperture { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
set(key: string, value: any): void { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
now(): number { | ||
return performance.now() | ||
} | ||
|
||
create(target: any): Aperture { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
observableWindowEvent(eventName: string): Observable<Event> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
get ga(): Function { | ||
return this._ga; | ||
} | ||
} |