Skip to content

Conversation

@shrvansudhakara
Copy link
Contributor

🗒️ Description

This PR adds consistent sorting functionality for talks/speaking engagements to match the existing behavior for work experience items. Previously, talks were displayed in an arbitrary order (file system order), while jobs were properly sorted in reverse chronological order.

Fixes #5

📝Changes

Modified Files

  • src/lib/utils.ts - Added sortTalksByYear() utility function
  • src/pages/index.astro - Applied sorting to talks collection

New Files

None

🚀 Features

  • Talks sorting: Talks now display in reverse chronological order (newest first)
  • Consistency: Both work experience and speaking sections now follow the same ordering logic
  • Reusable utility: New sortTalksByYear() function follows the same pattern as sortJobsByDate()

🔧 Implementation Details

Added sorting function:

export const sortTalksByYear = (talks: CollectionEntry<'talks'>[]) => {
  return talks.sort((a, b) => b.data.year - a.data.year);
};

Applied to homepage:

  • Imported sortTalksByYear from utils
  • Sorted talks collection before rendering
  • Updated template to use sortedTalks instead of unsorted talks

✅ Testing

Manual Testing Completed

  • Work experience displays in reverse chronological order (latest first)
  • Speaking section displays in reverse chronological order (latest first)
  • No console errors in development mode
  • Build succeeds without errors

How to Test

  1. Check out this branch
  2. Run bun run dev
  3. Navigate to homepage
  4. Verify talks appear with newest year first
  5. Add test content with different years to verify sorting

📸 Screenshots

Before:
before-ss

After:
after-ss

🔗 Related


Reviewer Notes: This is a straightforward refactoring that extracts sorting logic into a reusable utility function and applies it consistently across content types.

- Add sortTalksByYear utility function
- Apply sorting to talks collection on homepage
- Ensures both jobs and talks display in reverse chronological order (newest first)

Fixes coderdiaz#5
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds sorting functionality for talks by year in descending order. Previously, talks were displayed in their default collection order, but now they are sorted with the most recent talks appearing first.

Key Changes:

  • Added a sortTalksByYear utility function that sorts talks by year in descending order
  • Updated the homepage to use the sorted talks array instead of the unsorted collection

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/lib/utils.ts Added sortTalksByYear function to sort talks by year (newest first)
src/pages/index.astro Imported and applied the sorting function to talks before rendering

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Owner

@coderdiaz coderdiaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

@coderdiaz coderdiaz merged commit 98a43ec into coderdiaz:main Oct 29, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor logic for ordering content into work experience and speaking items

2 participants