Tutorial 9: Surah Information End-to-End
This tutorial is for users who want to show chapter-level context (names, summaries, key notes) before ayah reading.
1) What This Resource Is
Surah Information resources provide chapter metadata and explanatory context.
Typical fields include:
- Surah identity (
surah_id/ number) - Names/titles
- Short summary text
- Detailed long-form content (often with sections such as
Name,Period of Revelation,Theme) - Language/source metadata
- Revelation context and related descriptors
Primary category:
2) When to Use It
Use surah-info data when building:
- Surah intro cards before ayah list
- Chapter overview pages
- Learning experiences with chapter context
3) How to Get Your First Example Resource
- Open https://qul.tarteel.ai/resources/surah-info.
- Keep default listing order and open the first published card.
- Confirm the detail page includes:
-
Surah Info Previewtab -
Helptab
-
- Confirm available downloads (
csv,json,sqlite).
This keeps onboarding concrete without hardcoded IDs.
4) What the Preview Shows (Website-Aligned)
On surah-info detail pages:
-
Surah Info Previewtab:Jump to Surah- Next/previous surah navigation
- Short summary paragraph
- Detailed content blocks (for example
Name,Period of Revelation,Theme)
-
Helptab:- Resource purpose and coverage (themes/topics/reasons for revelation/summaries)
- Format availability (
SQLite,CSV,JSON) - Note that some records include both short summary and detailed long-form text
- Note that detailed text may include HTML tags for formatting
Practical meaning:
- Surah-info is chapter-level context, not ayah-level text.
- Use it as a companion layer above script/translation views.
Full Surah 1 example content (from a surah-info detail page, in the same structure users see):
- Intro summary:
- This Surah is named Al-Fatihah because of its subject matter. Fatihah is that which opens a subject or a book or any other thing. In other words, Al-Fatihah is a sort of preface.
- Name:
- This Surah is named Al-Fatihah because of its subject matter. Fatihah is that which opens a subject or a book or any other thing. In other words, Al-Fatihah is a sort of preface.
- Period of Revelation:
- Surah Al-Fatihah is one of the very earliest Revelations to the Holy Prophet. As a matter of fact, we learn from authentic traditions that it was the first complete Surah that was revealed to Muhammad (Allah's peace be upon him). Before this, only a few miscellaneous verses were revealed which form parts of Alaq, Muzzammil, Muddaththir, etc.
- Theme:
- This Surah is in fact a prayer that Allah has taught to all those who want to make a study of His book. It has been placed at the very beginning of the Quran to teach this lesson to the reader: if you sincerely want to benefit from the Quran, you should offer this prayer to the Lord of the Universe.
- This preface is meant to create a strong desire in the heart of the reader to seek guidance from the Lord of the Universe Who alone can grant it. Thus Al-Fatihah indirectly teaches that the best thing for a man is to pray for guidance to the straight path, to study the Quran with the mental attitude of a seeker searching for the truth, and to recognize the fact that the Lord of the Universe is the source of all knowledge. He should, therefore, begin the study of the Quran with a prayer to Him for guidance.
- From this theme, it becomes clear that the real relation between Al-Fatihah and the Quran is not that of an introduction to a book but that of a prayer and its answer. Al-Fatihah is the prayer from the servant and the Quran is the answer from the Master to the servant's prayer. The servant prays to Allah to show him guidance and the Master places the whole of the Quran before him in answer to his prayer, as if to say, "This is the Guidance you begged from Me."
5) Download and Use (Step-by-Step)
- Download selected package (
csv,json, orsqlite). - Import surah records by surah number.
- Normalize language/source fields if multiple sources are used.
- Separate short summary and detailed content fields in your data model.
- If rendering detailed HTML content, sanitize before output in production.
- Cache chapter metadata for quick chapter loads.
- Render intro card before ayah list.
Starter integration snippet (JavaScript):
JavaScript
const buildSurahInfoIndex = (rows) =>
rows.reduce((index, row) => {
index[row.surah_id] = row;
return index;
}, {});
// Use a proper HTML sanitizer in production; this is only a minimal placeholder.
const sanitizeHtml = (html) =>
String(html || "")
.replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi, "")
.replace(/on\w+="[^"]*"/gi, "");
const renderDetailedSections = (surahInfo) => {
if (Array.isArray(surahInfo.sections) && surahInfo.sections.length > 0) {
return surahInfo.sections
.map(
(section) =>
`<section><h3>${section.title}</h3><p>${section.text}</p></section>`
)
.join("");
}
// Some sources provide long-form chapter details as HTML.
return sanitizeHtml(surahInfo.detailed_html || "");
};
const renderSurahHeader = (container, surahInfo) => {
if (!surahInfo) {
container.textContent = "Surah info not found";
return;
}
container.innerHTML = `
<h2>${surahInfo.name}</h2>
<p>${surahInfo.short_summary || ""}</p>
<small>Revelation: ${surahInfo.revelation_place || "unknown"}</small>
<div>${renderDetailedSections(surahInfo)}</div>
`;
};
6) Real-World Example: Chapter Intro Card
Goal:
- Show surah context before rendering ayahs.
Inputs:
- Surah Information package
- Quran Script package
Processing:
- User opens a surah.
- App fetches chapter info by
surah_id. - App renders intro card, then ayah list.
Expected output:
- Users get chapter context before reading ayah content.
Interactive preview (temporary sandbox):
You can edit this code for testing. Edits are not saved and may not persist after refresh.
JavaScript Playground
Editor
Preview
7) Common Mistakes to Avoid
- Treating surah-info as ayah-level content.
- Not handling multiple language/source variants.
- Forgetting to cache chapter metadata for repeated navigations.
8) When to Request Updates or Changes
Open an issue if you find:
- Missing/incorrect surah descriptions
- Mismatched surah identifiers
- Broken
csv/json/sqlitedownloads
Issue tracker: