Skip to content

Commit e9d0074

Browse files
committed
docs: improve SEO and add LLM discoverability
- Add meta description to all 21 pages missing it - Add SoftwareSourceCode JSON-LD structured data (global head) - Add FAQPage JSON-LD via rehype plugin (auto-extracted from content) - Add og:image:alt meta tag - Add llms.txt for AI search engine discoverability
1 parent ccd8179 commit e9d0074

22 files changed

Lines changed: 209 additions & 0 deletions

docs/astro.config.mjs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import {defineConfig} from 'astro/config';
22
import starlight from '@astrojs/starlight';
33
import starlightLinksValidator from 'starlight-links-validator';
4+
import rehypeFaqSchema from './plugins/rehype-faq-schema.mjs';
45

56
// https://astro.build/config
67
export default defineConfig({
78
site: 'https://fastcsv.org',
9+
markdown: {
10+
rehypePlugins: [rehypeFaqSchema],
11+
},
812
integrations: [
913
starlight({
1014
plugins: [starlightLinksValidator()],
@@ -93,6 +97,31 @@ export default defineConfig({
9397
content: 'https://fastcsv.org/fastcsv-og.png'
9498
},
9599
},
100+
{
101+
tag: 'meta',
102+
attrs: {
103+
property: 'og:image:alt',
104+
content: 'FastCSV – Fast, lightweight CSV library for Java'
105+
},
106+
},
107+
{
108+
tag: 'script',
109+
attrs: {
110+
type: 'application/ld+json',
111+
},
112+
content: JSON.stringify({
113+
'@context': 'https://schema.org',
114+
'@type': 'SoftwareSourceCode',
115+
'name': 'FastCSV',
116+
'description': 'Fast, lightweight, and easy to use — the production-proven CSV library for Java. RFC 4180 compliant with zero runtime dependencies.',
117+
'url': 'https://fastcsv.org',
118+
'codeRepository': 'https://github.com/osiegmar/FastCSV',
119+
'programmingLanguage': 'Java',
120+
'license': 'https://opensource.org/licenses/MIT',
121+
'applicationCategory': 'Library',
122+
'runtimePlatform': 'Java 17+',
123+
}),
124+
},
96125
{
97126
tag: 'script',
98127
attrs: {

docs/plugins/rehype-faq-schema.mjs

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/**
2+
* Rehype plugin that automatically generates FAQPage JSON-LD structured data
3+
* from FAQ markdown content. Extracts h3/h4 headings ending with "?" and their
4+
* following paragraph(s) as answers.
5+
*/
6+
7+
function textContent(node) {
8+
if (node.type === 'text') {
9+
return node.value;
10+
}
11+
if (node.children) {
12+
return node.children.map(textContent).join('');
13+
}
14+
return '';
15+
}
16+
17+
export default function rehypeFaqSchema() {
18+
return (tree, file) => {
19+
if (!file.history[0]?.match(/[/\\]faq\.md$/)) {
20+
return;
21+
}
22+
23+
const entries = [];
24+
const children = tree.children || [];
25+
26+
for (let i = 0; i < children.length; i++) {
27+
const node = children[i];
28+
if (node.type !== 'element' || !['h3', 'h4'].includes(node.tagName)) {
29+
continue;
30+
}
31+
32+
const question = textContent(node).trim();
33+
if (!question.endsWith('?')) {
34+
continue;
35+
}
36+
37+
// Collect following paragraph text as the answer
38+
const parts = [];
39+
for (let j = i + 1; j < children.length; j++) {
40+
const next = children[j];
41+
if (next.type === 'element' && ['h2', 'h3', 'h4'].includes(next.tagName)) {
42+
break;
43+
}
44+
if (next.type === 'element' && next.tagName === 'p') {
45+
parts.push(textContent(next).trim());
46+
}
47+
}
48+
49+
if (parts.length > 0) {
50+
entries.push({
51+
'@type': 'Question',
52+
name: question,
53+
acceptedAnswer: {
54+
'@type': 'Answer',
55+
text: parts.join(' '),
56+
},
57+
});
58+
}
59+
}
60+
61+
if (entries.length === 0) {
62+
return;
63+
}
64+
65+
tree.children.push({
66+
type: 'element',
67+
tagName: 'script',
68+
properties: {type: 'application/ld+json'},
69+
children: [{
70+
type: 'text',
71+
value: JSON.stringify({
72+
'@context': 'https://schema.org',
73+
'@type': 'FAQPage',
74+
mainEntity: entries,
75+
}),
76+
}],
77+
});
78+
};
79+
}

docs/public/llms.txt

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# FastCSV
2+
3+
> Fast, lightweight, and easy to use — the production-proven CSV library for Java.
4+
5+
FastCSV is the most-starred CSV library for Java. It is a high-performance CSV parser and writer, licensed under MIT. Requires Java 17+ (Android 14 / API level 34).
6+
7+
## Key Features
8+
9+
- **Fast CSV processing** — optimized for high-speed reading and writing
10+
- **Tiny footprint** — only ~90 KiB, with zero runtime dependencies
11+
- **Developer-friendly API** — clean, intuitive, null-free, and easy to integrate
12+
- **Well-documented** — quickstart guides and complete Javadoc
13+
- **High test coverage** — including mutation testing for reliability
14+
- **RFC 4180 compliant** — handles edge cases correctly
15+
- **Robust & maintainable** — uses SpotBugs, PMD, Error Prone, NullAway, and Checkstyle; never returns null unexpectedly
16+
- **Secure** — fuzz-tested via OSS-Fuzz and following OpenSSF best practices
17+
- **Production-proven** — trusted by open-source projects like JUnit, Apache NiFi, and Neo4j
18+
- **Java 17+, Android 34+ compatible** — including GraalVM Native Image and OSGi
19+
- Configurable field separators, quote strategies, and comment handling
20+
- BOM (Byte Order Mark) support (UTF-8, UTF-16, UTF-32)
21+
- Header record support with named field access
22+
- Random access reading via IndexedCsvReader
23+
- Flexible callback handlers for custom record types
24+
- Field modifiers for trimming and transforming values during parsing
25+
26+
## Quick Start
27+
28+
Writing CSV:
29+
30+
```java
31+
try (CsvWriter csv = CsvWriter.builder().build(Path.of("output.csv"))) {
32+
csv
33+
.writeRecord("header 1", "header 2")
34+
.writeRecord("value 1", "value 2");
35+
}
36+
```
37+
38+
Reading CSV:
39+
40+
```java
41+
try (CsvReader<CsvRecord> csv = CsvReader.builder().ofCsvRecord(Path.of("input.csv"))) {
42+
csv.forEach(IO::println);
43+
}
44+
```
45+
46+
## Documentation
47+
48+
- [Quick Start Guide](https://fastcsv.org/guides/quickstart/): Add the Maven/Gradle dependency and write your first CSV reader and writer in Java.
49+
- [Basic Tutorial](https://fastcsv.org/guides/basic/): Learn reading and writing CSV files with CsvReader, IndexedCsvReader, and CsvWriter.
50+
- [Design Goals](https://fastcsv.org/architecture/goals/): Core design goals — performance, lightweight, compliance, simplicity, robustness, security.
51+
- [Architecture](https://fastcsv.org/architecture/architecture/): Technical architecture covering reader and writer components.
52+
- [CSV Interpretation](https://fastcsv.org/architecture/interpretation/): How FastCSV interprets CSV data per RFC 4180-bis.
53+
- [FAQ](https://fastcsv.org/faq/): Frequently asked questions about FastCSV.
54+
- [Upgrading](https://fastcsv.org/guides/upgrading/): Guide for migrating from FastCSV 3.x to 4.x.
55+
- [Compliance Report](https://fastcsv.org/compliance/): RFC 4180 compliance verification results.
56+
- [Other Libraries](https://fastcsv.org/other-libraries/): Comparison with alternative Java CSV libraries.
57+
- [Contribution Guide](https://fastcsv.org/guides/contribution/): How to contribute to FastCSV.
58+
59+
## Examples
60+
61+
- [Bean Mapping](https://fastcsv.org/guides/examples/bean-mapping/): Map CSV records to Java beans using NamedCsvRecord.
62+
- [Byte Order Mark](https://fastcsv.org/guides/examples/byte-order-mark/): Handle BOM headers when reading CSV files.
63+
- [Compressed CSV](https://fastcsv.org/guides/examples/compressed-csv/): Read and write GZIP-compressed CSV files.
64+
- [Custom Callback Handler](https://fastcsv.org/guides/examples/custom-callback-handler/): Build custom record types with CsvCallbackHandler.
65+
- [Handle Comments](https://fastcsv.org/guides/examples/handle-comments/): Read and write CSV files with comment lines.
66+
- [Indexed Reading](https://fastcsv.org/guides/examples/indexed-read/): Random access and paginated reading of large CSV files.
67+
- [Modifying Input](https://fastcsv.org/guides/examples/modifying-input/): Trim and transform field values during parsing.
68+
- [Non-standard Control Characters](https://fastcsv.org/guides/examples/non-standard-control-characters/): Configure custom separators and enclosure characters.
69+
- [Quote Strategies](https://fastcsv.org/guides/examples/quote-strategies/): Control quoting behavior with QuoteStrategy API.
70+
- [Read from Classpath](https://fastcsv.org/guides/examples/read-from-classpath/): Read CSV files from the Java classpath.
71+
- [Reading Ambiguous Data](https://fastcsv.org/guides/examples/reading-ambiguous-data/): Handle empty lines, missing fields, and extra fields.
72+
- [Reading as String Arrays](https://fastcsv.org/guides/examples/reading-as-string-array/): Reduce overhead with StringArrayHandler.
73+
- [Reading Null Values](https://fastcsv.org/guides/examples/reading-null/): Handle null and empty values with FieldModifier.
74+
- [Skip Non-CSV Head](https://fastcsv.org/guides/examples/skip-non-csv-head/): Skip non-CSV header lines at the beginning of files.
75+
- [PostgreSQL Interoperability](https://fastcsv.org/guides/examples/postgresql-interoperability/): Import/export CSV data with PostgreSQL COPY command.
76+
- [Writing Rolling Files](https://fastcsv.org/guides/examples/writing-rolling-files/): Split large CSV output across multiple files.
77+
78+
## API Reference
79+
80+
- [Javadoc](https://javadoc.io/doc/de.siegmar/fastcsv/): Full API documentation.
81+
- [Maven Central](https://central.sonatype.com/artifact/de.siegmar/fastcsv): Maven artifact `de.siegmar:fastcsv`.
82+
- [GitHub Repository](https://github.com/osiegmar/FastCSV): Source code, issues, and changelog.

docs/src/content/docs/architecture/goals.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Design Goals
3+
description: "Learn about FastCSV's core design goals: performance, lightweight footprint, RFC 4180 compliance, simplicity, robustness, and security."
34
sidebar:
45
order: 1
56
---

docs/src/content/docs/guides/Examples/bean-mapping.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Bean Mapping
3+
description: "Map CSV records to Java beans using FastCSV's stream-based API with NamedCsvRecord."
34
---
45

56
import SourceExample from '../../../../components/SourceExample.astro';

docs/src/content/docs/guides/Examples/byte-order-mark.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Byte order mark (BOM) header
3+
description: Handle Byte Order Mark (BOM) headers when reading CSV files with FastCSV. Supports UTF-8, UTF-16, and UTF-32.
34
---
45

56
import SourceExample from '../../../../components/SourceExample.astro';

docs/src/content/docs/guides/Examples/compressed-csv.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Compressed CSV
3+
description: Read and write GZIP-compressed CSV files in Java using FastCSV with standard GZIPInputStream and GZIPOutputStream.
34
---
45

56
import SourceExample from '../../../../components/SourceExample.astro';

docs/src/content/docs/guides/Examples/custom-callback-handler.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Custom callback handler
3+
description: "Build custom CSV record types using FastCSV's CsvCallbackHandler interface for flexible parsing."
34
---
45

56
import SourceExample from '../../../../components/SourceExample.astro';

docs/src/content/docs/guides/Examples/handle-comments.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Handle comments
3+
description: "Read and write CSV files with comment lines using FastCSV's configurable comment character support."
34
---
45

56
import SourceExample from '../../../../components/SourceExample.astro';

docs/src/content/docs/guides/Examples/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Overview
3+
description: Browse practical code examples for FastCSV covering reading, writing, compression, bean mapping, and more.
34
---
45

56
This section provides a variety of examples to help you get started with FastCSV.

0 commit comments

Comments
 (0)