Browse Source

- Replaced comment code with a simple link.

- Updated about page.
- Updated readme.
dev
Franco Masotti 4 weeks ago
parent
commit
ee1ac51c47
Signed by: frnmst
GPG Key ID: 24116ED85666780A
  1. 96
      README.md
  2. 9
      _config.yml
  3. 43
      _includes/comments.html
  4. 0
      _layouts/comment.html
  5. 2
      _layouts/default.html
  6. 32
      _pages/about.md

96
README.md

@ -25,18 +25,15 @@
- [Self-hosted](#self-hosted)
- [GitLab Pages](#gitlab-pages)
- [Tutorial](#tutorial)
- [Commenting system](#commenting-system)
- [Overview](#overview)
- [Comment attributes](#comment-attributes)
- [Media files](#media-files)
- [Overview](#overview-1)
- [Overview](#overview)
- [File locations](#file-locations)
- [Possible combinations](#possible-combinations)
- [Calling files from another post](#calling-files-from-another-post)
- [Notice and warning](#notice-and-warning)
- [Static pages](#static-pages)
- [Tags and categories](#tags-and-categories)
- [Overview](#overview-2)
- [Overview](#overview-1)
- [The tags score system](#the-tags-score-system)
- [Until version `0.0.5`](#until-version-005)
- [Since version `0.1.0`](#since-version-010)
@ -174,89 +171,6 @@ pages:
## Tutorial
### Commenting system
#### Overview
This theme handles comments in the most static way possible:
a `mailto` unique URI is generated for each post, using the address specified
in the `_config.yml` file. The original idea implemented a system of mail aliases
like [this](https://caurea.org/2012/03/31/this-blog-has-comments-again.html).
It is not always possible to use aliases so a different solution using a `subject`
query is now implemented (see the [Mailto](https://en.wikipedia.org/wiki/Mailto)
article).
For each post a comment section gets exposed. To get comments inside
this section, you must create a new file in the `_comments` directory using the
corresponding posts path name as file name. Let's say a user sends a comment
for the `another-post` post. The `mailto` URI will have this structure:
mailto:<your_email>?subject=2017-02-11-another-post
The `2017-02-11-another-post` substring is obtained from the post's file name:
./_posts/2017-02-11-another-post.md
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:
$ mkdir _/comments/2017-02-11-another-post
and we will save the comment files inside to keep things tidy.
We then create a new markdown file corresponding to the comment, and its
file name will be used as an id, for example:
0.md
The filename must not have whitespace characters and the substring `.md` except
at the end of it.
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 (using the HTML `id` attribute) and that markdown is enabled by
default.
#### Comment attributes
Comment files have 5 attributes:
- `layout`
- Always use `comment` as variable.
- `date`
- Use the format reported by the following date command:
$ date "+%F %T %z"
- `from`
- string representing the name or the id or the mail of the person that
commented the post.
- `subject`
- String representing the mail subject.
For example:
---
layout: comment
title: This is another post
date: 2017-02-11 23:37:05 +0100
from: x.y@y.x, A Mailer
subject: test subject
---
This is a test comment for the `Hello again` post.
```python
def hi
```
### Media files
Extending [these](https://eduardoboucas.com/blog/2014/12/07/including-and-managing-images-in-jekyll.html)
@ -264,9 +178,9 @@ ideas I came up with the following:
#### Overview
Just like comments, each media file is contained in one directory corresponding
to a post. However, unlike comments, media content may be referenced from more
than one post. This is how it works.
Each media file is contained in one directory corresponding
to a post. Media content may be referenced from more
than one post.
#### File locations

9
_config.yml

@ -78,10 +78,7 @@ feeds:
# Keep last max_posts posts in RSS/Atom feeds.
max_posts: 10
# Keep comments hidden
collections:
comments:
output: false
pages:
output: false
media:
@ -132,11 +129,9 @@ defaults:
is_sitemap: true
-
scope:
path: "comments"
type: "comments"
path: "_pages/about.md"
values:
layout: "comment"
is_comment: true
is_about: true
## Other Params
include: [ "_pages"]

43
_includes/comments.html

@ -1,42 +1 @@
<div>
{% capture mail %}{{ site.author.email }}{% endcapture %}
{% if page.is_post %}
{% capture mailto_subject %}{{ page.path | remove: ".md" | remove: "_posts/" | urlencode }}{% endcapture %}
{% else %}
{% capture mailto_subject %}{{ page.path | remove: ".html" | remove: ".md" | remove: "_pages/" | urlencode }}{% endcapture %}
{% endif %}
<div>
<h3>
<a href="mailto:{{ mail }}?subject={{ mailto_subject }}">
Post a new comment</a>
</h3>
</div>
<div>
{% assign comment_counter = 0 %}
{% assign comments = site.comments | sort | reverse %}
{% for comment in comments %}
{% 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_path == page_path %}
{% assign parity_check = comment_counter | modulo: 2 %}
{% if parity_check == 0 %}
{% assign parity = "even" %}
{% else %}
{% assign parity = "odd" %}
{% endif %}
<a href="#comment-{{ comment_id }}" id="comment-{{ comment_id }}" class="{{ parity }}">
<div>
<div>Subject: {{ comment.subject }}</div>
<div>From: {{ comment.from }}</div>
<div>Arrived on: {{ comment.date | date: "%b %e %Y, %R %Z" }}</div>
{{ comment.content | markdownify }}
</div>
</a>
{% assign comment_counter = comment_counter | plus: 1 %}
{% endif %}
{% endfor %}
</div>
</div>
<h3><a href="{{ site.baseurl }}/about#comments">Comments</a></h3>

0
_layouts/comment.html

2
_layouts/default.html

@ -30,7 +30,7 @@ layout: compress
{% endif %}
{% comment %}Can't use == false since page.is_home might be undefined{% endcomment %}
{% if page.is_home != true and page.is_404 != true and page.is_tags != true and page.is_sitemap != true %}
{% if page.is_home != true and page.is_404 != true and page.is_tags != true and page.is_sitemap != true and page.is_about != true %}
<hr>
{% include comments.html %}
{% endif %}

32
_pages/about.md

@ -4,36 +4,26 @@ title: About
permalink: /about/
---
## Presentation
Software, hardware, hacks, technology, etc...
This blog tells my experiences with [free software](https://www.gnu.org/philosophy/free-sw.en.html),
[free hardware](https://www.gnu.org/philosophy/free-hardware-designs.en.html), computing, "hacks",
technology and whatever comes to my mind I want to share.
I hope these posts turns out to be useful.
I hope this turns out to be a useful blog for anyone who encounters
similar computer science problems.
## Comments
## Comment rules
You can add a comment by opening an issue on the blog repository:
Every post (and some other pages like this one) contains a comment section which
is just a `mailto` link to one of my emails.
When you send me an email I will report certain elements
verbatim, such as:
- the subject
- the sending date
- your name, if present, or your email if you request so in the comment. If
none is available I will simply use `anonymous` in this field.
- the content which can be written in markdown
- [canonical repository](https://software.franco.net.eu.org/frnmst/blog/issues)
- [Codeberg](https://codeberg.org/frnmst/blog/issues)
- [Framagit](https://framagit.org/frnmst/blog/issues)
## Contacts
- [my canonical repositories](https://software.franco.net.eu.org/)
- [my canonical repositories](https://software.franco.net.eu.org/frnmst)
- [Codeberg](https://codeberg.org/frnmst)
- [Framagit](https://framagit.org/frnmst)
- [GitHub](https://github.com/frnmst) (abandonment phase)
- mail one (franco \D\o\T masotti {-A-T-} tutanota \D\o\T com)
- mail two (franco \D\o\T masotti \D\o\T 1 {-A-T-} protonmail \D\o\T com)
- [GitHub](https://github.com/frnmst) (see [this post]({% post_url 2021-09-02-quitting-github %}.html))
- franco \D\o\T masotti {-A-T-} tutanota \D\o\T com
- franco \D\o\T masotti \D\o\T 1 {-A-T-} protonmail \D\o\T com
- [ORCID iD](https://orcid.org/0000-0002-1736-3858)
## My PGP public key

Loading…
Cancel
Save