Skip to main content

URL structure

When i look at the url of fluent community, I noticed a couple of things. 1. The url is not really seo friendly, unless you think https://community.wpmanageninja.com/portal/space/community-meta/home?topic=idea

2 I also noticed community is in the url as a sub, then portal appears to be used for? Then space? These extra words make the url longer then it should be. Ie community.mydomain.com/this-is-my-post/ would have a cleaner look and feel for the url structure, everything else could be stored in a db or something.

Maybe someone can fill me in?

David Scurlock

Thomas Oates I understand but the over seo structure is a bit messy, not pretty seo at all. Post IDs can be stored in the db and does not need to be in the url, unless it can be shorted ie community.mydomain.com/29269/this-is-my-post/ as 29269 would be the post id for this post, anything else can be assigned to this post via database.

Case and point

https://community.wpmanageninja.com/portal/space/community-meta/post/url-structure?comment_id=29269

David Scurlock I think they need the comment id. And in the example you just gave the post = url-structure. I think the url reads quite well, especially if you have many spaces (like I do).

I like the /community(or portal if that's what you use)/course/[course-slug] structure. I don't have to go look up the link (I do for the posts because I don't normally remember the slugs). But I almost always have the first lesson called "welcome" which makes it easy so it's always /community/course/[course-slug]/lessons/welcome/view for the first lesson.

However, I don't like that you can't change the lesson slug if you change your mind on what the lesson is called. I have to create a new lesson so the slug matches.

David Scurlock

Wendy Shoef even a post id is not needed in the url. Take wp blog posts for example, do they contain ids and non useful words? Nope, all the post information is stored in the database.

The FC url structure needs to be as clean and neat as your most common wp urls.

David Scurlock

Wendy Shoef that would be a turn off for me, not everyone offers courses and lessons, and if I cant change the url then...

I will keep watching how FC unfolds but it's not for me at the moment.

Thomas Oates

David Scurlock The url doesn't include the post id. It includes the comment id if a particular comment is the intended target. I believe regular WordPress includes the comment id in the url as well if the comment is the intended target of the link. I don't have a WordPress sites with comments enabled but here is an example (https://loginpress.pro/wordpress-comments/#comment-31845).

David Scurlock

Thomas Oates I understand, however, FC just isn't for me at this time.

Digital Contact

Fixed =

<?php
if (!defined('ABSPATH')) {
exit;
}

/**

  • Greek -> Latin slugify for FluentCommunity feeds
    */
    function pn_fc_greek_slugify($text) {
    $text = trim((string) $text);

    if ($text === '') {
    return '';
    }

    $map = array(
    'Α'=>'a','Ά'=>'a','Β'=>'v','Γ'=>'g','Δ'=>'d','Ε'=>'e','Έ'=>'e','Ζ'=>'z',
    'Η'=>'i','Ή'=>'i','Θ'=>'th','Ι'=>'i','Ί'=>'i','Ϊ'=>'i','Κ'=>'k','Λ'=>'l',
    'Μ'=>'m','Ν'=>'n','Ξ'=>'x','Ο'=>'o','Ό'=>'o','Π'=>'p','Ρ'=>'r','Σ'=>'s',
    'Τ'=>'t','Υ'=>'y','Ύ'=>'y','Ϋ'=>'y','Φ'=>'f','Χ'=>'ch','Ψ'=>'ps','Ω'=>'o','Ώ'=>'o',

     'α'=>'a','ά'=>'a','β'=>'v','γ'=>'g','δ'=>'d','ε'=>'e','έ'=>'e','ζ'=>'z',
     'η'=>'i','ή'=>'i','θ'=>'th','ι'=>'i','ί'=>'i','ϊ'=>'i','ΐ'=>'i','κ'=>'k',
     'λ'=>'l','μ'=>'m','ν'=>'n','ξ'=>'x','ο'=>'o','ό'=>'o','π'=>'p','ρ'=>'r',
     'σ'=>'s','ς'=>'s','τ'=>'t','υ'=>'y','ύ'=>'y','ϋ'=>'y','ΰ'=>'y','φ'=>'f',
     'χ'=>'ch','ψ'=>'ps','ω'=>'o','ώ'=>'o',

    );

    $text = strtr($text, $map);

    // Ενώνει συντομογραφίες τύπου Ε.Ο.Π.Υ.Υ.
    $text = preg_replace('/(?<=\b[a-zA-Z]).(?=[a-zA-Z]\b)/', '', $text);
    $text = str_replace('.', ' ', $text);

    $text = strtolower($text);
    $text = pregreplace('/[^a-z0-9\s-]+/', ' ', $text);
    $text = pregreplace('/[\s-]+/', '-', $text);
    $text = trim($text, '-');

    return $text;
    }

/**

  • Attach custom creating hook after FluentCommunity loads
    */
    add_action('plugins_loaded', function () {
    if (!class_exists('\FluentCommunity\App\Models\Feed')) {
    return;
    }

    \FluentCommunity\App\Models\Feed::creating(function ($model) {
    $source = '';

     if (!empty($model->title)) {
         $source = $model->title;
     } elseif (!empty($model->message)) {
         $source = wp_strip_all_tags($model->message);
     }
    
     $custom_slug = pn_fc_greek_slugify($source);
    
     if ($custom_slug === '') {
         return;
     }
    
     $base_slug = $custom_slug;
     $slug = $base_slug;
     $count = 1;
    
     while (\FluentCommunity\App\Models\Feed::where('slug', $slug)->exists()) {
         $slug = $base_slug . '-' . $count;
         $count++;
     }
    
     // overwrite the plugin fallback slug
     $model->slug = $slug;

    });
    }, 20);

------ Try this one..