Skip to content

Commit 1a05af8

Browse files
authored
feat(frontmatter handling): handle published and slug parameters in content files (#204)
1 parent ed778d0 commit 1a05af8

23 files changed

Lines changed: 3182 additions & 1136 deletions

File tree

.github/ISSUE_TEMPLATE/----docs-report.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
23
name: "\U0001F5C4️ Docs report"
34
about: Suggest a fix or improvement to Scully docs
45
title: ''

.github/ISSUE_TEMPLATE/---bug-report.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
23
name: "\U0001F41E Bug report"
34
about: Report a bug in Scully
45
title: ''

.github/ISSUE_TEMPLATE/---feature-request.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
23
name: "\U0001F9E9 Feature request"
34
about: Suggest an idea for Scully
45
title: ''

blog/page-1.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: My first page
33
author: Sander Elias
44
publish date: 2019-11-26
5+
slug: look at_my-urls Cool
56
description: This is the first demo page in this sample.
67
---
78

blog/page-2.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
---
2-
title: My second page
3-
author: Sander Elias
4-
publish date: 2019-11-27
5-
description: This is the second demo page in this sample.
2+
title: 'My second page'
3+
author: 'Sander Elias'
4+
'publish date': 2019-11-27T00:00:00.000Z
5+
published: false
6+
description: 'This is the second demo page in this sample.'
7+
slugs:
8+
- ___UNPUBLISHED___k5nhcflm_SJwD4Z0QDrIHg1PGHo2mrfLZE8sfUsPy
69
---
710

811
# Page 2

package-lock.json

Lines changed: 2997 additions & 916 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"zone.js": "~0.10.2"
3838
},
3939
"devDependencies": {
40-
"@angular-devkit/build-angular": "^0.900.0-rc.7",
40+
"@angular-devkit/build-angular": "^0.900.0-rc.9",
4141
"@angular-devkit/build-ng-packagr": "~0.900.0-rc.7",
4242
"@angular/cli": "~9.0.0-rc.7",
4343
"@angular/compiler-cli": "~9.0.0-rc.7",
@@ -56,6 +56,7 @@
5656
"@types/node": "^12.11.1",
5757
"@types/puppeteer": "^1.20.2",
5858
"@types/request": "^2.48.4",
59+
"@types/yamljs": "^0.2.30",
5960
"@types/yargs": "^13.0.3",
6061
"asciidoctor.js": "^1.5.9",
6162
"codelyzer": "^5.1.2",
@@ -85,6 +86,7 @@
8586
"tsickle": "^0.37.1",
8687
"tslint": "~5.20.1",
8788
"typescript": "^3.6.4",
89+
"yamljs": "^0.3.0",
8890
"yargs": "^14.2.0"
8991
},
9092
"config": {
Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {Component, OnInit, ViewEncapsulation} from '@angular/core';
2-
import {ActivatedRoute, Router, ROUTES} from '@angular/router';
2+
import {ActivatedRoute, Router} from '@angular/router';
33

4-
declare var ng: any;
4+
declare var window: any;
55

66
@Component({
77
selector: 'app-blog',
@@ -11,7 +11,26 @@ declare var ng: any;
1111
encapsulation: ViewEncapsulation.Emulated,
1212
})
1313
export class BlogComponent implements OnInit {
14-
ngOnInit() {}
14+
ngOnInit() {
15+
// if (window && !window.PrismLoading) {
16+
// window.PrismLoading = true;
17+
// if (window.Prism) {
18+
// /** already loaded nothing to do here.. */
19+
// return;
20+
// }
21+
// /** load prism to do syntax highlighting */
22+
// const lnk = document.createElement('link');
23+
// lnk.href = 'https://cdn.jsdelivr.net/npm/prismjs@1.19.0/themes/prism-twilight.css';
24+
// lnk.rel = 'stylesheet';
25+
// document.head.appendChild(lnk);
26+
// const prism = document.createElement('script');
27+
// prism.src = 'https://cdn.jsdelivr.net/npm/prismjs@1.19.0/prism.min.js';
28+
// document.head.appendChild(prism);
29+
// const prismLoad = document.createElement('script');
30+
// prismLoad.src = 'https://cdn.jsdelivr.net/npm/prismjs@1.19.0/prism.min.js';
31+
// document.head.appendChild(prismLoad);
32+
// }
33+
}
1534

1635
constructor(private router: Router, private route: ActivatedRoute) {}
1736
}

projects/sampleBlog/src/app/static/static.component.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<h1>Available routes</h1>
22

3-
<a class="btn" [routerLink]="['/home', '']" *ngIf="!toplevelOnly">Top level routes only</a>
4-
<a class="btn" [routerLink]="['/home', 'all']" *ngIf="toplevelOnly">All routes</a>
3+
<a class="btn" [routerLink]="['/home', '']" *ngIf="!toplevelOnly || unPublished">Top level routes only</a>
4+
<a class="btn" [routerLink]="['/home', 'all']" *ngIf="toplevelOnly || unPublished">All routes</a>
5+
<a class="btn" [routerLink]="['/home', 'unpublished']" *ngIf="!unPublished">Unpublished routes</a>
56
<ul>
67
<li>
78
<strong>routelink</strong>

projects/sampleBlog/src/app/static/static.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@ import {ScullyRoutesService} from '@scullyio/ng-lib';
99
})
1010
export class StaticComponent implements OnInit {
1111
toplevelOnly = true;
12+
unPublished = false;
1213
available$ = this.srs.available$;
1314
topLevel$ = this.srs.topLevel$;
1415
constructor(private srs: ScullyRoutesService, private route: ActivatedRoute) {}
1516

1617
get routes() {
17-
return this.toplevelOnly ? this.topLevel$ : this.available$;
18+
return this.unPublished ? this.srs.unPublished$ : this.toplevelOnly ? this.topLevel$ : this.available$;
1819
}
1920

2021
ngOnInit() {
2122
this.route.params.subscribe(params => {
2223
this.toplevelOnly = params.topLevel !== 'all';
24+
this.unPublished = params.topLevel === 'unpublished';
2325
});
2426
}
2527
}

0 commit comments

Comments
 (0)