Skip to content

Commit e38a991

Browse files
Merge pull request #4 from giuseppealbrizio/develop
feat: Pagefind search integration
2 parents bae326f + 064bf3c commit e38a991

6 files changed

Lines changed: 237 additions & 6 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ legacy-html/ # Versioni HTML originali (retrocompatibilità)
3939
| [ai-developer-paradigm-python](src/content/articles/ai-developer-paradigm-python.mdx) | Il Nuovo Paradigma - Python Edition |
4040
| [ai-developer-roadmap-2026](src/content/articles/ai-developer-roadmap-2026.mdx) | Roadmap AI Developer 2026 |
4141
| [ai-jobs-overview-2026](src/content/articles/ai-jobs-overview-2026.mdx) | AI, Lavoro e Futuro dei Programmatori |
42+
| [claude-code-vs-cursor-comparison](src/content/articles/claude-code-vs-cursor-comparison.mdx) | Claude Code vs Cursor - Confronto 2025 |
4243
| [memory-war-enterprise](src/content/articles/memory-war-enterprise.mdx) | The Memory War That Will Define AI |
4344
| [python-fundamentals-to-generative](src/content/articles/python-fundamentals-to-generative.mdx) | Da Python Fundamentals a Generative Programming |
4445
| [welcome-to-the-machine-analysis](src/content/articles/welcome-to-the-machine-analysis.mdx) | Welcome to the Machine - Analisi |
@@ -75,6 +76,11 @@ File di contesto per automatizzare il setup dell'ambiente di sviluppo con Claude
7576

7677
## Changelog
7778

79+
### v2.2.0 - 2026-01-05
80+
- Aggiunto articolo "Claude Code vs Cursor - Confronto 2025"
81+
- Aggiunto colore purple al componente ComparisonTable
82+
- Aggiornata guida GitHub CLI con workflow PR completo
83+
7884
### v2.1.0 - 2026-01-05
7985
- Convertiti tutti i contenuti da Markdown a MDX
8086
- Aggiunti 11 componenti Astro per styling avanzato (InfoBox, ProsCons, Quote, etc.)

package-lock.json

Lines changed: 90 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
{
22
"name": "software-engineering-3.0",
33
"type": "module",
4-
"version": "2.0.0",
4+
"version": "2.2.0",
55
"scripts": {
66
"dev": "astro dev",
77
"start": "astro dev",
8-
"build": "astro build",
8+
"build": "astro build && pagefind --site dist",
99
"preview": "astro preview",
1010
"astro": "astro"
1111
},
1212
"dependencies": {
1313
"@astrojs/mdx": "^4.3.13",
14-
"astro": "^5.16.6"
14+
"astro": "^5.16.6",
15+
"pagefind": "^1.4.0"
1516
}
1617
}

src/components/Search.astro

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
const base = import.meta.env.BASE_URL;
3+
---
4+
5+
<div class="search-container">
6+
<div id="search"></div>
7+
</div>
8+
9+
<link href={`${base}/pagefind/pagefind-ui.css`} rel="stylesheet" />
10+
<script is:inline define:vars={{ base }}>
11+
window.addEventListener('DOMContentLoaded', () => {
12+
const script = document.createElement('script');
13+
script.src = `${base}/pagefind/pagefind-ui.js`;
14+
script.onload = () => {
15+
new PagefindUI({
16+
element: '#search',
17+
showSubResults: true,
18+
showImages: false,
19+
translations: {
20+
placeholder: 'Cerca articoli e guide...',
21+
zero_results: 'Nessun risultato per "[SEARCH_TERM]"',
22+
many_results: '[COUNT] risultati per "[SEARCH_TERM]"',
23+
one_result: '1 risultato per "[SEARCH_TERM]"',
24+
clear_search: 'Cancella',
25+
load_more: 'Carica altri risultati',
26+
},
27+
baseUrl: base
28+
});
29+
};
30+
document.head.appendChild(script);
31+
});
32+
</script>
33+
34+
<style>
35+
.search-container {
36+
max-width: 600px;
37+
margin: 0 auto 2rem;
38+
}
39+
40+
:global(.pagefind-ui) {
41+
--pagefind-ui-scale: 1;
42+
--pagefind-ui-primary: #6366f1;
43+
--pagefind-ui-text: #f1f5f9;
44+
--pagefind-ui-background: #1e293b;
45+
--pagefind-ui-border: #334155;
46+
--pagefind-ui-tag: #334155;
47+
--pagefind-ui-border-width: 1px;
48+
--pagefind-ui-border-radius: 8px;
49+
--pagefind-ui-font: 'Segoe UI', system-ui, -apple-system, sans-serif;
50+
}
51+
52+
:global(.pagefind-ui__search-input) {
53+
background: var(--pagefind-ui-background) !important;
54+
color: var(--pagefind-ui-text) !important;
55+
border: 1px solid var(--pagefind-ui-border) !important;
56+
padding: 0.75rem 1rem 0.75rem 2.5rem !important;
57+
font-size: 1rem !important;
58+
}
59+
60+
:global(.pagefind-ui__search-input::placeholder) {
61+
color: #64748b !important;
62+
}
63+
64+
:global(.pagefind-ui__search-input:focus) {
65+
border-color: var(--pagefind-ui-primary) !important;
66+
outline: none !important;
67+
box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2) !important;
68+
}
69+
70+
:global(.pagefind-ui__search-clear) {
71+
color: #64748b !important;
72+
background: transparent !important;
73+
}
74+
75+
:global(.pagefind-ui__results-area) {
76+
margin-top: 1rem;
77+
}
78+
79+
:global(.pagefind-ui__result) {
80+
background: var(--pagefind-ui-background) !important;
81+
border: 1px solid var(--pagefind-ui-border) !important;
82+
border-radius: 8px !important;
83+
padding: 1rem !important;
84+
margin-bottom: 0.75rem !important;
85+
}
86+
87+
:global(.pagefind-ui__result:hover) {
88+
border-color: var(--pagefind-ui-primary) !important;
89+
}
90+
91+
:global(.pagefind-ui__result-link) {
92+
color: var(--pagefind-ui-primary) !important;
93+
text-decoration: none !important;
94+
font-weight: 600 !important;
95+
}
96+
97+
:global(.pagefind-ui__result-link:hover) {
98+
text-decoration: underline !important;
99+
}
100+
101+
:global(.pagefind-ui__result-title) {
102+
color: var(--pagefind-ui-text) !important;
103+
}
104+
105+
:global(.pagefind-ui__result-excerpt) {
106+
color: #94a3b8 !important;
107+
font-size: 0.9rem !important;
108+
}
109+
110+
:global(.pagefind-ui__result-excerpt mark) {
111+
background: rgba(99, 102, 241, 0.3) !important;
112+
color: var(--pagefind-ui-text) !important;
113+
}
114+
115+
:global(.pagefind-ui__message) {
116+
color: #94a3b8 !important;
117+
}
118+
119+
:global(.pagefind-ui__button) {
120+
background: var(--pagefind-ui-primary) !important;
121+
color: white !important;
122+
border: none !important;
123+
border-radius: 6px !important;
124+
padding: 0.5rem 1rem !important;
125+
cursor: pointer !important;
126+
}
127+
128+
:global(.pagefind-ui__button:hover) {
129+
opacity: 0.9 !important;
130+
}
131+
</style>

src/layouts/ArticleLayout.astro

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@ const base = import.meta.env.BASE_URL;
2222
</head>
2323
<body>
2424
<div class="container">
25-
<header class="article-header">
25+
<header class="article-header" data-pagefind-ignore>
2626
<span class={`badge badge-${category}`}>
2727
{category === 'article' ? 'ARTICOLO' : 'GUIDA'}
2828
</span>
2929
<h1>{title}</h1>
3030
<p class="tagline">{description}</p>
3131
</header>
3232

33-
<article class="article-content">
33+
<article class="article-content" data-pagefind-body>
34+
<span data-pagefind-meta="title" style="display:none;">{title}</span>
3435
<slot />
3536
</article>
3637

src/pages/index.astro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
import BaseLayout from '../layouts/BaseLayout.astro';
33
import Card from '../components/Card.astro';
4+
import Search from '../components/Search.astro';
45
import { getCollection } from 'astro:content';
56
67
const articles = await getCollection('articles');
@@ -15,6 +16,8 @@ const base = import.meta.env.BASE_URL;
1516
<p class="tagline">Raccolta di articoli e guide sul mondo dello sviluppo software nell'era dell'AI</p>
1617
</header>
1718

19+
<Search />
20+
1821
<div class="filters">
1922
<button class="filter-btn active" data-filter="all">Tutti</button>
2023
<button class="filter-btn" data-filter="article">Articoli</button>

0 commit comments

Comments
 (0)