Compare commits
No commits in common. "860f1d763204eb5dc144ccb340c646fd523a1e28" and "bb50e3b2e5075f0cea730de3e2e1033fa00bb98f" have entirely different histories.
860f1d7632
...
bb50e3b2e5
13 changed files with 11 additions and 69 deletions
51
README.md
51
README.md
|
@ -1,51 +0,0 @@
|
|||
# Staticrustator (being workshopped)
|
||||
|
||||
After struggling with rewriting personnal website in a myriad of ways, all in some way unsatisfying,
|
||||
I have decided to write my own statis site generator.
|
||||
|
||||
Heavily inspired by [Saait](https://codemadness.org/git/saait/), since that is what I have been using previously.
|
||||
|
||||
To build
|
||||
```bash
|
||||
cargo build
|
||||
```
|
||||
|
||||
and to create the website structure
|
||||
```bash
|
||||
cargo run
|
||||
```
|
||||
|
||||
This will create the folder `output` then you can sync to your vpc, or however you serve stataic files.
|
||||
|
||||
-------
|
||||
## File organization
|
||||
|
||||
The posts are taken from `posts/` folder, are structured as markdown files, with a front matter in yaml for the date, and title of the post.
|
||||
|
||||
|
||||
Example:
|
||||
```markdown
|
||||
---
|
||||
title: Pantheon
|
||||
date: 2024-03-03
|
||||
---
|
||||
# WATCH PANTHEON
|
||||
|
||||
## I DO NOT CARE WHAT DAY IT IS
|
||||
|
||||
### HERE'S YOUR PLAN
|
||||
|
||||
1. Wake up.
|
||||
2. Open whatever device you watch things on.
|
||||
3. Obtain, legally or illegaly, by any means necessary, 2 (two) seasons of Pantheon, created by Craig Silverstein based on short stories by Ken Liu.
|
||||
4. Binge the 2 sesons in a single night (it is feasable I checked)
|
||||
|
||||
Thank you for coming to my Ted Talk.
|
||||
```
|
||||
|
||||
Additional pages such as `about` is also taken from there, however you could modify the about template in `templates` folder.
|
||||
[Askama](https://github.com/djc/askama) is a rendering engine based on Junja, so it is rather straight forward to use,
|
||||
but also it can take rust `structs` to hold template context, which is very nice.
|
||||
|
||||
I have not yet integrated htmx into is, for faster loads of the post body,but that's for the future (also I hate js).
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
---
|
||||
title:about page
|
||||
date:01-09-2024
|
||||
---
|
||||
# Welcome to my site!
|
||||
|
||||
Inspired originally by the yesterweb ring, a small portion of the internet where I post (rarely) about stuff i think i make that is cool.
|
|
@ -5,15 +5,15 @@ use markdown_parser::*;
|
|||
use crate::structs::{BlogInfo, IndexPostEntry};
|
||||
|
||||
pub fn get_blog_entry_markdown(path:&String) -> Result<Markdown,Error> {
|
||||
let location = format!("content/posts/{path}.md").to_string();
|
||||
let location = format!("posts/{path}.md").to_string();
|
||||
read_file(Path::new(&location))
|
||||
}
|
||||
|
||||
pub fn get_all_markdowns() -> Vec<IndexPostEntry> {
|
||||
let mut post_vec:Vec<IndexPostEntry> = Vec::new();
|
||||
let mr_dir_iter = match read_dir("content/posts") {
|
||||
let mr_dir_iter = match read_dir("posts/") {
|
||||
Ok(iter) => iter,
|
||||
Err(err) => panic!("couldnt ls files, err {err}")
|
||||
Err(err) => panic!("could ls files, err {err}")
|
||||
};
|
||||
|
||||
for entry in mr_dir_iter {
|
||||
|
|
|
@ -11,10 +11,7 @@ pub fn index() -> String {
|
|||
|
||||
pub fn about() -> String {
|
||||
|
||||
|
||||
let about_markdown = markdown_parser::read_file("content/pages/about.md").expect("Could no find about.md file in content/pages/ folder");
|
||||
|
||||
let about_content = parse_markdown(about_markdown.content());
|
||||
let about_content = parse_markdown("about");
|
||||
let page_content = AboutTemplate{about_content: &about_content};
|
||||
page_content.to_string()
|
||||
}
|
||||
|
|
|
@ -34,9 +34,9 @@ fn main() {
|
|||
}
|
||||
|
||||
|
||||
let post_dir_iter = match read_dir("content/posts/") {
|
||||
let post_dir_iter = match read_dir("posts/") {
|
||||
Ok(iter) => iter,
|
||||
Err(err) => panic!("couldnt ls files, err {err}")
|
||||
Err(err) => panic!("could ls files, err {err}")
|
||||
};
|
||||
|
||||
for entry in post_dir_iter {
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
{% block content %}
|
||||
|
||||
<h2> yepper yapper yapper</h2>
|
||||
|
||||
<p> this is an about page </p>
|
||||
|
||||
{{ about_content|safe }}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
<link rel="stylesheet" href="https://unpkg.com/missing.css@1.1.2">
|
||||
<link rel="stylesheet" href="/assets/old_style.css">
|
||||
<link rel="icon" href="/assets/favicon.png" type="image/png" />
|
||||
<link rel="me" href="https://infosec.exchange/@technoduck" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -24,7 +23,7 @@
|
|||
</div>
|
||||
|
||||
<div class="float:right">
|
||||
<a href="/about.html">About</a> |
|
||||
<a href="/about">About</a> |
|
||||
<a href="assets/duck.asc">PGP</a> |
|
||||
<a href="mailto:duck@technoduck.me">Mail</a>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue