Skip to content

added sorting for location pages and changed default count items for … #167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ import { FooterComponent } from './core/layout/footer/footer.component';
@Component({
selector: 'blog-root',
standalone: true,
imports: [
NavigationComponent,
FooterComponent,
RouterOutlet
],
imports: [NavigationComponent, FooterComponent, RouterOutlet],
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
Expand Down
27 changes: 17 additions & 10 deletions src/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
provideRouter,
withComponentInputBinding,
withInMemoryScrolling,
withRouterConfig
withRouterConfig,
} from '@angular/router';

import { routes } from './app.routes';
Expand All @@ -24,7 +24,7 @@ import {
AUTHORS_AVATAR_PATH_TOKEN,
USE_PROCESSED_IMAGES,
O11Y_CONFIG_TOKEN,
SPECIAL_CATEGORIES
SPECIAL_CATEGORIES,
} from './core/config/configuration-tokens';
import { HtmlInMarkdownService } from './core/services/html-in-markdown.service';
import { ObservabilityConfig } from './core/model/observability.model';
Expand Down Expand Up @@ -68,8 +68,17 @@ export const appConfig: ApplicationConfig = {
{
provide: APP_INITIALIZER,
multi: true,
useFactory: (...deps: any) => () => markdownConfig.apply(this, deps),
deps: [MarkdownService, DOCUMENT, HtmlInMarkdownService, AssetsService, Router],
useFactory:
(...deps: any) =>
() =>
markdownConfig.apply(this, deps),
deps: [
MarkdownService,
DOCUMENT,
HtmlInMarkdownService,
AssetsService,
Router,
],
},
{
provide: APP_INITIALIZER,
Expand All @@ -84,12 +93,10 @@ export const appConfig: ApplicationConfig = {
{
provide: USE_PROCESSED_IMAGES,
useValue: !isDevMode(),
},{
},
{
provide: SPECIAL_CATEGORIES,
useValue: [
'principles',
'meetups',
]
}
useValue: ['principles', 'meetups'],
},
],
};
18 changes: 11 additions & 7 deletions src/app/app.meta.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { MetaDefinition } from "@angular/platform-browser";
import { PostContent } from "./core/model/post.model";
import { MetaDefinition } from '@angular/platform-browser';
import { PostContent } from './core/model/post.model';

const prodUrl = 'https://engineering.backbase.com/';
const rootTitle = 'Backbase Engineering';
const rootDescription = 'Backbase is a global fintech company creating the best digital banking solutions on the planet. We are a young-spirited, diverse (45+ nationalities), fast-growing and leading company in our niche.';
const rootDescription =
'Backbase is a global fintech company creating the best digital banking solutions on the planet. We are a young-spirited, diverse (45+ nationalities), fast-growing and leading company in our niche.';

export const defaultMeta: MetaDefinition[] = [
{
Expand Down Expand Up @@ -36,10 +37,13 @@ export const notFoundMeta: MetaDefinition[] = [
{
name: 'robots',
content: 'noindex, nofollow',
}
]
},
];

export const getPostMeta = ({ excerpt, title, displayTeaser }: PostContent, url: string) => [
export const getPostMeta = (
{ excerpt, title, displayTeaser }: PostContent,
url: string
) => [
{
name: 'description',
content: excerpt,
Expand All @@ -60,4 +64,4 @@ export const getPostMeta = ({ excerpt, title, displayTeaser }: PostContent, url:
property: 'og:description',
content: excerpt,
},
];
];
10 changes: 8 additions & 2 deletions src/app/app.routes.map.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { Route } from '@angular/router';

const routes = [
['2023/12/13/angular-micro-frontends', '2023/12/13/micro-frontends-with-module-federation'],
['2023/12/13/setup-microfrontend', '2023/12/13/micro-frontends-with-module-federation'],
[
'2023/12/13/angular-micro-frontends',
'2023/12/13/micro-frontends-with-module-federation',
],
[
'2023/12/13/setup-microfrontend',
'2023/12/13/micro-frontends-with-module-federation',
],
['2023/10/06/code-coverage', '2023/10/06/code-coverage-for-unit-tests'],
[
'2023/09/30/installing-hms-core-in-as-emulator',
Expand Down
62 changes: 44 additions & 18 deletions src/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { ActivatedRouteSnapshot, Route, Router, RouterStateSnapshot, Routes } from '@angular/router';
import {
ActivatedRouteSnapshot,
Route,
Router,
RouterStateSnapshot,
Routes,
} from '@angular/router';
import { postRedirects } from './app.routes.map';
import { EMPTY, Subject, catchError, map, tap } from 'rxjs';
import { inject, makeStateKey, TransferState } from '@angular/core';
Expand All @@ -18,12 +24,16 @@ export const routes: Routes = [
{
path: '',
loadComponent: () =>
import('./features/home/home.component').then(mod => mod.HomeComponent),
import('./features/home/home.component').then(
mod => mod.HomeComponent
),
},
{
path: 'people/:author',
loadComponent: () =>
import('./features/author/author.component').then(m => m.AuthorComponent),
import('./features/author/author.component').then(
m => m.AuthorComponent
),
},
{
path: ':year/:month/:day/:permalink',
Expand Down Expand Up @@ -92,8 +102,8 @@ export const routes: Routes = [
),
data: { meta: notFoundMeta },
},
]
}
],
},
];

function getRouteData(): Partial<Route> {
Expand All @@ -106,41 +116,57 @@ function getRouteData(): Partial<Route> {
const transferState = inject(TransferState);
const stateKey = makeStateKey<PostContent | undefined>(url);
if (transferState.hasKey(stateKey)) {
const post = transferState.get<PostContent | undefined>(stateKey, undefined);
const post = transferState.get<PostContent | undefined>(
stateKey,
undefined
);
postData.next(post as PostContent);
return post;
}
return inject(PostsService).getPost(url)
return inject(PostsService)
.getPost(url)
.pipe(
tap(post => {
transferState.set<PostContent>(stateKey, post);
postData.next(post)}
),
postData.next(post);
}),
catchError((_: any) => {
router.navigate(['**'], { skipLocationChange: true });
return EMPTY;
})
)
);
},
meta: (activatedRoute: ActivatedRouteSnapshot) => {
const url = activatedRoute.url.map(({ path }) => path).join('/');
const transferState = inject(TransferState);
const stateKey = makeStateKey<PostContent | undefined>(url);
if (transferState.hasKey(stateKey)) {
return getPostMeta(transferState.get<PostContent | undefined>(stateKey, undefined) as PostContent, url);
return getPostMeta(
transferState.get<PostContent | undefined>(
stateKey,
undefined
) as PostContent,
url
);
}
return postData.pipe(map((post) => getPostMeta(post, url)));
}
return postData.pipe(map(post => getPostMeta(post, url)));
},
},
title: (activatedRoute: ActivatedRouteSnapshot) => {
const url = activatedRoute.url.map(({ path }) => path).join('/');
const transferState = inject(TransferState);
const stateKey = makeStateKey<PostContent | undefined>(url);
const getTitle = ({ title }: PostContent) => `${title} | ${activatedRoute.parent?.title}`;
const getTitle = ({ title }: PostContent) =>
`${title} | ${activatedRoute.parent?.title}`;
if (transferState.hasKey(stateKey)) {
return getTitle(transferState.get<PostContent | undefined>(stateKey, undefined) as PostContent);
return getTitle(
transferState.get<PostContent | undefined>(
stateKey,
undefined
) as PostContent
);
}
return postData.pipe(map((post) => getTitle(post)));
}
}
return postData.pipe(map(post => getTitle(post)));
},
};
}
5 changes: 2 additions & 3 deletions src/app/components/author/author.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
sm: size === 'sm',
md: size === 'md',
lg: size === 'lg',
muted: muted
muted: muted,
}">
<blog-avatar
class="author__avatar"
[url]="author.displayAvatar?.[size]"
format="circle"
></blog-avatar>
format="circle"></blog-avatar>
<div class="author__details">
<div class="author__fullname">{{ author.fullname }}</div>
@if (size === 'lg') {
Expand Down
1 change: 0 additions & 1 deletion src/app/components/author/author.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ export class AuthorComponent {
@Input() muted = false;

author!: Author;

}
Loading
Loading