Slug Length Issue
See original GitHub issueIs there a reason why the slug length is limited to 128?
I’m working on porting a commerce site and they have a ton of url’s longer than 128. I’m trying to figure out if I should implement my own routing & admin section for the e-commerce portion or try to push it into the piranha’s manager.
Other Questions: Am I taking the right approach? Is there a best practice/recommendation for this?
If I use piranha’s routing then I have a few obstacles:
My initial thought was to create a custom Piranha.Data.EF and override the HasMaxLength mb.Entity<Data.Page>().Property(p => p.Slug).HasMaxLength(128).IsRequired();
to something like 1024 <- I know ridiculously big (probably need something closer to 500)
mb.Entity<Data.Page>().Property(p => p.Slug).HasMaxLength(1024).IsRequired();
However, the public abstract class RoutedContentBase
in Core has it set as well, which will most likely throw a validation error (I haven’t tested it yet).
[StringLength(128)]
public string Slug { get; set; }
Finally, if I get past all of that, the manager has it hard-coded as too
<label>@Localizer.General["Slug"]</label>
<div class="input-group">
<input v-model="slug" type="text" maxlength="128" class="form-control">
<div class="input-group-append">
<div class="input-group-text text-muted">
{{ piranha.utils.strLength(slug) + "/128" }}
</div>
</div>
</div>
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (7 by maintainers)
Top GitHub Comments
I’m also interested in a slim e-commerce implementation with Piranha. I fully intend to try to do this once the “generic content model” changes are in and it’s easier to extend Piranha to handle more than just page/post/archive types.
I have also looked into the possibility in the past to integrate one of the available open source e-commerce systems for .net core with Piranha (like SimplCommerce or NoopCommerce). As these systems are designed to handle products I think this is a much more interesting solution to the problem that we would be very interested to collaborate on!