Overview
TheExperienceCard component displays a preview of your work experience on the homepage. It shows your 3 most recent positions with job title, company name, and employment dates.
Location
Source:src/components/sections/ExperienceCard.astro
Purpose
This component:- Displays your most recent work experiences
- Shows job title, company, and date range for each position
- Links to individual experience detail pages
- Provides access to a detailed timeline of all experiences
Data Source
The component fetches data from theexperiences Content Collection:
src/content/config.ts):
Usage
The component is used insrc/pages/index.astro:
Sorting Logic
Experiences are sorted by start date in descending order (most recent first):Display Format
For each experience, the component shows:- Job Title - Your role/position (medium font weight)
- Company Name - Linked to the experience detail page with primary color
- Date Range - Start date and optional end date
If no
endDate is provided, only the start date is shown. This is useful for current positions.Date Formatting
The component uses theformateLocalDate() utility function to display dates in a localized, user-friendly format.
Adding Experiences
To add a new work experience:- Create a new
.mdor.mdxfile insrc/content/experiences/ - Add the required frontmatter:
For current positions, omit the
endDate field entirely rather than setting it to a future date.View Timeline Link
The component includes a link to view your complete work history:/experiences route in your Astro site, displaying your full professional timeline.
Customization
Change Number of Experiences Shown
Modify the slice parameter:Add Location Information
If you want to include location, update the schema insrc/content/config.ts:
Styling
- Job titles use medium font weight for emphasis
- Company names are styled with the primary color and underline on hover
- Dates use a muted gray color
- Vertical spacing creates clear separation between entries
Related Components
- See the Card component for container styling