Skip to content

Commit

Permalink
feat: SEO friendly localized URLs for product detail pages (#110)
Browse files Browse the repository at this point in the history
- moved ProductRoutePipe to core/routing/product
- match incoming URLs for products with Angular UrlMatcher and RegExp pattern
- improved typing of ProductRoutePipe
  • Loading branch information
dhhyi committed Feb 17, 2020
1 parent 5144f44 commit e464392
Show file tree
Hide file tree
Showing 28 changed files with 558 additions and 142 deletions.
2 changes: 1 addition & 1 deletion src/app/core/pipes.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { CategoryRoutePipe } from './pipes/category-route.pipe';
import { DatePipe } from './pipes/date.pipe';
import { HighlightPipe } from './pipes/highlight.pipe';
import { MakeHrefPipe } from './pipes/make-href.pipe';
import { ProductRoutePipe } from './pipes/product-route.pipe';
import { SafeHtmlPipe } from './pipes/safe-html.pipe';
import { SanitizePipe } from './pipes/sanitize.pipe';
import { ProductRoutePipe } from './routing/product/product-route.pipe';

const pipes = [
AttributeToStringPipe,
Expand Down
50 changes: 0 additions & 50 deletions src/app/core/pipes/product-route.pipe.spec.ts

This file was deleted.

40 changes: 0 additions & 40 deletions src/app/core/pipes/product-route.pipe.ts

This file was deleted.

12 changes: 12 additions & 0 deletions src/app/core/routing/product/product-route.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Pipe, PipeTransform } from '@angular/core';

import { CategoryView } from 'ish-core/models/category-view/category-view.model';
import { ProductView } from 'ish-core/models/product-view/product-view.model';
import { generateProductUrl } from 'ish-core/routing/product/product.route';

@Pipe({ name: 'ishProductRoute', pure: true })
export class ProductRoutePipe implements PipeTransform {
transform(product: ProductView, category?: CategoryView): string {
return generateProductUrl(product, category);
}
}
Loading

0 comments on commit e464392

Please sign in to comment.