Skip to content

Commit

Permalink
Enhance publications management and update README documentation
Browse files Browse the repository at this point in the history
- Added a new `publications/` directory to organize academic and professional publications in the project structure.
- Implemented a function to fetch and display publications in the `Resume` component, enhancing the visibility of authored works.
- Updated `site.config.ts` to include a new configuration option for the publications section headline.
- Revised the README.md to provide clear instructions on how to add and format publications, including examples for markdown entries.
- Improved overall documentation to support the new publications feature and ensure users can easily manage their publication entries.
  • Loading branch information
seeschweiler committed Jan 1, 2025
1 parent deaa4b6 commit 8b1975a
Show file tree
Hide file tree
Showing 8 changed files with 217 additions and 9 deletions.
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ content/
│ └── 002-previous-job.md
├── education/ # Educational background
│ └── 001-bachelor-computer-science.md
├── publications/ # Academic or professional publications
│ ├── 001-latest-paper.md
│ └── 002-conference-paper.md
├── legalnotice.md # Optional legal notice page
└── dataprivacypolicy.md # Optional data privacy policy page
```
Expand Down Expand Up @@ -77,6 +80,9 @@ content/
│ └── 002-previous-job.md
├── education/ # Required: Educational background
│ └── 001-bachelor-computer-science.md
├── publications/ # Required: Academic or professional publications
│ ├── 001-latest-paper.md
│ └── 002-conference-paper.md
├── legalnotice.md # Optional: Legal notice
└── dataprivacypolicy.md # Optional: Privacy policy
```
Expand Down Expand Up @@ -134,6 +140,26 @@ endDate: "Present" # or YYYY-MM format
- Notable project
```

#### Education Entries (education/*.md)
Example: `content/education/001-bachelor-computer-science.md`:
```markdown
---
title: "Bachelor of Science in Computer Science"
institution: "University Name"
startDate: "2019-09" # YYYY-MM format
endDate: "2023-06" # YYYY-MM format or "Present"
---

Details about your education, such as:
- Major areas of study
- Notable achievements
- Relevant coursework
- Academic honors or awards
- Special projects or research
```

Each education entry will be displayed in chronological order, with the most recent education appearing first. The content section supports markdown formatting, allowing you to include lists, links, and other formatted text.

#### Skills (skills.md)
The `skills.md` file in the `content/` directory allows you to organize your skills into logical categories (e.g., Programming Languages, Frontend Development, Languages, etc.). Each category can contain multiple skills, providing a clear structure to your skillset.

Expand Down Expand Up @@ -181,6 +207,38 @@ const siteConfig = {
};
```

#### Publications (publications/*.md)
The `publications/` directory in the `content/` folder allows you to showcase your academic papers, professional publications, or other written works. Each publication is represented by a separate markdown file.

Example: `content/publications/001-latest-paper.md`:
```markdown
---
title: "Your Publication Title"
authors: "Your Name, Co-Author Name"
venue: "Journal or Conference Name"
date: "2023-12" # YYYY-MM format
---

Description of the publication, key findings, or abstract. You can include:
- Research objectives
- Methodology highlights
- Key findings
- Impact or citations
- Links to full paper or DOI
```

The publications will be displayed in chronological order, with the most recent publications appearing first. All frontmatter fields (authors, venue, date) are optional - if a field is omitted, it will be skipped in the display without showing empty separators.

To configure the Publications section headline, update `site.config.ts`:
```typescript
const siteConfig = {
texts: {
publicationSectionHeadlineText: "Publications", // Customize section headline
// ... other config options
}
};
```

### 3. Theme Configuration

Edit `config/site.config.ts` to configure your theme preferences:
Expand Down
47 changes: 47 additions & 0 deletions app/api/publications/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { promises as fs } from "fs";
import path from "path";
import matter from "gray-matter";

export async function GET() {
const publicationsDirectory = path.join(
process.cwd(),
"content/publications"
);

try {
const files = await fs.readdir(publicationsDirectory);

// Filter only markdown files and sort them by filename
const publicationFiles = files
.filter((file) => file.endsWith(".md"))
.sort((a, b) => a.localeCompare(b));

const publications = await Promise.all(
publicationFiles.map(async (filename) => {
const filePath = path.join(publicationsDirectory, filename);
const fileContent = await fs.readFile(filePath, "utf8");
const { data, content } = matter(fileContent);

return {
id: filename.replace(/\.md$/, ""),
...data,
content: content.trim(),
};
})
);

// Disable caching in development
if (process.env.NODE_ENV === "development") {
return new Response(JSON.stringify(publications), {
headers: {
"Cache-Control": "no-store, max-age=0",
},
});
}

return Response.json(publications);
} catch (error) {
// Return empty array if directory doesn't exist or other errors
return Response.json([]);
}
}
68 changes: 59 additions & 9 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
GraduationCap,
Building2,
Zap,
Book,
} from "lucide-react";
import { parseMarkdown } from "../lib/markdown";
import { Metadata } from "next";
Expand Down Expand Up @@ -129,6 +130,18 @@ async function getPersonalDetailsForMetadata() {
}
}

async function getPublications() {
const res = await fetch(
`${process.env.NEXT_PUBLIC_BASE_URL}/api/publications?t=${Date.now()}`,
{
cache: "no-store",
next: { revalidate: 0 },
}
);
if (!res.ok) return [];
return res.json();
}

export async function generateMetadata(): Promise<Metadata> {
const personalDetails = await getPersonalDetailsForMetadata();

Expand Down Expand Up @@ -213,15 +226,23 @@ export async function generateMetadata(): Promise<Metadata> {
}

export default async function Resume() {
const [personalDetails, skills, summary, experience, hasLegal, hasPrivacy] =
await Promise.all([
getPersonalDetails(),
getSkills(),
getSummary(),
getExperience(),
hasLegalNotice(),
hasDataPrivacyPolicy(),
]);
const [
personalDetails,
skills,
summary,
experience,
publications,
hasLegal,
hasPrivacy,
] = await Promise.all([
getPersonalDetails(),
getSkills(),
getSummary(),
getExperience(),
getPublications(),
hasLegalNotice(),
hasDataPrivacyPolicy(),
]);

const experiences = getExperience();
const education = getEducation();
Expand Down Expand Up @@ -369,6 +390,35 @@ export default async function Resume() {
</section>
)}

{publications.length > 0 && (
<section className="mb-10">
<h2 className="text-2xl font-bold mb-4 flex items-center gap-2 text-gray-900 dark:text-gray-100">
<Book className="w-6 h-6" />
{siteConfig.texts.publicationSectionHeadlineText}
</h2>
<div className="space-y-6">
{publications.map((pub: any) => (
<div key={pub.id}>
<h4 className="text-xl font-medium text-gray-800 dark:text-gray-100">
{pub.title}
</h4>
<p className="text-teal-600 dark:text-teal-400">
{[pub.authors, pub.venue, pub.date]
.filter(Boolean)
.join(" | ")}
</p>
<div
className="text-gray-600 dark:text-gray-300 leading-relaxed prose prose-teal dark:prose-invert max-w-none"
dangerouslySetInnerHTML={{
__html: parseMarkdown(pub.content),
}}
/>
</div>
))}
</div>
</section>
)}

{skills?.skillCategories?.length > 0 && (
<section className="mb-10">
<h2 className="text-2xl font-bold mb-4 flex items-center gap-2 text-gray-900 dark:text-gray-100">
Expand Down
1 change: 1 addition & 0 deletions config/site.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const siteConfig: SiteConfig = {
texts: {
summarySectionHeadlineText: "Summary",
experienceSectionHeadlineText: "Experience",
publicationSectionHeadlineText: "Publications",
skillsSectionHeadlineText: "Skills",
educationSectionHeadlineText: "Education",
statementText:
Expand Down
12 changes: 12 additions & 0 deletions content/publications/001-example-publication.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: "Example Publication Title"
authors: "John Doe, Jane Smith"
venue: "International Journal of Computer Science"
date: "2023-06"
---

Brief description or abstract of the publication. Can include links to the full paper or DOI.

- Key findings or contributions
- Impact or significance
- Additional relevant information
31 changes: 31 additions & 0 deletions lib/publications.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import fs from "fs";
import path from "path";
import matter from "gray-matter";
import { Publication } from "../types/publications";

const publicationsDirectory = path.join(process.cwd(), "content/publications");

export function getPublications(): Publication[] {
// Check if directory exists
if (!fs.existsSync(publicationsDirectory)) {
return [];
}

const fileNames = fs.readdirSync(publicationsDirectory);
const allPublications = fileNames.map((fileName) => {
const id = fileName.replace(/\.md$/, "");
const fullPath = path.join(publicationsDirectory, fileName);
const fileContents = fs.readFileSync(fullPath, "utf8");
const { data, content } = matter(fileContents);

return {
id,
content,
...data,
} as Publication;
});

return allPublications.sort((a, b) => {
return new Date(b.date).getTime() - new Date(a.date).getTime();
});
}
8 changes: 8 additions & 0 deletions types/publications.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export interface Publication {
id: string;
title: string;
authors: string;
venue: string;
date: string;
content: string;
}
1 change: 1 addition & 0 deletions types/site-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ export interface SiteConfig {
shareDialogQRCodeTabText: string;
shareDialogEmailTabText: string;
shareDialogVCardTabText: string;
publicationSectionHeadlineText: string;
};
}

0 comments on commit 8b1975a

Please sign in to comment.