In the previous chapter, Technical Stack, we looked at the engine room. We learned that Next.js and Nextra are the machinery that builds this website.
But imagine you buy a new car. You don't need to know how the engine pistons work to drive it. You just need the Dashboard. You need to know where the buttons are to turn on the lights, change the radio station, or adjust the mirrors.
Welcome to Chapter 10: Configuration Files.
These files are the "Dashboard" of the Prompt Engineering Guide. They allow you to control the look, feel, and behavior of the website without rewriting the complex code behind it.
Imagine you want to change the name of the website from "Prompt Engineering Guide" to "My AI Notebook."
The Problem: If you didn't have configuration files, you would have to open every single page (Chapter 1, Chapter 2, etc.) and type the new name in the header manually. It would take hours.
The Solution:
You open one file (theme.config.tsx), change the text in one line, and the software automatically updates the header on all 100+ pages of the site.
In this project, there are four "Control Panels" you need to know about.
theme.config.tsx (The Designer): Controls the visual look—logos, navigation links, and footer text.next.config.js (The Mechanic): Controls the build process—how the code is compiled and which plugins are used.CITATION.cff (The ID Card): A special file for researchers. It tells them how to credit this project in academic papers..github/workflows (The Robot): A folder of instructions that runs automatic checks every time you save a file.Let's look at the most common task: Changing the logo and the link to the GitHub repository.
Goal: You want the top right corner of the website to link to your GitHub profile, not the default one.
How to use the Config:
theme.config.tsx in the root folder.project section.theme.config.tsximport React from 'react'
export default {
logo: <span>My AI Notebook</span>,
project: {
// Change this link to your own repository
link: 'https://github.com/my-username/my-project',
},
// ... other settings
}
When you save this file, the website rebuilds.
You changed the entire site's branding with just 3 lines of code!
How does the website know to look at these files?
When the Technical Stack (Next.js) starts up, it follows a specific sequence. It looks for these "Config" files before it looks at any content.
Here is what happens when you run the command npm run dev to start the website:
next.config.js)This file is the bridge between Next.js (the framework) and Nextra (the documentation theme).
It tells Next.js: "Hey, please treat .md and .mdx files as pages, and use the theme settings found in the other file."
next.config.js// Import the documentation theme plugin
const withNextra = require('nextra')({
theme: 'nextra-theme-docs',
themeConfig: './theme.config.tsx',
})
// Export the configuration
module.exports = withNextra()
themeConfig: This line connects the Mechanic to the Designer. It points to the visual settings file.CITATION.cff)In Chapter 8: Content Structure - Research & Papers, we discussed the importance of academic citations.
This project is often used by scientists. They need a standard way to cite it. The CITATION.cff file provides this metadata in a machine-readable format.
CITATION.cffcff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Saravia"
given-names: "Elvis"
title: "Prompt Engineering Guide"
url: "https://github.com/dair-ai/Prompt-Engineering-Guide"
Why is this useful? GitHub detects this file automatically. On the repository homepage, it creates a specialized "Cite this repository" button. A researcher can click it and get the citation in APA or BibTeX format instantly.
.github/workflows)This is the most "magical" part of the configuration. These are CI/CD (Continuous Integration / Continuous Deployment) files.
Think of this as a robot butler that lives inside GitHub. Every time you save a file (push code), the robot wakes up and checks your work.
Common Workflow: The "Deploy" Robot
main branch..github/workflows/ci.yml (Simplified)name: CI Process
on: [push] # Trigger: When code is pushed
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install Dependencies
run: npm install
- name: Build Website
run: npm run build
on: [push]: This is the "Start Button."run: npm run build: The robot runs the build command to make sure you didn't break the site. If this fails, you get an email alert.In this chapter, we explored the Configuration Files.
theme.config.tsx: Changes the visuals (Logo, Links).next.config.js: Connects the tools together.CITATION.cff: Helps researchers cite the guide.We have configured the English version of the site perfectly. But the internet is global. How do we make this guide accessible to people who speak Spanish, Chinese, or Portuguese?
Next Chapter: Internationalization (i18n)
Generated by Code IQ