Browse Source

Improved commenting system. Improved website structure. Various fixes.

gh-pages
frnmst/Franco Masotti 5 years ago
parent
commit
bdebbfba76
  1. 2
      Makefile
  2. 46
      README.md
  3. 0
      _assets/avatar.jpg
  4. 0
      _assets/by-sa.png
  5. 2
      _assets/core.scss
  6. 0
      _assets/favicon.png
  7. 0
      _assets/fonts/HiLo-Deco.ttf
  8. 0
      _assets/gravatar_wrapper.png
  9. 0
      _comments/2015-09-09-download-this-theme/0.md
  10. 0
      _comments/2017-02-11-another-post/0.md
  11. 0
      _comments/2017-02-11-another-post/1.md
  12. 34
      _config.yml
  13. 20
      _includes/comments.html
  14. 4
      _includes/footer.html
  15. 5
      _layouts/default.html
  16. 5
      _layouts/post.html
  17. BIN
      _media/2017-02-11-another-post_terminal.png
  18. 1
      _pages/404.md
  19. 1
      _pages/about.md
  20. 1
      _pages/feed.xml
  21. 1
      _pages/index.html
  22. 0
      _pages/robots.txt
  23. 8
      _posts/2015-09-09-download-this-theme.md
  24. 1
      _posts/2017-02-11-another-post.md
  25. 4
      assets/comments/2017-02-11-another-post.md

2
Makefile

@ -6,7 +6,7 @@
all: build serve
build:
@jekyll build
@jekyll build -V --safe -t
serve:
@jekyll serve

46
README.md

@ -17,7 +17,9 @@ type.
- Bigger font rendering
- Changed background colors
- `outline: none` for links
- Static comment system
- Static commenting system
- Tags and categories (TODO)
- <!--more--> tag support
## Commenting system
@ -36,29 +38,35 @@ for the `another-post` post. The `mailto` link will have this structure:
<your_gmail_email>+2017-02-11-another-post@gmail.com
You may notice the substring `2017-02-11-another-post` after the gmail's email.
You may notice the substring `2017-02-11-another-post` after the gmail's email
(but it works for any mailer system supporting these kind of mail aliases).
This string is part of the file name corresponding to the post which is:
./_posts/2017-02-11-another-post.md
Let's ingnore the `./_posts/` substring for a moment and save
`2017-02-11-another-post.md` somewhere. Since a post may have more than a
comment, we must distinguish between one and
another. To do this we identify each comment by adding a new
substring to the comment path, for example:
Let's ingnore the `./_posts/` and `.md` substrings for a moment and save
`2017-02-11-another-post` somewhere. Since a post may have more than a
comment, we must distinguish between one and another. To do this we create a
new directory using the comment path, like the following:
2017-02-11-another-post_0.md
$ mkdir _/comments/2017-02-11-another-post
The separator between the id `0` and the rest of the path must always be `_`.
If you receive another comment you can use `1`, and so on. Using numbers is
just a convention, you may use any string in this case.
and we will save the comment files inside to keep things tidy.
Out final comment file name is:
We then create a new markdown file corresponding to the comment, and its
file name will be used as an id, for example:
./comments/2017-02-11-another-post_0.md
0.md
You can use any non spaced string, and avoid using `.md` except at the end of
this file name.
Out final comment path is:
./comments/2017-02-11-another-post/0.md
As a final remark you may have noticed that each comment is referenced as a
paragraph and that markdown is enabled by default.
paragraph (using the id) and that markdown is enabled by default.
### Comment attributes.
@ -94,6 +102,10 @@ For example:
def hi
```
## Media
Unlike comments, media content may be referenced from more than one post...
## Avatar
Use a square avatar in `./assets/avatar.jpg` (more coming soon).
@ -114,12 +126,6 @@ directory easily.
$ make
## TODO
- Tags and categories.
- Add link to cc-by-sa page on respective picture.
- Misc.
## Screenshot
TODO

0
assets/avatar.jpg → _assets/avatar.jpg

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

0
assets/by-sa.png → _assets/by-sa.png

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

2
assets/core.scss → _assets/core.scss

@ -12,7 +12,7 @@
@font-face {
font-family: 'HiLo-DecoRegular';
src: url('{{ site.baseurl }}/fonts/HiLo-Deco.ttf');
src: url('{{ site.baseurl }}/assets/fonts/HiLo-Deco.ttf');
};
@import 'main';
@import 'syntax';

0
assets/favicon.png → _assets/favicon.png

Before

Width:  |  Height:  |  Size: 418 B

After

Width:  |  Height:  |  Size: 418 B

0
fonts/HiLo-Deco.ttf → _assets/fonts/HiLo-Deco.ttf

0
assets/gravatar_wrapper.png → _assets/gravatar_wrapper.png

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

0
_comments/2015-09-09-download-this-theme_0.md → _comments/2015-09-09-download-this-theme/0.md

0
_comments/2017-02-11-another-post_0.md → _comments/2017-02-11-another-post/0.md

0
_comments/2017-02-11-another-post_1.md → _comments/2017-02-11-another-post/1.md

34
_config.yml

@ -10,7 +10,8 @@ avatar_path: avatar.jpg
# Site Settings
baseurl: "" # Base URL must end WITHOUT a slash, default: ""
permalink: /notes/:title # Post permalink
permalink: /notes/:title # Post permalink. If you change this you must
# modify all the occurencies manually.
timezone: Europe/Rome # https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# Site Build
@ -22,15 +23,21 @@ sass:
style: :compressed
# Other Params
include: [ "robots.txt" ]
include: [ "_pages" ]
exclude: [ "LICENSE", "README.md", "CNAME", "vendor", "Gemfile", "Makefile" ]
gems:
- jekyll-sitemap
# Keep comments hidden
collections:
- comments
# comments:
# output: true
comments:
output: false
pages:
output: false
media:
output: true
assets:
output: true
defaults:
-
@ -48,27 +55,22 @@ defaults:
type: "posts"
values:
layout: "post"
-
scope:
path: ""
type: "posts"
values:
is_post: true
-
scope:
path: "index.html"
path: "_pages/index.html"
values:
is_home: true
-
scope:
path: ""
type: comments
path: "_pages/404.md"
values:
layout: comment
is_404: true
-
scope:
type: "comments"
path: "comments"
type: comments
values:
layout: comment
is_comment: true
# layout: page

20
_includes/comments.html

@ -14,17 +14,14 @@
{% assign mail_domain = mail_substring[1] %}
<div class="title"><h3><a href="mailto:{{ mail_username }}+{{ page.path | remove: ".md" | remove:"_posts/" }}@{{ mail_domain }}">Post a new comment</a></h3></div>
<!-- Reference to comments here -->
{% for comment in site.comments %}
{% assign page_realid = page.id | replace: "/notes/", "" %}
{% assign comment_realid = comment.id | replace: "/comments/", "" %}
{% assign comment_metadata = comment_realid | split: '_' %}
{% assign comment_realid = comment_metadata[0] %}
<!-- Can be used to reference comment as paragraph -->
{% assign comment_number = comment_metadata[1] %}
{% assign page_path = page.path | replace: "_posts/", "" | remove: ".md" %}
{% assign comment_fullpath = comment.path | replace: "_comments/", "" | split: "/" %}
{% assign comment_path = comment_fullpath[0] %}
{% assign comment_id = comment_fullpath[1] | remove: ".md" %}
{% if comment_realid == page_realid %}
{% if comment_path == page_path %}
{% if forloop.first == true %}
<div class="divider"></div>
{% endif %}
@ -35,8 +32,10 @@
<table>
<tr>
<td>Subject</td>
{% comment %}
<!-- Link to single comment -->
<td><a href="#{{ comment_number }}" id={{ comment_number}}>{{ comment.subject }}</a></td>
{% endcomment %}
<td><a href="#{{ comment_id }}" id={{ comment_id}}>{{ comment.subject }}</a></td>
</tr>
<tr>
<td>From</td>
@ -52,7 +51,9 @@
</b>
{{ comment.content | markdownify }}
{% comment %}
<!-- Don't print the divider after the last comment -->
{% endcomment %}
{% if forloop.last == false %}
<div class="divider"></div>
{% endif %}
@ -66,4 +67,3 @@
</article>
</div>

4
_includes/footer.html

@ -5,7 +5,9 @@
</span>
<span class="block">
Website content is released under the
<img src="{{ site.baseurl }}/assets/by-sa.png" width="80px" height="auto" alt="CC-BY-SA"> license
<img src="{{ site.baseurl }}/assets/by-sa.png" width="80px"
height="auto"
alt="CC-BY-SA"> license
</span>
<span class="block">
&copy; {{ site.time | date: '%Y' }} {{ site.author_name }}

5
_layouts/default.html

@ -13,7 +13,10 @@
{{ content | replace: '&#8617;', '&#8617;&#xfe0e;' }}
</main>
{% if page.is_home != true %}
{% comment %}
Can't use == false since page.is_home might be undefined.
{% endcomment %}
{% if page.is_home != true and page.is_404 != true %}
{% include comments.html %}
{% endif %}

5
_layouts/post.html

@ -6,7 +6,10 @@ layout: default
<div class="center">
<h1>{{ page.title }}</h1>
<time>{{ page.date | date: '%B %-d, %Y' }}</time>
<time>First written on {{ page.date | date: '%B %-d, %Y' }}</time>
<br />
<br />
<time>Last updated on {{ page.updated | date: '%B %-d, %Y' }}</time>
</div>
<div class="divider"></div>

BIN
_media/2017-02-11-another-post_terminal.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

1
404.md → _pages/404.md

@ -1,6 +1,7 @@
---
layout: page
title: 404
permalink: 404.html
---
:(

1
about.md → _pages/about.md

@ -1,6 +1,7 @@
---
layout: page
title: About
permalink: /about/
---
Hello.

1
feed.xml → _pages/feed.xml

@ -1,5 +1,6 @@
---
layout: null
permalink: feed.xml
---
<?xml version="1.0" encoding="utf-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom">

1
index.html → _pages/index.html

@ -1,5 +1,6 @@
---
layout: default
permalink: index.html
---
<section>

0
robots.txt → _pages/robots.txt

8
_posts/2015-09-09-download-this-theme.md

@ -1,8 +1,10 @@
---
title: Download this Theme
updated: 2015-09-09 10:38
updated: 2017-04-09 00:29
---
The Plain is just another white clean and minimalist Jekyll theme that designed to focus on writing matters. This theme is best use for personal blog type. Font or typeface used is Karla from Google Web Fonts.
The Plain Libre is just another white clean and minimalist Jekyll theme that
designed to focus on writing matters. This theme is best use for personal blog
type. Font or typeface used is HiloDeco.
> **_Fork_** or **_download_** the theme [**here**](https://github.com/heiswayi/the-plain).
> **_Fork_** or **_download_** the theme [**here**](https://github.com/frnmst/the-plain-libre).

1
_posts/2017-02-11-another-post.md

@ -4,3 +4,4 @@ updated: 2017-02-11 23:37
---
Hello again!

4
assets/comments/2017-02-11-another-post.md

@ -1,4 +0,0 @@
From: x.y@z.w
Date an time: ...
This is a test coment for the `Hello again` post.