Skip to content

Commit

Permalink
fix: renames template to blog, uses new control flow syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
BaronVonPerko committed Nov 19, 2023
1 parent 92eb3c2 commit 3afb0f5
Show file tree
Hide file tree
Showing 32 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import { Component } from '@angular/core';
import { injectContent, MarkdownComponent } from '@analogjs/content';
import { AsyncPipe, NgIf } from '@angular/common';
import { AsyncPipe } from '@angular/common';

import PostAttributes from '../../post-attributes';

@Component({
selector: 'app-blog-post',
standalone: true,
imports: [AsyncPipe, NgIf, MarkdownComponent],
imports: [AsyncPipe, MarkdownComponent],
template: `
<article *ngIf="post$ | async as post">
@if (post$ | async; as post) {
<article>
<img class="post__image" [src]="post.attributes.coverImage" />
<analog-markdown [content]="post.content" />
</article>
}
`,
styles: [
`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { Component } from '@angular/core';
import { injectContentFiles } from '@analogjs/content';
import { NgForOf } from '@angular/common';
import PostAttributes from '../../post-attributes';

@Component({
selector: 'app-blog',
standalone: true,
imports: [NgForOf],
template: `
<h1>Blog Archive</h1>
<a *ngFor="let post of posts" [href]="'/blog/' + post.attributes.slug">
@for (post of posts; track post.attributes.slug) {
<a [href]="'/blog/' + post.attributes.slug">
<h2 class="post__title">{{ post.attributes.title }}</h2>
<p class="post__desc">{{ post.attributes.description }}</p>
</a>
}
`,
styles: [
`
Expand Down

0 comments on commit 3afb0f5

Please sign in to comment.