{"id":15723743,"url":"https://github.com/epilys/libssg","last_synced_at":"2025-05-13T04:57:25.384Z","repository":{"id":62442154,"uuid":"239533845","full_name":"epilys/libssg","owner":"epilys","description":"static site generation library - make your own static site generator","archived":false,"fork":false,"pushed_at":"2024-04-18T13:16:31.000Z","size":61,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-13T04:57:18.001Z","etag":null,"topics":["library","rust","static-site","static-site-generator"],"latest_commit_sha":null,"homepage":"https://nessuent.xyz/libssg.html","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/epilys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-10T14:38:36.000Z","updated_at":"2025-03-27T04:41:45.000Z","dependencies_parsed_at":"2024-04-18T14:42:49.880Z","dependency_job_id":"87e882ea-a00c-42a4-a1c6-3bcd725dad0a","html_url":"https://github.com/epilys/libssg","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"ab92e1f4f60a8f46e471a741e06c0e7f1eb6da5b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epilys%2Flibssg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epilys%2Flibssg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epilys%2Flibssg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epilys%2Flibssg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/epilys","download_url":"https://codeload.github.com/epilys/libssg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253877509,"owners_count":21977643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library","rust","static-site","static-site-generator"],"created_at":"2024-10-03T22:13:10.430Z","updated_at":"2025-05-13T04:57:25.366Z","avatar_url":"https://github.com/epilys.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libssg [![License]][gpl3]\u0026nbsp;[![No Maintenance Intended]][no-maintenance]\n\n[gpl3]: https://github.com/epilys/libssg/blob/master/LICENSE.md\n[License]: https://img.shields.io/github/license/epilys/libssg?color=white\n[No Maintenance Intended]: https://img.shields.io/badge/No%20Maintenance%20Intended-%F0%9F%97%99-red\n[no-maintenance]: https://unmaintained.tech/\n\n\u003e static site generation library\n\nBuild your own executable static generator that includes your building logic instead of using configuration files and command line arguments. Inspired by [Hakyll](https://jaspervdj.be/hakyll/).\n\n- You will need to have `pandoc` installed to use Markdown.\n- Uses the [handlebars template engine](https://docs.rs/handlebars/3.0.1/handlebars/index.html)\n\n```rust\nuse libssg::*;\n/*\n * $ tree\n * .\n * ├── Cargo.toml etc\n * ├── src\n * │   └── main.rs\n * ├── css\n * │   └── *.css\n * ├── images\n * │   └── *.png\n * ├── index.md\n * ├── posts\n * │   └── *.md\n * ├── _site\n * │   ├── css\n * │   │   └── *.css\n * │   ├── images\n * │   │   └── *.png\n * │   ├── index.html\n * │   ├── posts\n * │   │   └── *.html\n * │   └── rss.xml\n * └── templates\n *     ├── default.hbs\n *     └── post.hbs\n*/\n\n\nfn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let mut state = State::new()?;\n    state\n        .then(match_pattern(\n            \"^posts/*\",\n            Route::SetExtension(\"html\"),\n               Renderer::Pipeline(vec![\n                   Renderer::LoadAndApplyTemplate(\"templates/post.hbs\"),\n                   Renderer::LoadAndApplyTemplate(\"templates/default.hbs\"),\n               ]),\n            compiler_seq(\n                pandoc(),\n                Box::new(|state, path| {\n                    let path = path\n                        .strip_prefix(\u0026state.output_dir().parent().unwrap())\n                        .unwrap_or(\u0026path)\n                        .to_path_buf();\n                    if state.verbosity() \u003e 3 {\n                        println!(\"adding {} to RSS snapshot\", path.display());\n                    }\n                    let uuid = uuid_from_path(\u0026path);\n                    state.add_to_snapshot(\"main-rss-feed\".into(), uuid);\n                    Ok(Default::default())\n                }),\n            ),\n        ))\n        .then(match_pattern(\n            \"index.md\",\n            Route::SetExtension(\"html\"),\n            Renderer::LoadAndApplyTemplate(\"templates/default.hbs\"),\n            pandoc(),\n        ))\n        .then(copy(\"^images/*\", Route::Id))\n        .then(copy(\"^css/*\", Route::Id))\n        .then(build_rss_feed(\n            \"rss.xml\".into(),\n            rss_feed(\n                \"main-rss-feed\".into(),\n                RssItem {\n                    title: \"example page\".into(),\n                    description: \"example using libssg\".into(),\n                    link: \"http://example.local\".into(),\n                    last_build_date: String::new(),\n                    pub_date: \"Thu, 01 Jan 1970 00:00:00 +0000\".to_string(),\n                    ttl: 1800,\n                },\n            ),\n        ))\n        .finish()?;\n    Ok(())\n}\n```\n\n`cargo run` and the output is saved at `./_site/`.\n\nSet `$FORCE`, `$VERBOSITY` (`0..5`) to change behaviour.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepilys%2Flibssg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fepilys%2Flibssg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepilys%2Flibssg/lists"}