Skip to content

chriskyfung/amp-affiliately-jekyll-theme-shared-frontmatter-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

⚙ Shared Front Matter CMS Configurations for AMP Affiliately Jekyll Theme

GitMCP GitHub last commit

This repository provides a standardized and shared set of Front Matter CMS configurations specifically designed for projects utilizing the AMP Affiliately Jekyll Theme. By integrating this repository as a Git submodule, you can centralize your CMS settings, ensuring consistency and ease of management across multiple Jekyll sites.

✨ Features & Benefits

  • Centralized Configuration: Manage all your Front Matter CMS settings from a single source.
  • Consistency Across Projects: Ensure all your AMP Affiliately Jekyll Theme projects use the same CMS configurations.
  • Simplified Updates: Update configurations once in this repository, then easily sync across all linked projects.
  • Improved Collaboration: Streamline development workflows when multiple team members are working on different sites sharing the same structure.

🚀 Parent Project: AMP Affiliately Jekyll Theme

This shared configuration is built to complement the AMP Affiliately Jekyll Theme. This theme is an AMP-ready Jekyll theme that prioritizes performance and mobile-friendliness, and can be easily installed as a remote theme. It offers deep integration with Front Matter CMS for a seamless editing experience within VS Code. 👨‍💻

⚡ What is AMP?

AMP (Accelerated Mobile Pages) is an open-source initiative designed to enable the creation of websites and ads that are consistently fast, beautiful, and high-performing across devices and distribution platforms. Learn more at the official AMP Project website ↗.

🛠️ Installation Guide

To integrate these shared configurations into your existing AMP Affiliately Jekyll Theme project, follow these steps:

Prerequisites

Before proceeding, ensure you have:

  • An existing Jekyll project using the AMP Affiliately Jekyll Theme.
  • Git installed and configured.
  • Familiarity with Git submodules.

Step 1: Remove Existing Configurations (If Applicable)

If your existing project already contains a .frontmatter/config directory with local configurations, it is recommended to remove it before adding the shared submodule to avoid conflicts. This step effectively extracts your local .frontmatter/config into this shared submodule approach.

# Navigate to your original project repository
cd /path/to/your-original-project

# Remove the local configuration directory and commit the change
git rm -r .frontmatter/config
git commit -m "chore: extract .frontmatter/config to shared submodule"
git push

Step 2: Add Shared Configuration as a Git Submodule

Add this repository as a Git submodule, ensuring it is mounted at the exact path .frontmatter/config where Front Matter CMS expects to find its configuration files.

# From your project root, add the submodule
git submodule add https://github.com/chriskyfung/amp-affiliately-jekyll-theme-shared-frontmatter-config.git .frontmatter/config

# Commit the submodule reference to your project
git commit -m "chore(frontmatter): add shared cms config as submodule"
git push

Upon successful execution, your project's .gitmodules file will be updated to reflect the new submodule:

[submodule ".frontmatter/config"]
    path = .frontmatter/config
    url = https://github.com/chriskyfung/amp-affiliately-jekyll-theme-shared-frontmatter-config.git

Step 3: (Optional) Bulk Migration Script

For managing multiple projects, you can automate the submodule integration using a script. This example demonstrates how to add the shared configuration to several projects:

for project in project-a project-b project-c; do
  cd $project
  git submodule add https://github.com/chriskyfung/amp-affiliately-jekyll-theme-shared-frontmatter-config.git .frontmatter/config
  git commit -m "chore(frontmatter): add shared cms config submodule"
  git push
  cd .. # Navigate back to the parent directory if iterating
done

Result: All specified projects will now reference the same configuration files via Git submodule pointers. To synchronize updates from this shared repository, simply run git submodule update --remote within each project.

Step 4: Verify Installation

Confirm that the shared configurations are correctly detected by Front Matter CMS:

  1. Clone with Submodules: If cloning a fresh project that uses this submodule, ensure you initialize and update submodules:

    git clone --recurse-submodules https://github.com/your-org/project.git
    # OR, if cloned without --recurse-submodules:
    git submodule update --init --recursive
  2. Open in VS Code: Launch VS Code and open your project.

  3. Check Front Matter Settings: Within VS Code, open the Front Matter CMS extension and navigate to its settings. You should observe that the configurations from .frontmatter/config are now loaded and available.

📚 Usage & Front Matter Variables

➡️ Extending Configurations in frontmatter.json

Beyond direct integration via Git submodules, you can also extend these shared configurations within your project's frontmatter.json file. This approach is useful when you want to combine the shared settings with your own project-specific configurations, or when you only want to pick a subset of the shared configuration.

To extend the base.config.json from this submodule, add the extends key to your frontmatter.json file, pointing to the relative path of the shared configuration file:

{
  "extends": "./.frontmatter/config/content/base.config.json",
  // Your project-specific configurations go here
  "frontMatter.content.pageFolders": [
    {
      "title": "Posts",
      "path": "[[workspace]]/posts"
    },
    {
      "title": "Pages",
      "path": "[[workspace]]/pages"
    }
  ]
}

For comprehensive guidance on using Front Matter variables for posts, pages, and other content types within the AMP Affiliately Jekyll Theme, please refer to the official [**Front Matter Guide**](https://chriskyfung.github.io/amp-affiliately-jekyll-theme/front-matter-guide/) ↗.

---

## 🤝 Contributing

We welcome contributions to enhance these shared configurations. Bug reports and pull requests are encouraged on [GitHub](https://github.com/chriskyfung/amp-affiliately-jekyll-theme-shared-frontmatter-config/) ↗. This project adheres to the [Contributor Covenant](http://contributor-covenant.org) ↗ code of conduct, fostering a safe and welcoming space for collaboration.

To submit a pull request:

1.  **Fork** and clone the repository.
2.  **Create a new branch** from `main` for your changes.
3.  **Develop** your features or bug fixes.
4.  **Open a pull request** on GitHub, providing a clear description of your changes.

## 💗 Support My Work

If you find this project helpful and would like to support the ongoing development of the AMP Affiliately Jekyll Theme and its related tools, consider buying me a coffee!

<a href="https://www.buymeacoffee.com/chrisfungky"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" target="_blank"></a>

## ⚖️ License

This project is open-source and available under the terms of the [MIT License](https://opensource.org/licenses/MIT) ↗. This aligns with the license of its [upstream parent theme](https://github.com/chriskyfung/amp-affiliately-jekyll-theme/blob/main/LICENSE).