Multiple instances on the Same Site
See original GitHub issueEnhancement
Currently there is support for only one instance of Staticman per static site since the staticman property is a hash in the configuration file. For instance _config.yml
:
staticman:
name : "comments"
allowedFields : ['name', 'email', 'url', 'message']
branch : "master"
commitMessage : "New comment."
filename : comment-{@timestamp}
format : "yml"
moderation : true
path : "_data/comments/{options.slug}"
requiredFields: ['name', 'email', 'message']
transforms:
email : "md5"
I am wondering if more than one configuration could be specified if the staticman
property could be an array. Each hash in the array, requires an additional property name
, and in the submitted form, we must pass an additional required field options[name]
with the corresponding name
value so that the server can know which instance to use. This would be backward compatibility, since if the staticman
property is a hash, it behaves like it does in the current version, and if it is an array, it enables this new behaviour. For example:
staticman:
- name : "ideas"
allowedFields : ['title', 'description']
branch : "master"
commitMessage : "New idea."
filename : idea-{@timestamp}
format : "yml"
moderation : true
path : "_data/ideas/{options.slug}"
requiredFields: ['title', 'description']
- name : "comments"
allowedFields : ['name', 'email', 'url', 'message']
branch : "master"
commitMessage : "New comment."
filename : comment-{@timestamp}
format : "yml"
moderation : true
path : "_data/comments/{options.slug}"
requiredFields: ['name', 'email', 'message']
transforms:
email : "md5"
<form method="POST" action="https://api.staticman.net/v1/entry/my/repo/master">
<input name="options[name]" type="hidden" value="ideas">
<input name="options[slug]" type="hidden" value="{{ page.slug }}">
<label><input name="fields[title]" type="text">Title</label>
<label><textarea name="fields[description]"></textarea>Description</label>
<button type="submit">Submit Idea!</button>
</form>
<form method="POST" action="https://api.staticman.net/v1/entry/my/repo/master">
<input name="options[name]" type="hidden" value="comments">
<input name="options[slug]" type="hidden" value="{{ page.slug }}">
<label><input name="fields[name]" type="text">Name</label>
<label><input name="fields[email]" type="email">E-mail</label>
<label><textarea name="fields[message]"></textarea>Message</label>
<button type="submit">Submit Comment!</button>
</form>
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Multiple instances of a web site on a single server - upgrade ...
The issue is when I need to update the site (its code not the infrastructure). I think I could minimize downtime by taking...
Read more >One Website to be connected with Multiple EC2 Instance?
Since the data is not local to the instance anymore, you can easily have multiple instances all using the same storage.
Read more >What are the benefits of multiple instances? - Atlassian Support
An instance is a self-contained copy of a specific product. If you have a single instance of a product, everyone works together in...
Read more >Same site multiple instances with one DB - nopCommerce
Dears, We have a site developed using NopCommerce, we copied exactly same site on 3 different servers for load balancer.
Read more >Multiple instances of same page with different dynamic data
Open another instance of the same page, select another decoder and one can easily switch between the two. I hope that that makes...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Also, I’m thinking the name of the instance should be provided as part of the URL instead of relying on a form field, being such a crucial setting.
So something like:
With the name of the instance being optional.
I like this!
I think I would prefer to add this for version 2 of the endpoint (see #5 for more details). Sharing the configuration file with Jekyll was a design mistake, and “polluting” it to yet more Staticman-related stuff doesn’t seem ideal.
With version 2, we have a dedicated configuration file for Staticman, and in that case yes, absolutely. Maybe each instance could be a property within the main object and get rid of
name
, so something like:Does that sound reasonable?
Thanks for creating the issue.