Open NoobTaco opened 5 years ago
@NoobTaco That's the expected behavior of this Node.JS app. The filename
for each POST request is set to {fields.slug}
, which is a function of fields.title
, which is a function of Jekyll's {{ page.title }}
(or similar page variables in other static blog generators). Therefore, for the same {{ page.title}}
, {fields.slug}
is the same. When a blog entry receives the first comment, the file is named as _addons/{fields.slug}
. When the second comment is sent, the filename
is still _addons/{fields.slug}
, so this gives the above error.
editaddons:
allowedFields: [...]
generatedFields:
date:
type: date
slug:
type: slugify
options:
field: title
filename: '{fields.slug}'
path: '_addons'
To avoid this error, a common way is to group comment data files into the same subfolder :file_folder:, and use the timestamp for filename
. Here's a working example:
https://github.com/daattali/beautiful-jekyll/blob/5dca8a44ff42c8e8069a01a5364666cd2c8089c9/staticman.yml
Question seems to have been answered by @VincentTam. Resolved.
No, @NoobTaco is asking if it is possible to update an existing comment file and if so, how to do it, as github wants the sha code of the file to be updated. @VincentTam is talking about something different, grouping comments into subfolders respresenting the posts. Please reopen as it hasn't been answered and would be an awesome feature if comments could be edited/updated. Am not able to figure out where respectively if it is possible to add sha field somewhere in staticman codebase. Any help greatly appreciated. Thank you.
@danieldreke you're right, this doesn't appear to have actually been resolved. I will open this back up for discussion.
While such a feature would be possible, I feel like it would be open to abuse. Essentially anyone could send your API a request and overwrite any comment on your website, which seems dangerous. This is less dangerous with moderation enabled, but even so I can't imagine a way in which you'd be able to verify on the front end that the user requesting an edit is the same user that made the comment.
Without enabling comments to be edited, you could still add a reply feature to your website using nested comments. This would allow a user to reply to their original comment with some further clarification.
Hi @alexwaibel and thanks for reopening. Hmm, good point. What about the user has to reenter the e-mail-address he has provided when doing his comment or a password, set by the user or a generated code, sent to his mail, so that he can edit the comment later? and the code is added to comment file as field. I thought about using staticman for something like dynamic content and users do not need an account to edit a website or parts of a website or like editable/appendable access to parts of a website.
Sorry for super-late reply.
@danieldreke I see your point. I think OP's problem described in the question context doesn't require the feature request, which would have been much better to be put in a separate issue because of the one-issue-one-problem principle. Given that we've already started the discussion about the FR, I'll add my comment to the pile.
With respect to the recently established GPDR, I see a motive to ask the collector of static comments, which are a form of data, for a modification. However, let's think about the target users:
It seems technically possible, but who practically needs that?
I am trying to update a post that I created with staticman for my jekyll site.
Here is my config.
And the error I am getting when trying to overright the same file.
Is it possible to oversight? I am starting to think the sha message could be a key, but I am unsure how to proceed.
Thank you for any help.