Blogs
Blog Listing
Purpose
- It shows a paginated list of blog entries and allows filtering via:
- Category Dropdown
- Sort By Date (ascending or descending)
Layout Used
| Component | Description |
|---|---|
Breadcrumb | Navigation aid. |
Header | Title and introductory paragraph for blogs. |
Filter Bar | Category selection, Sort by date (asc/desc) |
Blog Cards | Each entry displayed via TsBlogCard.. |
Pagination | Client-side navigation across blog pages. |
Core Functionalities
- Data Fetching
- Uses
builderStore.getBlogList('blogs')to retrieve blog data. - Blogs are paginated on the client side using
slice(offset, offset + limit).
- Uses
- Filtering
filterItems(categorySlug): Filters by category and updates the query param (?q=).filterDate(dateOrder): Filters blogs by creation date and updates the query param (?date=).- Category and date are persisted in URL and localStorage for user continuity.
- Pagination
limit = 8per page.- Controlled via
TsPagination. changeActivePage()updates internalcurrentPageand re-fetches blogs.
SEO Integeration
- Title: "Blogs | Toolstation"
- Meta description: "This is the blog listing page of Toolstation."
- Structured data generated via:
generateSchemaList(blogListing, "ItemList", "BlogPosting", {
imageField: "blogImage",
});
Component Used
| Component | Description |
|---|---|
TsBreadcrumb | Shows breadcrumb trail |
TsTitle, TsTypography | Renders static heading and text |
TsSelectBox | Dropdowns for filter options |
TsGrid, TsRow, TsColumn | Grid-based layout system. |
TsBlogCard | Displays individual blog previews |
TsPagination | Page navigation controls |
Lifecycle Summary
onMounted:
- fetchBlogs()
- fetchCategories()
watch:
- selectedDate → triggers filterDate
- currentPage → triggers fetchBlogs
- route.query → updates filters