Skip to content

Commit c8b3ada

Browse files
committed
add a blog module from scully
1 parent 8e3874f commit c8b3ada

9 files changed

+108
-0
lines changed

blog/2020-03-08-blog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: 2020-03-08-blog
3+
description: blog description
4+
publish: false
5+
---
6+
7+
# 2020-03-08-blog

scully.site-blog.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,11 @@ exports.config = {
33
projectName: "site-blog",
44
outDir: './dist/static',
55
routes: {
6+
'/blog/:slug': {
7+
type: 'contentFolder',
8+
slug: {
9+
folder: "./blog"
10+
}
11+
},
612
}
713
};

src/app/app-routing.module.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Routes, RouterModule } from '@angular/router';
44
// 路由配置
55
const routes: Routes = [
66
{path: '', redirectTo: '/blog', pathMatch: 'full' },
7+
{ path: 'blog', loadChildren: () => import('./blog/blog.module').then(m => m.BlogModule) },
78
// { path: '**', component: PageNotFoundComponent }
89
];
910

src/app/blog/blog-routing.module.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import {NgModule} from '@angular/core';
2+
import {Routes, RouterModule} from '@angular/router';
3+
4+
import {BlogComponent} from './blog.component';
5+
6+
const routes: Routes = [
7+
{
8+
path: ':slug',
9+
component: BlogComponent,
10+
},
11+
{
12+
path: '**',
13+
component: BlogComponent,
14+
}
15+
];
16+
17+
@NgModule({
18+
imports: [RouterModule.forChild(routes)],
19+
exports: [RouterModule],
20+
})
21+
export class BlogRoutingModule {}
22+

src/app/blog/blog.component.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
3+
::slotted(h1) {
4+
color:rgb(51, 6, 37);
5+
background-color: rgb(248, 211, 236);
6+
padding: 5px;
7+
border-radius: 5px;
8+
width: fit-content;
9+
}
10+

src/app/blog/blog.component.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<h3>ScullyIo content</h3>
2+
<hr>
3+
4+
<!-- This is where Scully will inject the static HTML -->
5+
<scully-content></scully-content>
6+
<hr>
7+
<h4>End of content</h4>

src/app/blog/blog.component.spec.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { BlogComponent } from './Blog.component';
4+
5+
describe('BlogComponent', () => {
6+
let component: BlogComponent;
7+
let fixture: ComponentFixture<BlogComponent>;
8+
9+
beforeEach(async(() => {
10+
TestBed.configureTestingModule({
11+
declarations: [ BlogComponent ]
12+
})
13+
.compileComponents();
14+
}));
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(BlogComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});

src/app/blog/blog.component.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import {Component, OnInit, ViewEncapsulation} from '@angular/core';
2+
import {ActivatedRoute, Router, ROUTES} from '@angular/router';
3+
4+
declare var ng: any;
5+
6+
@Component({
7+
selector: 'app-blog',
8+
templateUrl: './blog.component.html',
9+
styleUrls: ['./blog.component.css'],
10+
preserveWhitespaces: true,
11+
encapsulation: ViewEncapsulation.Emulated
12+
13+
})
14+
export class BlogComponent implements OnInit {
15+
ngOnInit() {}
16+
17+
constructor(private router: Router, private route: ActivatedRoute) {
18+
}
19+
}

src/app/blog/blog.module.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {CommonModule} from '@angular/common';
2+
import {NgModule} from '@angular/core';
3+
import {ScullyLibModule} from '@scullyio/ng-lib';
4+
import {BlogRoutingModule} from './blog-routing.module';
5+
import {BlogComponent} from './blog.component';
6+
7+
@NgModule({
8+
declarations: [BlogComponent],
9+
imports: [CommonModule, BlogRoutingModule, ScullyLibModule],
10+
})
11+
export class BlogModule {}

0 commit comments

Comments
 (0)