Commit 703f8be3fd
Unsigned
Layout: unified · split
README.nfo deleted −69
| @@ -1,69 +0,0 @@ | |||
| 1 | ┌──────────────────────────────────────────────────────────────┐ | ||
| 2 | │ P H P - B L O G [ KRZ ] krz.sh │ | ||
| 3 | └──────────────────────────────────────────────────────────────┘ | ||
| 4 | |||
| 5 | WHAT | ||
| 6 | php-blog. database-free blogging app in php. articles in markdown, | ||
| 7 | metadata and comments in json. | ||
| 8 | |||
| 9 | PHILOSOPHY | ||
| 10 | a blog should degrade gracefully over time. articles, metadata, and | ||
| 11 | comments live in the git repo, not a database. | ||
| 12 | |||
| 13 | INSTALL | ||
| 14 | cd yourBlog.com | ||
| 15 | git clone <REPO_URL> | ||
| 16 | |||
| 17 | set the globals at the top of index.php: | ||
| 18 | |||
| 19 | $websiteProtocol = 'https://'; | ||
| 20 | $shortDomain = 'yourBlog.com'; | ||
| 21 | |||
| 22 | clear the sample data and posts: | ||
| 23 | |||
| 24 | cd _data/ && rm -rf * | ||
| 25 | touch comments.json && touch metadata.json | ||
| 26 | cd ../posts/ && rm -rf * | ||
| 27 | touch 001-your-first-post.md | ||
| 28 | |||
| 29 | add a metadata object in _data/metadata.json for every post. enable | ||
| 30 | FallbackResource in apache .conf or .htaccess: | ||
| 31 | |||
| 32 | FallbackResource /index.php | ||
| 33 | |||
| 34 | STRUCTURE | ||
| 35 | index.php fallback resource; routes requests, calls | ||
| 36 | functions, fills the template | ||
| 37 | _classes/ Comment.php, Parsedown.php (erusev/parsedown, MIT), | ||
| 38 | Template.php | ||
| 39 | _data/ metadata.json (one object per post), comments.json | ||
| 40 | (written server-side as comments arrive) | ||
| 41 | _functions/ loadJSON.php, loadRSS.php, parseMarkdown.php, | ||
| 42 | submitComment.php | ||
| 43 | _templates/ template.html | ||
| 44 | posts/ markdown post bodies | ||
| 45 | static/ app.css, optional prism.css / prism.js for syntax | ||
| 46 | highlighting | ||
| 47 | |||
| 48 | metadata object: | ||
| 49 | |||
| 50 | { | ||
| 51 | "id": "001", | ||
| 52 | "title": "Title of Post", | ||
| 53 | "author": "Your Name", | ||
| 54 | "description": "...", | ||
| 55 | "tag": "my-category", | ||
| 56 | "created": "2018-12-08 00:00:00", | ||
| 57 | "modified": "2018-12-08 00:00:00", | ||
| 58 | "link": "https://www.example.com/post/name.html", | ||
| 59 | "published": "Yes" | ||
| 60 | } | ||
| 61 | |||
| 62 | let the web user write comments.json (apache is usually www-data): | ||
| 63 | |||
| 64 | chgrp -R www-data /path/to/website/ | ||
| 65 | chmod -R g+w _data/comments.json | ||
| 66 | |||
| 67 | ┌──────────────────────────────────────────────────────────────┐ | ||
| 68 | │ krz.sh │ | ||
| 69 | └──────────────────────────────────────────────────────────────┘ | ||
README.org added +77
| @@ -0,0 +1,77 @@ | |||
| 1 | #+title: php-blog | ||
| 2 | |||
| 3 | * what | ||
| 4 | php-blog. database-free blogging app in php. articles in markdown, | ||
| 5 | metadata and comments in json. | ||
| 6 | |||
| 7 | * philosophy | ||
| 8 | a blog should degrade gracefully over time. articles, metadata, and | ||
| 9 | comments live in the git repo, not a database. | ||
| 10 | |||
| 11 | * install | ||
| 12 | #+begin_src sh | ||
| 13 | cd yourBlog.com | ||
| 14 | git clone <REPO_URL> | ||
| 15 | #+end_src | ||
| 16 | |||
| 17 | set the globals at the top of index.php: | ||
| 18 | |||
| 19 | #+begin_src sh | ||
| 20 | $websiteProtocol = 'https://'; | ||
| 21 | $shortDomain = 'yourBlog.com'; | ||
| 22 | #+end_src | ||
| 23 | |||
| 24 | clear the sample data and posts: | ||
| 25 | |||
| 26 | #+begin_src sh | ||
| 27 | cd _data/ && rm -rf * | ||
| 28 | touch comments.json && touch metadata.json | ||
| 29 | cd ../posts/ && rm -rf * | ||
| 30 | touch 001-your-first-post.md | ||
| 31 | #+end_src | ||
| 32 | |||
| 33 | add a metadata object in _data/metadata.json for every post. enable | ||
| 34 | FallbackResource in apache .conf or .htaccess: | ||
| 35 | |||
| 36 | #+begin_src sh | ||
| 37 | FallbackResource /index.php | ||
| 38 | #+end_src | ||
| 39 | |||
| 40 | * structure | ||
| 41 | #+begin_example | ||
| 42 | index.php fallback resource; routes requests, calls | ||
| 43 | functions, fills the template | ||
| 44 | _classes/ Comment.php, Parsedown.php (erusev/parsedown, MIT), | ||
| 45 | Template.php | ||
| 46 | _data/ metadata.json (one object per post), comments.json | ||
| 47 | (written server-side as comments arrive) | ||
| 48 | _functions/ loadJSON.php, loadRSS.php, parseMarkdown.php, | ||
| 49 | submitComment.php | ||
| 50 | _templates/ template.html | ||
| 51 | posts/ markdown post bodies | ||
| 52 | static/ app.css, optional prism.css / prism.js for syntax | ||
| 53 | highlighting | ||
| 54 | #+end_example | ||
| 55 | |||
| 56 | metadata object: | ||
| 57 | |||
| 58 | #+begin_src sh | ||
| 59 | { | ||
| 60 | "id": "001", | ||
| 61 | "title": "Title of Post", | ||
| 62 | "author": "Your Name", | ||
| 63 | "description": "...", | ||
| 64 | "tag": "my-category", | ||
| 65 | "created": "2018-12-08 00:00:00", | ||
| 66 | "modified": "2018-12-08 00:00:00", | ||
| 67 | "link": "https://www.example.com/post/name.html", | ||
| 68 | "published": "Yes" | ||
| 69 | } | ||
| 70 | #+end_src | ||
| 71 | |||
| 72 | let the web user write comments.json (apache is usually www-data): | ||
| 73 | |||
| 74 | #+begin_src sh | ||
| 75 | chgrp -R www-data /path/to/website/ | ||
| 76 | chmod -R g+w _data/comments.json | ||
| 77 | #+end_src | ||