question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Slug Length Issue

See original GitHub issue

Is 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:closed
  • Created 3 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
i-love-codecommented, Jun 1, 2020

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.

1reaction
tidyuicommented, Jun 1, 2020

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Resolved] Slug length limited to 20 characters
Problem : I would like to use a URL path that includes more than 20 characters, but custom post type slugs are limited...
Read more >
Maxlength attribute not respected by Slug field · Issue #3286
If the Slug input field reaches its max length, no new characters should be appended to it unless any are deleted before that....
Read more >
URL Slug for SEO: What it is and best practices - Conductor
There is no such thing as a perfect slug length.There's no exact number of characters you should use, but there are some guidelines...
Read more >
Is there a maximum slug length?
Due to wp_posts table structure the length of post_name column (the column for slugs) is equal to 200 characters.
Read more >
Character limit for slugs
When setting up a Google Responsive Search Ad, I'm limited to 15 characters for the slug. Yoast says that my Focus KeyPhrase for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found