jekyll_file_wizard 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +118 -0
- data/.vscode/settings.json +3 -0
- data/Gemfile +5 -0
- data/LICENSE +21 -0
- data/README.md +1006 -0
- data/Rakefile +0 -0
- data/bin/jekyll_file_wizard +13 -0
- data/docs/advanced_features.md +58 -0
- data/docs/api_reference.md +54 -0
- data/docs/configuration.md +59 -0
- data/docs/examples.md +46 -0
- data/docs/getting_started.md +68 -0
- data/docs/troubleshooting.md +48 -0
- data/docs/usage.md +77 -0
- data/examples/advanced_example/advanced_examples.md +91 -0
- data/examples/basic_example/basic_example.md +81 -0
- data/examples/config.yml +23 -0
- data/examples/data_integration_example/data_integration_example.md +86 -0
- data/jekyll_file_wizard.gemspec +28 -0
- data/lib/jekyll_file_wizard/configuration.rb +31 -0
- data/lib/jekyll_file_wizard/data_integrator.rb +0 -0
- data/lib/jekyll_file_wizard/html_updater.rb +0 -0
- data/lib/jekyll_file_wizard/version.rb +0 -0
- data/lib/jekyll_file_wizard.rb +42 -0
- data/lib/main.rb +23 -0
- data/templates/blog_section.html +4 -0
- metadata +120 -0
data/Rakefile
ADDED
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'jekyll_file_wizard'
|
3
|
+
|
4
|
+
config = JekyllFileWizard::Configuration.new
|
5
|
+
|
6
|
+
# Example: Load configuration from a file
|
7
|
+
config.load_from_file('path/to/config.yml')
|
8
|
+
|
9
|
+
# Create an instance of the main functionality class with the configuration
|
10
|
+
wizard = JekyllFileWizard::Main.new(config)
|
11
|
+
|
12
|
+
# Call methods on 'wizard' to perform the desired actions
|
13
|
+
JekyllFileWizard.run
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# Advanced Features of JekyllFileWizard
|
2
|
+
|
3
|
+
This document delves into the advanced features of the JekyllFileWizard gem. These features are designed to give users more control and flexibility over their Jekyll site management.
|
4
|
+
|
5
|
+
## Dynamic HTML Structure Handling
|
6
|
+
|
7
|
+
JekyllFileWizard can identify and update different sections in `index.html` and other HTML files dynamically. This feature is particularly useful for large-scale or complex Jekyll projects where manual updates can be time-consuming and error-prone.
|
8
|
+
|
9
|
+
### How It Works
|
10
|
+
|
11
|
+
- The gem uses Nokogiri to parse HTML files and identify sections based on specific criteria like IDs, classes, or HTML comments.
|
12
|
+
- Users can define these criteria in the configuration file or through the CLI.
|
13
|
+
- The gem then dynamically updates or adds sections according to the user's specifications.
|
14
|
+
|
15
|
+
## Configuration Options
|
16
|
+
|
17
|
+
JekyllFileWizard offers a variety of configuration options:
|
18
|
+
|
19
|
+
- **Selective Updating:** Choose which sections to update or add, and their placement in the HTML structure.
|
20
|
+
- **Feature Toggles:** Enable or disable specific functionalities as per your project needs.
|
21
|
+
|
22
|
+
### Configuring Your Project
|
23
|
+
|
24
|
+
To configure your project, edit the `config.yml` file in the root of your Jekyll site or specify options via the CLI. Example:
|
25
|
+
|
26
|
+
```yaml
|
27
|
+
update_sections:
|
28
|
+
- id: "blog-section"
|
29
|
+
enable: true
|
30
|
+
- class: "footer-links"
|
31
|
+
enable: false
|
32
|
+
```
|
33
|
+
|
34
|
+
## Template Management
|
35
|
+
|
36
|
+
JekyllFileWizard can manage different HTML templates or layouts. This feature simplifies the process of inserting complex or repetitive HTML structures into your site.
|
37
|
+
|
38
|
+
### Using Templates
|
39
|
+
|
40
|
+
- Place your HTML templates in the `templates` directory.
|
41
|
+
- Specify in the configuration which templates to use and where to insert them.
|
42
|
+
|
43
|
+
## Robust Error Handling
|
44
|
+
|
45
|
+
JekyllFileWizard is equipped with comprehensive error and exception handling mechanisms to manage issues such as missing files, invalid HTML, or permission problems.
|
46
|
+
|
47
|
+
### Error Reporting
|
48
|
+
|
49
|
+
- The gem logs detailed error messages, helping users quickly identify and resolve issues.
|
50
|
+
- In case of critical errors, the gem halts execution to prevent further issues.
|
51
|
+
|
52
|
+
## Conclusion
|
53
|
+
|
54
|
+
The advanced features of JekyllFileWizard are designed to provide a robust, flexible, and user-friendly experience for managing Jekyll sites. By leveraging these features, users can significantly streamline their site management process.
|
55
|
+
|
56
|
+
For more information on API reference, configuration details, and usage examples, refer to the corresponding documents in the `docs` folder.
|
57
|
+
|
58
|
+
[Back to Top](#advanced-features-of-jekyllfilewizard)
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# API Reference for JekyllFileWizard
|
2
|
+
|
3
|
+
This document provides a comprehensive reference to the application programming interface (API) of the JekyllFileWizard gem. It outlines the classes, methods, and their functionalities, offering a detailed guide for developers looking to extend or integrate the gem into their Jekyll projects.
|
4
|
+
|
5
|
+
## Overview
|
6
|
+
|
7
|
+
JekyllFileWizard is composed of several key classes, each responsible for a distinct aspect of Jekyll site management. The primary classes include:
|
8
|
+
|
9
|
+
1. **HtmlUpdater:** Manages the dynamic updating of HTML files.
|
10
|
+
2. **Configuration:** Handles the reading and application of configuration settings.
|
11
|
+
3. **DataIntegrator:** Integrates data from Jekyll's `_data` directory into HTML files.
|
12
|
+
|
13
|
+
## HtmlUpdater Class
|
14
|
+
|
15
|
+
This class is responsible for parsing and updating HTML files based on the given configuration and templates.
|
16
|
+
|
17
|
+
### Methods
|
18
|
+
|
19
|
+
- `update_section(html_file, section_id, content)`: Updates a specific section in an HTML file.
|
20
|
+
- `add_section(html_file, position, content)`: Adds a new section to an HTML file at the specified position.
|
21
|
+
|
22
|
+
## Configuration Class
|
23
|
+
|
24
|
+
Handles configuration options set by the user, either through a configuration file or via command-line arguments.
|
25
|
+
|
26
|
+
### Methods
|
27
|
+
|
28
|
+
- `load_config(file_path)`: Loads configuration settings from a specified YAML file.
|
29
|
+
- `get_setting(setting_name)`: Retrieves a specific configuration setting.
|
30
|
+
|
31
|
+
## DataIntegrator Class
|
32
|
+
|
33
|
+
Facilitates the integration of data from Jekyll's `_data` directory into the site's HTML structure.
|
34
|
+
|
35
|
+
### Methods
|
36
|
+
|
37
|
+
- `integrate_data(html_file, data_file)`: Integrates data from a specified YAML data file into an HTML file.
|
38
|
+
- `fetch_data(data_file, key)`: Fetches specific data from a YAML file based on a key.
|
39
|
+
|
40
|
+
## Version Module
|
41
|
+
|
42
|
+
Contains information about the current version of the gem.
|
43
|
+
|
44
|
+
### Constants
|
45
|
+
|
46
|
+
- `VERSION`: Holds the current version number of the JekyllFileWizard gem.
|
47
|
+
|
48
|
+
## Conclusion
|
49
|
+
|
50
|
+
The JekyllFileWizard API provides a robust and flexible way to manage and update Jekyll sites. By understanding and utilizing these classes and methods, developers can efficiently automate and enhance their Jekyll site management.
|
51
|
+
|
52
|
+
For further information on advanced features, configuration, and usage examples, refer to the corresponding documents in the `docs` folder.
|
53
|
+
|
54
|
+
[Back to Top](#api-reference-for-jekyllfilewizard)
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# Configuration Guide for JekyllFileWizard
|
2
|
+
|
3
|
+
This document provides detailed instructions on configuring the JekyllFileWizard gem for various use cases. It covers the configuration file structure, available options, and how to apply them effectively for customizing the behavior of the gem.
|
4
|
+
|
5
|
+
## Configuration File Structure
|
6
|
+
|
7
|
+
The configuration for JekyllFileWizard is managed through a YAML file, typically named `config.yml`. This file should be placed in the root directory of your Jekyll project. The structure of the file is as follows:
|
8
|
+
|
9
|
+
```yaml
|
10
|
+
# config.yml
|
11
|
+
html_update:
|
12
|
+
file: index.html
|
13
|
+
sections:
|
14
|
+
- id: "#welcome-section"
|
15
|
+
template: "templates/welcome.html"
|
16
|
+
- id: "#blog-section"
|
17
|
+
template: "templates/blog.html"
|
18
|
+
data_integration:
|
19
|
+
data_file: "_data/site_data.yml"
|
20
|
+
target_file: "index.html"
|
21
|
+
interactive_cli:
|
22
|
+
enabled: true
|
23
|
+
error_handling:
|
24
|
+
log_errors: true
|
25
|
+
continue_on_error: false
|
26
|
+
```
|
27
|
+
|
28
|
+
## Options
|
29
|
+
|
30
|
+
### HTML Update Settings
|
31
|
+
|
32
|
+
- `file`: Specifies the HTML file to be updated.
|
33
|
+
- `sections`: A list of sections to update, each with an `id` and a `template` path.
|
34
|
+
|
35
|
+
### Data Integration Settings
|
36
|
+
|
37
|
+
- `data_file`: Path to the YAML data file in the `_data` directory.
|
38
|
+
- `target_file`: The HTML file where the data should be integrated.
|
39
|
+
|
40
|
+
### Interactive CLI Settings
|
41
|
+
|
42
|
+
- `enabled`: Boolean value to enable or disable the interactive command-line interface.
|
43
|
+
|
44
|
+
### Error Handling Settings
|
45
|
+
|
46
|
+
- `log_errors`: Boolean value to turn on error logging.
|
47
|
+
- `continue_on_error`: Boolean value to continue execution even if errors occur.
|
48
|
+
|
49
|
+
## Applying Configuration
|
50
|
+
|
51
|
+
To apply the configuration, ensure that your `config.yml` is correctly set up in the root of your Jekyll project. The JekyllFileWizard will automatically read this file when executed, applying the specified settings to manage your site's HTML structure and content.
|
52
|
+
|
53
|
+
## Advanced Configuration
|
54
|
+
|
55
|
+
For advanced users, JekyllFileWizard allows customization of more intricate aspects, such as specific data integration rules or custom CLI commands. Refer to the `advanced_features.md` document for more details.
|
56
|
+
|
57
|
+
With this configuration guide, you can tailor the JekyllFileWizard to your specific needs, ensuring efficient and automated management of your Jekyll site's structure and content.
|
58
|
+
|
59
|
+
[Back to Top](#configuration-guide-for-jekyllfilewizard)
|
data/docs/examples.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Examples Documentation for JekyllFileWizard
|
2
|
+
|
3
|
+
This document provides guidance and explanations for the examples included in the JekyllFileWizard gem. Each example is designed to showcase a specific functionality or use case of the gem in a Jekyll website context.
|
4
|
+
|
5
|
+
## Basic Example
|
6
|
+
|
7
|
+
- **Location**: `examples/basic_example`
|
8
|
+
- **Description**: This basic example demonstrates the fundamental operation of JekyllFileWizard. It shows how to use the gem to update a simple HTML structure in a Jekyll site.
|
9
|
+
- **Contents**:
|
10
|
+
- `index.html`: A basic HTML file representing a typical page in a Jekyll site.
|
11
|
+
- `config.yml`: A simple configuration file for JekyllFileWizard to specify the updates to be made.
|
12
|
+
- `header.html`, `footer.html`: Example HTML snippets to be integrated into `index.html`.
|
13
|
+
- **Purpose**: To illustrate the primary functionality of the gem, including the replacement or insertion of HTML sections.
|
14
|
+
|
15
|
+
## Advanced Example
|
16
|
+
|
17
|
+
- **Location**: `examples/advanced_example`
|
18
|
+
- **Description**: This advanced example showcases more complex use cases, such as conditional updates, handling multiple sections, and integrating content from external files.
|
19
|
+
- **Contents**:
|
20
|
+
- `index_advanced.html`: A more complex HTML file with multiple sections for updates.
|
21
|
+
- `config_advanced.yml`: An advanced configuration file with detailed instructions for the gem.
|
22
|
+
- Various HTML snippet files for different sections of the site.
|
23
|
+
- **Purpose**: To demonstrate the gem's capabilities in more complex site structures and varied update scenarios.
|
24
|
+
|
25
|
+
## Data Integration Example
|
26
|
+
|
27
|
+
- **Location**: `examples/data_integration_example`
|
28
|
+
- **Description**: This example demonstrates how JekyllFileWizard can be used to integrate data from Jekyll's `_data` directory into the site's HTML files.
|
29
|
+
- **Contents**:
|
30
|
+
- `_data`: Folder containing YAML data files (e.g., `team.yml`, `products.yml`).
|
31
|
+
- `team_section.html`, `product_catalog.html`: HTML templates that will use data from the YAML files.
|
32
|
+
- `config_data_integration.yml`: Configuration file to specify how data from the `_data` directory is used in the HTML templates.
|
33
|
+
- **Purpose**: To illustrate how the gem can dynamically populate HTML sections using data from YAML files, enhancing the site's flexibility and maintainability.
|
34
|
+
|
35
|
+
## How to Use the Examples
|
36
|
+
|
37
|
+
1. **Setup**: Clone the repository or download the examples folder.
|
38
|
+
2. **Explore**: Open each example folder to understand the file structure and contents.
|
39
|
+
3. **Run JekyllFileWizard**:
|
40
|
+
- Navigate to the example directory in the terminal.
|
41
|
+
- Run the command `jekyll_file_wizard` using the provided configuration file.
|
42
|
+
4. **Observe**: Review the changes made by the gem to the HTML files based on the configuration and data files.
|
43
|
+
|
44
|
+
## Learning from Examples
|
45
|
+
|
46
|
+
These examples are designed to be educational, helping users understand the practical application of JekyllFileWizard in different scenarios. By studying and experimenting with these examples, users can gain insights into how to effectively utilize the gem for their own Jekyll sites.
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# Getting Started with JekyllFileWizard
|
2
|
+
|
3
|
+
Welcome to JekyllFileWizard, a gem designed to enhance your experience managing Jekyll sites. This document will guide you through the basics of getting started with JekyllFileWizard, ensuring you're well-equipped to utilize its features effectively.
|
4
|
+
|
5
|
+
## Overview
|
6
|
+
|
7
|
+
JekyllFileWizard automates and streamlines the management of Jekyll site files. It dynamically updates site structures, manages HTML and data files, and provides an interactive CLI for easy use. Whether you're maintaining a small blog or a large-scale Jekyll project, this gem simplifies your workflow.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Before installing JekyllFileWizard, ensure you have Ruby and Jekyll installed on your system. Follow these steps to install the gem:
|
12
|
+
|
13
|
+
1. **Install the Gem:**
|
14
|
+
```bash
|
15
|
+
gem install JekyllFileWizard
|
16
|
+
```
|
17
|
+
|
18
|
+
2. **Verify Installation:**
|
19
|
+
Run the following command to ensure the gem is installed correctly:
|
20
|
+
```bash
|
21
|
+
jekyll_file_wizard --version
|
22
|
+
```
|
23
|
+
|
24
|
+
## Setting Up Your Jekyll Project
|
25
|
+
|
26
|
+
If you already have a Jekyll project, navigate to your project directory. If not, create a new Jekyll site:
|
27
|
+
|
28
|
+
```bash
|
29
|
+
jekyll new mysite
|
30
|
+
cd mysite
|
31
|
+
```
|
32
|
+
|
33
|
+
## Integrating JekyllFileWizard
|
34
|
+
|
35
|
+
1. **Execute the Wizard:**
|
36
|
+
In your Jekyll project directory, run:
|
37
|
+
```bash
|
38
|
+
jekyll_file_wizard
|
39
|
+
```
|
40
|
+
|
41
|
+
2. **Follow the Prompts:**
|
42
|
+
The CLI will guide you through a series of steps to configure your Jekyll site, such as updating HTML structures, managing data files, and setting up templates.
|
43
|
+
|
44
|
+
## First Steps
|
45
|
+
|
46
|
+
After integrating JekyllFileWizard into your Jekyll project, you can:
|
47
|
+
|
48
|
+
- **Update HTML Structures:** Automatically update or add sections to your `index.html` based on templates or custom configurations.
|
49
|
+
- **Manage Data Files:** Utilize the `_data` directory to fetch and incorporate data dynamically into your site.
|
50
|
+
- **Use Templates:** Leverage predefined templates for common site sections.
|
51
|
+
|
52
|
+
## Next Steps
|
53
|
+
|
54
|
+
For detailed information on advanced features, API reference, configuration options, and more, refer to the respective documents in the `docs` folder. Here are some key documents to explore:
|
55
|
+
|
56
|
+
- `advanced_features.md` for in-depth details about advanced functionalities.
|
57
|
+
- `api_reference.md` for a complete reference to the gem's API.
|
58
|
+
- `configuration.md` for configuring the gem to suit your specific needs.
|
59
|
+
|
60
|
+
## Support and Contributions
|
61
|
+
|
62
|
+
For support, troubleshooting, or contributions, please refer to `troubleshooting.md` and `README.md`. Contributions to JekyllFileWizard are always welcome!
|
63
|
+
|
64
|
+
---
|
65
|
+
|
66
|
+
Thank you for choosing JekyllFileWizard. We hope it enhances your Jekyll site development experience! 🚀
|
67
|
+
|
68
|
+
[Back to Top](#getting-started-with-jekyllfilewizard)
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Troubleshooting Guide for JekyllFileWizard
|
2
|
+
|
3
|
+
This guide aims to help users troubleshoot common issues encountered while using the JekyllFileWizard gem. It provides solutions to frequent problems and advice on how to resolve them effectively.
|
4
|
+
|
5
|
+
## Common Issues and Solutions
|
6
|
+
|
7
|
+
### 1. Configuration File Not Found
|
8
|
+
- **Problem**: The gem cannot locate the `config.yml` file.
|
9
|
+
- **Solution**: Ensure the `config.yml` file is in the root directory of your Jekyll project. Check for typos in the filename or path.
|
10
|
+
|
11
|
+
### 2. HTML File Update Failure
|
12
|
+
- **Problem**: Changes are not reflected in the specified HTML file.
|
13
|
+
- **Solution**: Confirm that the path and section IDs in `config.yml` are correct. Ensure that the HTML file is accessible and not write-protected.
|
14
|
+
|
15
|
+
### 3. Data Integration Issues
|
16
|
+
- **Problem**: Data from the `_data` directory is not correctly integrated into the HTML file.
|
17
|
+
- **Solution**: Verify the path to the data file and the structure of the YAML data. Check that the target HTML file contains the appropriate placeholders or identifiers for data insertion.
|
18
|
+
|
19
|
+
### 4. Interactive CLI Not Responding
|
20
|
+
- **Problem**: The interactive CLI does not launch or respond to commands.
|
21
|
+
- **Solution**: Ensure the interactive CLI is enabled in `config.yml`. Check for console errors or conflicts with other CLI tools.
|
22
|
+
|
23
|
+
### 5. Error Logging Inconsistencies
|
24
|
+
- **Problem**: Error messages are unclear or not logged as expected.
|
25
|
+
- **Solution**: Check the `log_errors` and `continue_on_error` settings in `config.yml`. Confirm that the log file has appropriate write permissions.
|
26
|
+
|
27
|
+
### 6. Template Rendering Errors
|
28
|
+
- **Problem**: Custom templates are not rendered correctly in the HTML file.
|
29
|
+
- **Solution**: Check the template file paths and formats. Ensure that the HTML structure in the templates is valid.
|
30
|
+
|
31
|
+
### 7. Gem Installation Issues
|
32
|
+
- **Problem**: Difficulty installing or updating the gem.
|
33
|
+
- **Solution**: Verify Ruby and Gem environment setup. Ensure network connectivity for accessing RubyGems.org. Try updating RubyGems (`gem update --system`).
|
34
|
+
|
35
|
+
## Advanced Troubleshooting
|
36
|
+
|
37
|
+
For more complex issues or custom setups, refer to the `api_reference.md` and `advanced_features.md` documents for in-depth information on the gem's internal workings and advanced functionalities.
|
38
|
+
|
39
|
+
## Seeking Further Assistance
|
40
|
+
|
41
|
+
If you encounter an issue not covered in this guide, consider the following:
|
42
|
+
- Check the [JekyllFileWizard GitHub repository](https://github.com/JekyllFileWizard) for known issues or discussions.
|
43
|
+
- Consult the Jekyll community forums or relevant online communities for broader Jekyll-related issues.
|
44
|
+
- For bugs or feature requests, open an issue on the GitHub repository.
|
45
|
+
|
46
|
+
Remember, detailed error reports, including logs and configuration files, can significantly aid in resolving your issues more efficiently.
|
47
|
+
|
48
|
+
[Back to Top](#troubleshooting-guide-for-jekyllfilewizard)
|
data/docs/usage.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# Usage Guide for JekyllFileWizard
|
2
|
+
|
3
|
+
This document provides comprehensive instructions on how to use the JekyllFileWizard gem to manage and update Jekyll site structures effectively. It covers basic to advanced usage scenarios, ensuring you can fully leverage the gem's capabilities.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
1. **Install the Gem**:
|
8
|
+
```bash
|
9
|
+
gem install jekyll_file_wizard
|
10
|
+
```
|
11
|
+
|
12
|
+
2. **Navigate to Your Jekyll Project**:
|
13
|
+
```bash
|
14
|
+
cd path/to/your/jekyll/project
|
15
|
+
```
|
16
|
+
|
17
|
+
3. **Verify Installation**:
|
18
|
+
Run `jekyll_file_wizard --version` to confirm the gem is installed correctly.
|
19
|
+
|
20
|
+
## Basic Usage
|
21
|
+
|
22
|
+
1. **Create a Configuration File**:
|
23
|
+
- Name it `config.yml` and place it in the root of your Jekyll project.
|
24
|
+
- Define the sections of the `index.html` file you wish to update or add.
|
25
|
+
|
26
|
+
2. **Run the Gem**:
|
27
|
+
```bash
|
28
|
+
jekyll_file_wizard
|
29
|
+
```
|
30
|
+
- The gem reads `config.yml` and makes necessary updates to your `index.html`.
|
31
|
+
|
32
|
+
## Advanced Usage
|
33
|
+
|
34
|
+
### Custom Templates
|
35
|
+
|
36
|
+
1. **Create Custom HTML Templates**:
|
37
|
+
- Place them in the `templates` directory of your Jekyll project.
|
38
|
+
- You can create templates for sections like blog highlights, featured projects, etc.
|
39
|
+
|
40
|
+
2. **Update `config.yml` to Include Templates**:
|
41
|
+
- Specify the template file names and their target insertion points in `index.html`.
|
42
|
+
|
43
|
+
### Data Integration
|
44
|
+
|
45
|
+
1. **Prepare Data Files**:
|
46
|
+
- Place YAML data files in the `_data` directory.
|
47
|
+
- Ensure the data structure matches your template placeholders.
|
48
|
+
|
49
|
+
2. **Configure Data Integration in `config.yml`**:
|
50
|
+
- Define which data files to use and where to integrate them in `index.html`.
|
51
|
+
|
52
|
+
### Interactive CLI
|
53
|
+
|
54
|
+
1. **Launch Interactive Mode**:
|
55
|
+
```bash
|
56
|
+
jekyll_file_wizard --interactive
|
57
|
+
```
|
58
|
+
- Follow the prompts to select options and configure updates dynamically.
|
59
|
+
|
60
|
+
## Routine Maintenance
|
61
|
+
|
62
|
+
- Regularly run `jekyll_file_wizard` to ensure your Jekyll site stays updated with the latest content from your data files and templates.
|
63
|
+
- Use the interactive CLI for quick adjustments or to experiment with different configurations.
|
64
|
+
|
65
|
+
## Troubleshooting
|
66
|
+
|
67
|
+
- Refer to the `troubleshooting.md` document for common issues and solutions.
|
68
|
+
- For complex scenarios, consult the `api_reference.md` and `advanced_features.md` for deeper insights into the gem's functionalities.
|
69
|
+
|
70
|
+
## Getting Help
|
71
|
+
|
72
|
+
- Access detailed documentation and examples in the `docs` directory.
|
73
|
+
- Visit the [JekyllFileWizard GitHub repository](https://github.com/JekyllFileWizard) for additional resources and community support.
|
74
|
+
|
75
|
+
Remember, the JekyllFileWizard gem is designed to make managing your Jekyll site's structure easier and more efficient, giving you more time to focus on content creation and site design.
|
76
|
+
|
77
|
+
[Back to Top](#usage-guide-for-jekyllfilewizard)
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# Advanced Examples for JekyllFileWizard
|
2
|
+
|
3
|
+
This folder contains advanced examples that showcase the more complex capabilities of the JekyllFileWizard gem. These examples demonstrate how to handle intricate scenarios and leverage the gem's full potential for sophisticated Jekyll site management.
|
4
|
+
|
5
|
+
## Example 1: Dynamic Content Integration
|
6
|
+
|
7
|
+
**Scenario**: You want to dynamically integrate content from an external API into your Jekyll site's specific page.
|
8
|
+
|
9
|
+
### Steps:
|
10
|
+
|
11
|
+
1. **External API Integration Script**:
|
12
|
+
- File: `fetch_external_content.rb`
|
13
|
+
- Content: Ruby script to fetch data from an external API and format it into HTML.
|
14
|
+
|
15
|
+
2. **Create a Placeholder Template**:
|
16
|
+
- File: `external_content_placeholder.html`
|
17
|
+
- Content: HTML structure with a placeholder where the dynamic content will be inserted.
|
18
|
+
|
19
|
+
3. **Configuration File** (`config.yml`):
|
20
|
+
```yaml
|
21
|
+
updates:
|
22
|
+
- target: "services.html"
|
23
|
+
section: "after"
|
24
|
+
section_id: "main-services"
|
25
|
+
template: "external_content_placeholder.html"
|
26
|
+
script: "fetch_external_content.rb"
|
27
|
+
```
|
28
|
+
|
29
|
+
4. **Run JekyllFileWizard**:
|
30
|
+
```bash
|
31
|
+
jekyll_file_wizard
|
32
|
+
```
|
33
|
+
|
34
|
+
## Example 2: Automated Blog Post Generation
|
35
|
+
|
36
|
+
**Scenario**: Automatically generate blog posts from a set of markdown files stored in an external directory.
|
37
|
+
|
38
|
+
### Steps:
|
39
|
+
|
40
|
+
1. **Markdown Files**:
|
41
|
+
- Location: `external_blog_posts/`
|
42
|
+
- Content: Multiple markdown files with content for blog posts.
|
43
|
+
|
44
|
+
2. **Blog Post Template**:
|
45
|
+
- File: `blog_post_template.md`
|
46
|
+
- Content: Markdown template with placeholders for blog post content.
|
47
|
+
|
48
|
+
3. **Configuration File** (`config.yml`):
|
49
|
+
```yaml
|
50
|
+
updates:
|
51
|
+
- target: "_posts/"
|
52
|
+
template: "blog_post_template.md"
|
53
|
+
markdown_directory: "external_blog_posts/"
|
54
|
+
```
|
55
|
+
|
56
|
+
4. **Run JekyllFileWizard**:
|
57
|
+
```bash
|
58
|
+
jekyll_file_wizard
|
59
|
+
```
|
60
|
+
|
61
|
+
## Example 3: Multi-Section Update with Data Integration
|
62
|
+
|
63
|
+
**Scenario**: Update multiple sections of a page by integrating data from various YAML files in the `_data` directory.
|
64
|
+
|
65
|
+
### Steps:
|
66
|
+
|
67
|
+
1. **Section Templates**:
|
68
|
+
- Files: `section1.html`, `section2.html`
|
69
|
+
- Content: HTML templates for each section with placeholders for data integration.
|
70
|
+
|
71
|
+
2. **Data Files**:
|
72
|
+
- Location: `_data/`
|
73
|
+
- Files: `data1.yml`, `data2.yml`
|
74
|
+
|
75
|
+
3. **Configuration File** (`config.yml`):
|
76
|
+
```yaml
|
77
|
+
updates:
|
78
|
+
- target: "about/index.html"
|
79
|
+
sections:
|
80
|
+
- template: "section1.html"
|
81
|
+
data_file: "data1.yml"
|
82
|
+
- template: "section2.html"
|
83
|
+
data_file: "data2.yml"
|
84
|
+
```
|
85
|
+
|
86
|
+
4. **Run JekyllFileWizard**:
|
87
|
+
```bash
|
88
|
+
jekyll_file_wizard
|
89
|
+
```
|
90
|
+
|
91
|
+
These advanced examples highlight JekyllFileWizard's ability to handle complex scenarios, including dynamic content integration, automated content generation, and multi-section updates with data integration. They are ideal for users looking to automate and streamline their Jekyll site management processes significantly.
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# Basic Examples for JekyllFileWizard
|
2
|
+
|
3
|
+
This folder contains a set of basic examples to demonstrate the usage of the JekyllFileWizard gem in various scenarios. These examples will help you understand how to apply the gem effectively in your Jekyll projects.
|
4
|
+
|
5
|
+
## Example 1: Updating the Index Page
|
6
|
+
|
7
|
+
**Scenario**: You want to update the `index.html` file of your Jekyll site by adding a new section for latest blog posts.
|
8
|
+
|
9
|
+
### Steps:
|
10
|
+
|
11
|
+
1. **Create a New HTML Template**:
|
12
|
+
- File: `latest_blog_posts.html`
|
13
|
+
- Content: HTML structure for displaying the latest blog posts.
|
14
|
+
|
15
|
+
2. **Configuration File** (`config.yml`):
|
16
|
+
```yaml
|
17
|
+
updates:
|
18
|
+
- target: "index.html"
|
19
|
+
section: "end"
|
20
|
+
template: "latest_blog_posts.html"
|
21
|
+
```
|
22
|
+
|
23
|
+
3. **Run JekyllFileWizard**:
|
24
|
+
```bash
|
25
|
+
jekyll_file_wizard
|
26
|
+
```
|
27
|
+
|
28
|
+
## Example 2: Integrating Data from `_data`
|
29
|
+
|
30
|
+
**Scenario**: You have a list of team members in a YAML file and want to display it on your homepage.
|
31
|
+
|
32
|
+
### Steps:
|
33
|
+
|
34
|
+
1. **Data File**:
|
35
|
+
- Location: `_data/team.yml`
|
36
|
+
- Content: YAML structured data of team members.
|
37
|
+
|
38
|
+
2. **Create a Team Section Template**:
|
39
|
+
- File: `team_section.html`
|
40
|
+
- Content: HTML with placeholders for team member data.
|
41
|
+
|
42
|
+
3. **Configuration File** (`config.yml`):
|
43
|
+
```yaml
|
44
|
+
updates:
|
45
|
+
- target: "index.html"
|
46
|
+
section: "after"
|
47
|
+
section_id: "about-us"
|
48
|
+
template: "team_section.html"
|
49
|
+
data_file: "team.yml"
|
50
|
+
```
|
51
|
+
|
52
|
+
4. **Run JekyllFileWizard**:
|
53
|
+
```bash
|
54
|
+
jekyll_file_wizard
|
55
|
+
```
|
56
|
+
|
57
|
+
## Example 3: Adding a Contact Form
|
58
|
+
|
59
|
+
**Scenario**: You want to add a contact form to your site's contact page.
|
60
|
+
|
61
|
+
### Steps:
|
62
|
+
|
63
|
+
1. **Contact Form Template**:
|
64
|
+
- File: `contact_form.html`
|
65
|
+
- Content: HTML structure for the contact form.
|
66
|
+
|
67
|
+
2. **Configuration File** (`config.yml`):
|
68
|
+
```yaml
|
69
|
+
updates:
|
70
|
+
- target: "contact/index.html"
|
71
|
+
section: "before"
|
72
|
+
section_id: "footer"
|
73
|
+
template: "contact_form.html"
|
74
|
+
```
|
75
|
+
|
76
|
+
3. **Run JekyllFileWizard**:
|
77
|
+
```bash
|
78
|
+
jekyll_file_wizard
|
79
|
+
```
|
80
|
+
|
81
|
+
These basic examples cover typical scenarios you might encounter while using JekyllFileWizard. They are designed to be straightforward and easily adaptable to your specific needs.
|
data/examples/config.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
sections:
|
2
|
+
blog:
|
3
|
+
template: blog_section
|
4
|
+
position: after
|
5
|
+
relative_element: '.welcome-message'
|
6
|
+
features:
|
7
|
+
identifier: id
|
8
|
+
content_path: path/to/features_content.html
|
9
|
+
action: update
|
10
|
+
blog_highlights:
|
11
|
+
identifier: class
|
12
|
+
content_path: path/to/blog_highlights_content.html
|
13
|
+
action: insert
|
14
|
+
position: after
|
15
|
+
relative_element: '.intro-section'
|
16
|
+
call_to_action:
|
17
|
+
toggle: off
|
18
|
+
sections_to_update:
|
19
|
+
- "features"
|
20
|
+
- "testimonials"
|
21
|
+
feature_toggles:
|
22
|
+
interactive_elements: true
|
23
|
+
latest_projects: false
|