4 releases
0.1.3 | Jun 22, 2024 |
---|---|
0.1.2 | Jun 14, 2024 |
0.1.1 | Jun 14, 2024 |
0.1.0 | Jun 14, 2024 |
#1913 in Command line utilities
180 downloads per month
11KB
151 lines
SiteSmith 🛠️
SiteSmith is a Rust CLI tool designed to generate a personal website. It reads project and work experience data from JSON files and uses a template to create an HTML website.
Features
- Parses JSON data for projects and work experience.
- Utilizes an HTML template to format and generate the website.
- Customizable templates for projects and work entries.
Installation
- Ensure you have Rust installed.
- Install SiteSmith using Cargo:
cargo install sitesmith
Usage
To generate your website, run the sitesmith
CLI tool with the following arguments:
sitesmith --projects <projects.json> --work <work.json> --template <template.html> --output <output.html>
Arguments
--projects
: Path to the JSON file containing project data.--work
: Path to the JSON file containing work experience data.--template
: Path to the HTML template file.--output
: Path to the output HTML file to be generated.
Example
sitesmith --projects projects.json --work work.json --template template.html --output index.html
JSON Data Format
Projects JSON Format
The projects JSON file should contain an array of project entries. Each entry should have the following structure:
[
{
"name": "Project Name",
"descr": ["Project description item 1", "Project description item 2"],
"extra": ["<p>Additional project information</p>"]
},
...
]
Work Experience JSON Format
The work JSON file should contain an array of work experience entries. Each entry should have the following structure:
[
{
"name": "Job Title",
"timespan": "Duration",
"location": "Location",
"descr": ["Job description item 1", "Job description item 2"],
"extra": ["<p>Additional job information</p>", "<b>Even more job info!</b>"]
},
...
]
HTML Template
The HTML template should include placeholders for the projects and work experience sections. For example:
<!DOCTYPE html>
<html>
<head>
<title>My Personal Website</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<header>
<h1>Welcome to My Personal Website</h1>
</header>
<main>
<section id="projects">
{projects}
</section>
<section id="work">
{work}
</section>
</main>
<footer>
<p>© 2024 Your Name</p>
</footer>
</body>
</html>
The placeholders {projects}
and {work}
will be replaced with the generated HTML content for the projects and work experience respectively.
Example
You can see a live example of a website generated using SiteSmith here.
The source code for this example is available on GitHub: bradeneverson.github.io.
Contributing
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.
Dependencies
~1.6–2.6MB
~50K SLoC