# Customize Here we will give you some tips on how to customize the website. One important thing to note is that **ALL** the changes you make should be done on the **main** branch of your repository. The `gh-pages` branch is automatically overwritten every time you make a change to the main branch. > **Note for users without coding experience:** You do **not** need to understand the technology stack or have any coding background to create and customize your own website with al-folio. This template was specifically designed to be accessible to academics and researchers from all backgrounds. You can create a fully functional website by simply editing configuration files and adding content in Markdown, no coding required. - [Customize](#customize) - [Project structure](#project-structure) - [Configuration](#configuration) - [GitHub Copilot Customization Agent](#github-copilot-customization-agent) - [What the Agent Can Help With](#what-the-agent-can-help-with) - [How to Use the Agent](#how-to-use-the-agent) - [Important: Verify Agent Output](#important-verify-agent-output) - [Understanding the Codebase with Code Wiki and DeepWiki](#understanding-the-codebase-with-code-wiki-and-deepwiki) - [What are these tools?](#what-are-these-tools) - [When to use them](#when-to-use-them) - [Technology Stack](#technology-stack) - [Frontend](#frontend) - [Backend](#backend) - [Build and Deployment](#build-and-deployment) - [Key Integration Points](#key-integration-points) - [Modifying the CV information](#modifying-the-cv-information) - [RenderCV Format (Recommended)](#rendercv-format-recommended) - [JSONResume Format](#jsonresume-format) - [Using Both Formats Simultaneously](#using-both-formats-simultaneously) - [Automatic PDF Generation (RenderCV only)](#automatic-pdf-generation-rendercv-only) - [Modifying the user and repository information](#modifying-the-user-and-repository-information) - [Configuring external service URLs](#configuring-external-service-urls) - [Creating new pages](#creating-new-pages) - [Creating new blog posts](#creating-new-blog-posts) - [Creating new projects](#creating-new-projects) - [Adding some news](#adding-some-news) - [Adding Collections](#adding-collections) - [Creating a new collection](#creating-a-new-collection) - [Using frontmatter fields in your collection](#using-frontmatter-fields-in-your-collection) - [Creating a teachings collection](#creating-a-teachings-collection) - [Course file format](#course-file-format) - [Important course collection notes](#important-course-collection-notes) - [Required fields](#required-fields) - [Optional fields](#optional-fields) - [Collections with categories and tags](#collections-with-categories-and-tags) - [Creating custom metadata groups and archive pages](#creating-custom-metadata-groups-and-archive-pages) - [Understanding Jekyll's special handling of fields](#understanding-jekylls-special-handling-of-fields) - [Example: Adding a custom "adaptations" field](#example-adding-a-custom-adaptations-field) - [Field naming best practices](#field-naming-best-practices) - [Complete example: Book reviews with custom adaptations field](#complete-example-book-reviews-with-custom-adaptations-field) - [Adding a new publication](#adding-a-new-publication) - [Author annotation](#author-annotation) - [Buttons (through custom bibtex keywords)](#buttons-through-custom-bibtex-keywords) - [Changing theme color](#changing-theme-color) - [Customizing layout and UI](#customizing-layout-and-ui) - [Adding social media information](#adding-social-media-information) - [Adding a newsletter](#adding-a-newsletter) - [Configuring search features](#configuring-search-features) - [Social media previews](#social-media-previews) - [How to enable](#how-to-enable) - [Configuring preview images](#configuring-preview-images) - [Preview image best practices](#preview-image-best-practices) - [Related posts](#related-posts) - [How it works](#how-it-works) - [Configuration](#configuration-1) - [Disable related posts for a specific post](#disable-related-posts-for-a-specific-post) - [Additional configuration in _config.yml](#additional-configuration-in-_configyml) - [Managing publication display](#managing-publication-display) - [Adding a Google Calendar](#adding-a-google-calendar) - [Basic usage](#basic-usage) - [Enable the calendar script for your page](#enable-the-calendar-script-for-your-page) - [Optional: Customize the calendar style](#optional-customize-the-calendar-style) - [Updating third-party libraries](#updating-third-party-libraries) - [Removing content](#removing-content) - [Removing the blog page](#removing-the-blog-page) - [Removing the news section](#removing-the-news-section) - [Removing the projects page](#removing-the-projects-page) - [Removing the publications page](#removing-the-publications-page) - [Removing the repositories page](#removing-the-repositories-page) - [You can also remove pages through commenting out front-matter blocks](#you-can-also-remove-pages-through-commenting-out-front-matter-blocks) - [Adding Token for Lighthouse Badger](#adding-token-for-lighthouse-badger) - [Personal Access Token (fine-grained) Permissions for Lighthouse Badger:](#personal-access-token-fine-grained-permissions-for-lighthouse-badger) - [Customizing fonts, spacing, and more](#customizing-fonts-spacing-and-more) - [Scheduled Posts](#scheduled-posts) - [Name Format](#name-format) - [Important Notes](#important-notes) - [GDPR Cookie Consent Dialog](#gdpr-cookie-consent-dialog) - [How it works](#how-it-works-1) - [When to use](#when-to-use) - [How to enable](#how-to-enable-1) - [Customizing the consent dialog](#customizing-the-consent-dialog) - [Supported analytics providers](#supported-analytics-providers) - [How it integrates with analytics](#how-it-integrates-with-analytics) - [For developers](#for-developers) - [Setting up a Personal Access Token (PAT) for Google Scholar Citation Updates](#setting-up-a-personal-access-token-pat-for-google-scholar-citation-updates) - [Why is a PAT required?](#why-is-a-pat-required) - [How to set up the PAT](#how-to-set-up-the-pat) ## Project structure The project is structured as follows, focusing on the main components that you will need to modify: ```txt . βββ π assets/: contains the assets that are displayed in the website βΒ Β βββ π json/ βΒ Β βββ π resume.json: CV in JSON format (https://jsonresume.org/) βββ π _bibliography/ βΒ Β βββ π papers.bib: bibliography in BibTeX format βββ π _books/: contains the bookshelf pages βββ π _config.yml: the configuration file of the template βββ π _data/: contains some of the data used in the template βΒ Β βββ π cv.yml: CV in YAML format, used when assets/json/resume.json is not found βΒ Β βββ π repositories.yml: users and repositories info in YAML format βΒ Β βββ π socials.yml: your social media and contact info in YAML format βββ π _includes/: contains code parts that are included in the main HTML file βΒ Β βββ π news.liquid: defines the news section layout in the about page βββ π _layouts/: contains the layouts to choose from in the frontmatter of the Markdown files βββ π _news/: the news that will appear in the news section in the about page βββ π _pages/: contains the pages of the website | βββ π 404.md: 404 page (page not found) βββ π _posts/: contains the blog posts βββ π _projects/: contains the projects βββ π _sass/: contains the SASS files that define the style of the website βββ π font-awesome/: contains the SCSS files for Font Awesome βββ π _blog.scss: blog post, tags, and pagination styles βββ π _components.scss: reusable component styles (cards, profiles, CV, projects) βββ π _cv.scss: style of the CV page βββ π _distill.scss: style of the Distill articles βββ π _footer.scss: footer styles βββ π _layout.scss: overall layout styles βββ π _navbar.scss: navigation bar and dropdown menu styles βββ π _publications.scss: publication list and bibliography styles βββ π _tabs.scss: tabbed content styles βββ π _teachings.scss: course and teaching styles βββ π _themes.scss: theme colors and icons βββ π _typograms.scss: typogram diagram styles βββ π _typography.scss: text, headings, links, tables, and blockquote styles βββ π _utilities.scss: utility styles (code highlighting, forms, modals, animations) βββ π _variables.scss: variables used in the SASS files ``` ## Configuration The configuration file [\_config.yml](_config.yml) contains the main configuration of the website. Most of the settings is self-explanatory and we also tried to add as much comments as possible. If you have any questions, please check if it was not already answered in the [FAQ](FAQ.md). > Note that the `url` and `baseurl` settings are used to generate the links of the website, as explained in the [install instructions](INSTALL.md). All changes made to this file are only visible after you rebuild the website. That means that you need to run `bundle exec jekyll serve` again if you are running the website locally or push your changes to GitHub if you are using GitHub Pages. All other changes are visible immediately, you only need to refresh the page. If changes don't appear after refreshing, try: - **Hard refresh** to reload the page ignoring cached content: - [Shift + F5 on Chromium-based browsers](https://support.google.com/chrome/answer/157179#zippy=%2Cwebpage-shortcuts) - [Ctrl + F5 on Firefox-based browsers](https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-quickly) - **Clear your browser cache** completely - **Use a private/incognito session** to ensure no cached content: - [Chrome](https://support.google.com/chrome/answer/95464) - [Firefox](https://support.mozilla.org/en-US/kb/private-browsing-use-firefox-without-history) ## GitHub Copilot Customization Agent This repository includes a specialized GitHub Copilot agent (`.github/agents/customize.agent.md`) designed to help you customize your al-folio website. The agent acts as an expert assistant that can: - Guide you through common customization tasks step-by-step - Modify configuration files, add content, and update your website - Explain technical concepts in plain language (especially helpful if you're not familiar with Jekyll or web development) - Apply changes directly to your repository files - Answer questions about how to customize specific features ### What the Agent Can Help With The customization agent can assist with tasks such as: - Changing basic site information (title, author name, contact details) - Updating your CV or resume - Adding and managing publications from BibTeX files - Creating blog posts, projects, and news items - Customizing theme colors and styling - Managing social media links - Enabling or disabling features in `_config.yml` - Adding profile pictures and other assets - Troubleshooting configuration issues ### How to Use the Agent To use the customization agent: 1. Ensure you have a [GitHub Copilot](https://github.com/features/copilot) subscription 2. Open your repository in an editor with GitHub Copilot support (such as VS Code with the GitHub Copilot extension) 3. Interact with GitHub Copilot and ask questions or request changes. For more information, check [Using custom agents in your IDE](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/use-copilot-agents/coding-agent/create-custom-agents#using-custom-agents-in-your-ide) 4. The agent will guide you through the customization process and can make changes directly to your files For example, you can ask: - "How do I change my website's theme color to blue?" - "Help me add a new blog post about my research" - "Update my profile information with my new university email" - "How do I add a publication to my website?" The agent is designed to be patient and helpful, explaining each step clearly so you understand what's being changed and why. ### Important: Verify Agent Output **The customization agent can make mistakes or produce incorrect information.** Always review and verify the agent's suggestions and changes before applying them to your repository: - **Review all changes** β Before applying any modifications, carefully read what the agent suggests and ensure it makes sense for your needs - **Test locally first** β Before pushing changes to GitHub, test them locally using Docker or native setup (see the [Installation instructions](INSTALL.md)) - **Check syntax** β Make sure any YAML, Markdown, or BibTeX files have correct syntax. Incorrect syntax can break your website - **Verify configuration** β If the agent modifies `_config.yml` or other configuration files, check that the changes align with your intentions - **Preview on your site** β Run your site locally and navigate through it to ensure everything displays correctly and works as expected - **Don't blindly apply changes** β Understand what's being changed and why before committing to your repository **Example scenarios where verification is important:** - If the agent suggests a BibTeX entry, verify the syntax matches existing entries in your `_bibliography/papers.bib` file - If the agent modifies your `_config.yml`, check that indentation is correct (YAML is very sensitive to spacing) - If the agent creates a new blog post or page, verify the frontmatter (the metadata at the top) is correct - If the agent suggests changes to theme colors or styling, preview your site locally to ensure the changes look as intended > **Note:** The customization agent requires GitHub Copilot to be enabled. For more information about GitHub Copilot and its features, see the [GitHub Copilot documentation](https://docs.github.com/en/copilot). ## Understanding the Codebase with Code Wiki and DeepWiki If you're interested in learning more about how al-folio works under the hood, or want to understand specific aspects of the codebase for deeper customization, you can use Code Wiki and DeepWiki as supplementary resources. ### What are these tools? **Code Wiki** and **DeepWiki** are AI-powered tools that help you explore and understand GitHub repositories through interactive documentation: - **Code Wiki** (powered by Google Gemini) generates interactive documentation from the repository code. You can browse the project structure, search for specific functions or modules, view architecture diagrams, and understand how different components interact. - **DeepWiki** provides an AI chat interface where you can ask natural language questions about the codebase, similar to having an engineer available 24/7. You can ask how features work, search for code patterns, or get explanations of complex logic. ### When to use them Use Code Wiki and DeepWiki **only after**: - You have reviewed the relevant sections in this `CUSTOMIZE.md` file - You have checked the [project structure](#project-structure) section above - You have explored the [main documentation files](README.md) (README.md, INSTALL.md, FAQ.md) - You have checked the [GitHub Discussions Q&A section](https://github.com/alshedivat/al-folio/discussions/categories/q-a) These tools are best used for: - Understanding the architecture and how different parts of the codebase work together - Finding where specific functionality is implemented - Learning about the Jekyll template structure and Liquid syntax used in the theme - Exploring how specific features are implemented (e.g., how publications are rendered, how search works, etc.) **Access these tools:** - **Code Wiki**: [Code Wiki for al-folio](https://codewiki.google/github.com/alshedivat/al-folio) - **DeepWiki**: [DeepWiki for al-folio](https://deepwiki.com/alshedivat/al-folio) ## Technology Stack Understanding al-folio's technology stack will help you better customize and extend the theme. This section provides an overview of the key technologies and frameworks used in the project. ### Frontend - **Markdown**: Content is written in Markdown format for pages, blog posts, and collections. This makes it easy to create and maintain content without worrying about HTML. - **Liquid templating**: [Liquid](https://shopify.github.io/liquid/) is used for dynamic template generation. Liquid templates are used in the `_layouts/` and `_includes/` directories to define how your content should be displayed. - **HTML & CSS**: The theme uses semantic HTML5 and modern CSS for styling and layout. - **SCSS**: Stylesheets are written in [SCSS (Sass)](https://sass-lang.com/), a CSS preprocessor that provides variables, mixins, and functions for more maintainable styling. SCSS files are located in `_sass/` and compiled to CSS during the build process. - **Bootstrap**: [Bootstrap 4.6](https://getbootstrap.com/docs/4.6/) is used for responsive grid layout and base styling components. - **JavaScript**: Minimal JavaScript is used for interactive features like the dark mode toggle, search functionality, and dynamic content rendering. - **MathJax**: For rendering mathematical equations in LaTeX format on your pages and blog posts. - **Mermaid**: For creating diagrams (flowcharts, sequence diagrams, etc.) directly in Markdown. - **Font Awesome, Academicons, and Scholar Icons**: Icon libraries used throughout the theme for visual elements. ### Backend - **Jekyll 4.x**: [Jekyll](https://jekyllrb.com/) is a static site generator written in Ruby that transforms your Markdown files and templates into a static website. Jekyll is used to: - Convert Markdown files to HTML - Process Liquid templates - Manage collections (posts, projects, news, books, etc.) - Generate archives and pagination - Minify CSS and JavaScript - **Ruby Gems** (Jekyll plugins): The project uses several Ruby plugins to extend Jekyll's functionality: - `classifier-reborn`: Used for categorizing and finding related blog posts - `jekyll-archives-v2`: Creates archive pages for posts and collections organized by category, tag, or date - `jekyll-feed`: Generates an Atom (RSS-like) feed for your content - `jekyll-jupyter-notebook`: Integrates Jupyter notebooks into your site - `jekyll-minifier`: Minifies HTML, CSS, and JavaScript for better performance - `jekyll-paginate-v2`: Handles pagination for blog posts and archives - `jekyll-scholar`: Manages bibliography files (BibTeX) and generates publication pages with citations - `jekyll-tabs`: Adds tabbed content support - `jekyll-toc`: Automatically generates table of contents for pages with headers - `jemoji`: Converts emoji shortcodes to emoji images - Other utilities: `jekyll-link-attributes`, `jekyll-imagemagick`, `jekyll-twitter-plugin`, `jekyll-get-json`, and more - **Python**: Used for utility scripts like citation updates via Google Scholar (located in `bin/`) ### Build and Deployment - **GitHub Actions**: Automated workflows for building, testing, and deploying your site. Workflows are defined in `.github/workflows/`: - **Deploy**: Automatically builds and deploys your site to GitHub Pages when you push changes to the main branch - **Link checking**: Validates that all links in your site are not broken - **Code formatting**: Ensures code follows the Prettier code style - **Accessibility testing**: Checks for accessibility issues using Axe - **Lighthouse**: Measures site performance and best practices - **Citation updates**: Automatically fetches citation counts from Google Scholar - **GitHub Pages**: Free hosting for your static website built by Jekyll - **Docker**: Optional containerization for local development (provides a consistent environment across different machines) - **Prettier**: Code formatter for Markdown, YAML, and Liquid files to maintain consistent formatting ### Key Integration Points Understanding how these technologies work together will help you customize al-folio effectively: 1. **Content Creation**: Write content in Markdown 2. **Template Processing**: Jekyll processes Markdown through Liquid templates 3. **Styling**: SCSS files are compiled to CSS, with Bootstrap providing the responsive layout framework 4. **Bibliography**: BibTeX files are processed by jekyll-scholar to generate publication pages 5. **Static Site Generation**: Jekyll builds all files into static HTML 6. **Deployment**: GitHub Actions automatically deploys the built site to GitHub Pages ## Modifying the CV information Your CV can be created using one of two formats. Choose the format that works best for you, or use both simultaneously by switching between them: ### RenderCV Format (Recommended) [`_data/cv.yml`](_data/cv.yml) uses the [RenderCV](https://rendercv.com/) YAML format, which is human-readable and designed specifically for generating professional resumes. This format also enables optional automatic PDF generation via GitHub Actions. **If you choose this format:** 1. Edit your CV data in [`_data/cv.yml`](_data/cv.yml) 2. Optionally customize how the PDF is styled by editing: - [`assets/rendercv/design.yaml`](assets/rendercv/design.yaml) β Design and styling - [`assets/rendercv/locale.yaml`](assets/rendercv/locale.yaml) β Localization and formatting - [`assets/rendercv/settings.yaml`](assets/rendercv/settings.yaml) β RenderCV settings 3. To display only this format, delete [`assets/json/resume.json`](assets/json/resume.json) (optional) ### JSONResume Format [`assets/json/resume.json`](assets/json/resume.json) uses the [JSONResume](https://jsonresume.org/) standard format, which is compatible with other tools and services. **If you choose this format:** 1. Edit your CV data in [`assets/json/resume.json`](assets/json/resume.json) 2. To display only this format, delete [`_data/cv.yml`](_data/cv.yml) (optional) ### Using Both Formats Simultaneously You can keep both [`_data/cv.yml`](_data/cv.yml) and [`assets/json/resume.json`](assets/json/resume.json) in your repository and switch between them on your website by setting the `cv_format` frontmatter variable in [`_pages/cv.md`](_pages/cv.md): ```yaml --- layout: cv cv_format: rendercv # options: rendercv or jsonresume --- ``` Change `rendercv` to `jsonresume` to display the JSONResume format instead. ### Automatic PDF Generation (RenderCV only) If you use the RenderCV format, a GitHub Actions workflow can automatically generate a PDF version of your CV whenever you push changes to [`_data/cv.yml`](_data/cv.yml). The PDF is saved to `assets/rendercv/rendercv_output/`. **To link the auto-generated PDF to your CV page:** Set the `cv_pdf` variable in the frontmatter of [`_pages/cv.md`](_pages/cv.md) to point to the generated PDF: ```yaml --- layout: cv cv_pdf: /assets/rendercv/rendercv_output/CV.pdf cv_format: rendercv --- ``` This will add a download button on your CV page that links to the PDF. (The exact filename depends on your RenderCV settingsβcheck the output directory after the first workflow run to see the generated PDF name.) **To disable automatic PDF generation:** Delete or comment out the [`.github/workflows/render-cv.yml`](.github/workflows/render-cv.yml) workflow file. ## Modifying the user and repository information The user and repository information is defined in [\_data/repositories.yml](_data/repositories.yml). You can add as many users and repositories as you want. Both informations are used in the `repositories` section. ### Configuring external service URLs The repository page uses external services to display GitHub statistics and trophies. By default, these are: - `github-readme-stats.vercel.app` for user stats and repository cards - `github-profile-trophy.vercel.app` for GitHub profile trophies **Important:** These default services are hosted by third parties and may not be available 100% of the time. For better reliability, privacy, and customization, you can self-host these services and configure your website to use your own instances. To use your own instances of these services, configure the URLs in [\_config.yml](_config.yml): ```yaml external_services: github_readme_stats_url: https://github-readme-stats.vercel.app github_profile_trophy_url: https://github-profile-trophy.vercel.app ``` To self-host these services, follow the deployment instructions in their respective repositories: - [github-readme-stats](https://github.com/anuraghazra/github-readme-stats) - [github-profile-trophy](https://github.com/ryo-ma/github-profile-trophy) Once deployed, update the URLs above to point to your custom deployment. ## Creating new pages You can create new pages by adding new Markdown files in the [\_pages](_pages/) directory. The easiest way to do this is to copy an existing page and modify it. You can choose the layout of the page by changing the [layout](https://jekyllrb.com/docs/layouts/) attribute in the [frontmatter](https://jekyllrb.com/docs/front-matter/) of the Markdown file, and also the path to access it by changing the [permalink](https://jekyllrb.com/docs/permalinks/) attribute. You can also add new layouts in the [\_layouts](_layouts/) directory if you feel the need for it. ## Creating new blog posts To create a new blog post, you can add a new Markdown file in the [\_posts](_posts/) directory, which is the [default location for posts in Jekyll](https://jekyllrb.com/docs/posts/). The [name of the file must follow](https://jekyllrb.com/docs/posts/#creating-posts) the format `YYYY-MM-DD-title.md`. The easiest way to do this is to copy an existing blog post and modify it. Note that some blog posts have optional fields in the [frontmatter](https://jekyllrb.com/docs/front-matter/) that are used to enable specific behaviors or functions. If you want to create blog posts that are not ready to be published, but you want to track it with git, you can create a [\_drafts](https://jekyllrb.com/docs/posts/#drafts) directory and store them there. Note that `posts` is also a collection, but it is a default collection created automatically by Jekyll. To access the posts, you can use the `site.posts` variable in your templates. ## Creating new projects You can create new projects by adding new Markdown files in the [\_projects](_projects/) directory. The easiest way to do this is to copy an existing project and modify it. ## Adding some news You can add news in the about page by adding new Markdown files in the [\_news](_news/) directory. There are currently two types of news: inline news and news with a link. News with a link take you to a new page while inline news are displayed directly in the about page. The easiest way to create yours is to copy an existing news and modify it. ## Adding Collections This Jekyll theme implements [collections](https://jekyllrb.com/docs/collections/) to let you break up your work into categories. The theme comes with three default collections: `news`, `projects`, and `books`. Items from the `news` collection are automatically displayed on the home page, while items from the `projects` collection are displayed on a responsive grid on the projects page, and items from the `books` collection are displayed on its own `bookshelf` page inside `submenus`. You can easily create your own collections for any type of contentβteaching materials, courses, apps, short stories, or whatever suits your needs. ### Creating a new collection To create a new collection, follow these steps. We will create a `courses` collection, but you can replace `courses` with any name you prefer: 1. **Add the collection to `_config.yml`** Open the `collections` section in [\_config.yml](_config.yml) and add your new collection: ```yaml collections: news: defaults: layout: post output: true projects: output: true courses: output: true permalink: /courses/:path/ ``` - `output: true` makes the collection items accessible as separate pages - `permalink` defines the URL path for each collection item (`:path` is replaced with the filename) - Note: You can customize the [permalink structure](https://jekyllrb.com/docs/permalinks/#collections) as needed. If not set, it uses `/COLLECTION_NAME/:name/`. 2. **Create a folder for your collection items** Create a new folder in the root directory with an underscore prefix, matching your collection name. For a `courses` collection, create `_courses/`: ```text _courses/ βββ course_1.md βββ course_2.md βββ course_3.md ``` 3. **Create a landing page for your collection** Add a Markdown file in `_pages/` (e.g., `courses.md`) that will serve as the main page for your collection. You can use [\_pages/projects.md](_pages/projects.md) or [\_pages/books.md](_pages/books.md) as a template and adapt it for your needs. In your landing page, access your collection using the `site.COLLECTION_NAME` variable: ```liquid {% assign course_items = site.courses | sort: 'date' | reverse %} {% for item in course_items %}
{{ item.content }}
{% endfor %} ``` 4. **Add a navigation link to your collection page** Update [\_pages/dropdown.md](_pages/dropdown.md) or the navigation configuration of your page. In the frontmatter of your collection landing page (e.g., `_pages/courses.md`), add: ```yaml nav: true nav_order: 5 ``` - `nav: true` makes the page appear in the navigation menu - `nav_order` sets the position in the menu (1 = first, 2 = second, etc.) 5. **Create collection items** Add Markdown files in your new collection folder (e.g., `_courses/`) with appropriate frontmatter and content. For more information regarding collections, check [Jekyll official documentation](https://jekyllrb.com/docs/collections/) and [step-by-step guide](https://jekyllrb.com/docs/step-by-step/09-collections/). ### Using frontmatter fields in your collection When creating items in your collection, you can define custom frontmatter fields and use them in your landing page. For example: ```markdown --- layout: page title: Introduction to Research Methods importance: 1 category: methods --- Course description and content here... ``` Then in your landing page template: ```liquid {% if item.category == 'methods' %} {{ item.category }} {% endif %} ``` ### Creating a teachings collection The al-folio theme includes a pre-configured `_teachings/` collection for course pages. Each course is represented by a markdown file with frontmatter metadata. Here's how to add or modify courses: #### Course file format Create markdown files in `_teachings/` with the following structure: ```yaml --- layout: course title: Course Title description: Course description instructor: Your Name year: 2023 term: Fall location: Room 101 time: MWF 10:00-11:00 course_id: course-id # This should be unique schedule: - week: 1 date: Jan 10 topic: Introduction description: Overview of course content and objectives materials: - name: Slides url: /assets/pdf/example_pdf.pdf - name: Reading url: https://example.com/reading - week: 2 date: Jan 17 topic: Topic 2 description: Description of this week's content --- Additional course content, information, or resources can be added here as markdown. ``` #### Important course collection notes 1. Each course file must have a unique `course_id` in the frontmatter 2. Course files will be grouped by `year` on the teaching page 3. Within each year, courses are sorted by `term` 4. The content below the frontmatter (written in markdown) will appear on the individual course page 5. The schedule section will be automatically formatted into a table #### Required fields - `layout: course` β Must be set to use the course layout - `title` β The course title - `year` β The year the course was/will be taught (used for sorting) - `course_id` β A unique identifier for the course #### Optional fields - `description` β A brief description of the course - `instructor` β The course instructor's name - `term` β The academic term (e.g., Fall, Spring, Summer) - `location` β The course location - `time` β The course meeting time - `schedule` β A list of course sessions with details ### Collections with categories and tags If you want to add category and tag support (like the blog posts have), you need to configure the `jekyll-archives` section in [\_config.yml](_config.yml). See how this is done with the `books` collection for reference. For more details, check the [jekyll-archives-v2 documentation](https://george-gca.github.io/jekyll-archives-v2/). ### Creating custom metadata groups and archive pages Beyond the built-in `categories` and `tags` fields, you can create custom metadata fields for your collections to organize content in new ways. For example, if you have a book review collection, you might want to organize books by their **adaptations** (movies, TV shows, video games, etc.). #### Understanding Jekyll's special handling of fields Jekyll has **special built-in support** for only two fields: - **`categories`** β Automatically splits space-separated values into arrays - **`tags`** β Automatically splits space-separated values into arrays Custom fields (any field name you create) remain as **strings** and require explicit handling in your Liquid templates. #### Example: Adding a custom "adaptations" field 1. **Add the field to your collection frontmatter** In your collection item (e.g., `_books/the_godfather.md`): ```yaml --- layout: book-review title: The Godfather author: Mario Puzo categories: classics crime historical-fiction adaptations: movie TV-series video-game novel-adaptation --- ``` 2. **Handle the custom field in your layout template** In your layout file (e.g., `_layouts/book-review.liquid`), custom fields must be **split** into arrays before you can loop over them: ```liquid {% if page.adaptations %} {% assign page_adaptations = page.adaptations | split: ' ' %} {% for adaptation in page_adaptations %} {{ adaptation }} {% endfor %} {% endif %} ``` **Why the `split: ' '` filter?** Because `adaptations` is a custom field, Jekyll doesn't automatically convert it to an array like it does for `categories` and `tags`. The `split: ' '` filter breaks the space-separated string into individual items. 3. **Enable archive pages for your custom field** Add your custom field to the `jekyll-archives` configuration in [\_config.yml](_config.yml): ```yaml jekyll-archives: posts: enabled: - year - tags - categories books: enabled: - year - tags - categories - adaptations # Add your custom field here permalinks: year: "/:collection/:year/" tags: "/:collection/:type/:name/" categories: "/:collection/:type/:name/" adaptations: "/:collection/:type/:name/" # Add permalink pattern here ``` 4. **Test your archive pages** After configuration, rebuild your site: ```bash docker compose down docker compose up ``` Your archive pages will be generated at: - `/books/adaptations/movie/` - `/books/adaptations/tv-series/` (slugified from `TV-series`) - `/books/adaptations/video-game/` (slugified from `video-game`) Each page will automatically display all items with that adaptation value. #### Field naming best practices - Use **lowercase** words separated by **hyphens** for multi-word values: `live-action`, `video-game`, `TV-series` - Choose **meaningful names** that describe the grouping: `genres`, `adaptations`, `media-types`, `settings`, etc. - Keep field values **short and consistent** across all items in your collection - Document custom fields in a README or comments for other contributors to understand #### Complete example: Book reviews with custom adaptations field **File: `_books/the_godfather.md`** ```yaml --- layout: book-review title: The Godfather author: Mario Puzo categories: classics crime historical-fiction tags: top-100 adaptations: movie TV-series video-game --- ``` **File: `_layouts/book-review.liquid` (partial)** ```liquid {% if page.adaptations %}