From ac6725e23396447c88cde7364c3bdc47a0a546de Mon Sep 17 00:00:00 2001
From: Yuval Adam <_@yuv.al>
Date: Fri, 9 May 2025 13:31:32 +0200
Subject: Add dynamic faq
---
src/content/faqs.ts | 22 +++++++++++++++
src/pages/index.astro | 78 ++++++++++++++++++++++++++++++++++++---------------
2 files changed, 78 insertions(+), 22 deletions(-)
create mode 100644 src/content/faqs.ts
(limited to 'src')
diff --git a/src/content/faqs.ts b/src/content/faqs.ts
new file mode 100644
index 0000000..390e1a2
--- /dev/null
+++ b/src/content/faqs.ts
@@ -0,0 +1,22 @@
+export const faqs = [
+ {
+ q: "What is CIDR?",
+ a: "Classless Inter-Domain Routing (CIDR) is a compact way to write IP address ranges and their network masks."
+ },
+ {
+ q: "Why is CIDR notation useful?",
+ a: "It lets network engineers allocate address space precisely, aggregate routes and keep routing tables smaller."
+ },
+ {
+ q: "How is an IP address structured?",
+ a: "An IPv4 address consists of four 8-bit numbers (octets) ranging from 0 to 255, separated by dots."
+ },
+ {
+ q: "What does the number after the slash mean?",
+ a: "The slash value (e.g. /24) shows how many bits belong to the network prefix; the rest identify individual hosts."
+ },
+ {
+ q: "How does this calculator help?",
+ a: "Paste any IP/CIDR and it instantly shows netmask, broadcast address, usable host range and a visual bit map."
+ }
+];
\ No newline at end of file
diff --git a/src/pages/index.astro b/src/pages/index.astro
index 6e65c27..9206573 100644
--- a/src/pages/index.astro
+++ b/src/pages/index.astro
@@ -1,5 +1,6 @@
---
import Cidr from "../components/Cidr";
+import { faqs } from "../content/faqs.ts";
import "../styles/global.css";
import { GOOGLE_ANALYTICS_ID } from "../config";
@@ -9,6 +10,16 @@ const metadata = {
description:
"Instantly compute and visualize CIDR subnets, IP ranges and masks. Free online tool for accurate network design, planning and IT education.",
};
+
+const faqJsonLd = {
+ "@context": "https://schema.org",
+ "@type": "FAQPage",
+ mainEntity: faqs.map(({ q, a }) => ({
+ "@type": "Question",
+ name: q,
+ acceptedAnswer: { "@type": "Answer", text: a },
+ })),
+};
---
@@ -67,29 +78,52 @@ const metadata = {
- CIDR (Classless Inter-Domain Routing) notation is a - compact method for specifying IP address ranges and - network masks. It is widely used in network - configuration and management. -
-- An IP address consists of 4 octets, each containing 8 - bits that represent values from 0 to 255. In CIDR - notation, a forward slash (/) followed by a number - indicates the length of the network prefix in bits. -
-- This prefix length determines the network mask and the - number of available host addresses within the specified - IP range. This calculator helps you visualize and - understand these CIDR blocks, making network planning - and configuration easier. -
-