willowf's picture

Hey, community!

The past few weeks have been pretty busy with my project, but it’s turning out amazing—thanks to all of you and Backdrop!

I have a new question: I created a view to display user posts, simulating a personal blog for each user. So far, everything is working fine. However, I need to change the URL format I’ve set up, which currently looks like this:

user/%/

Right now, user profiles follow this structure:

The issue is that the second URL isn’t very user-friendly.

I came across another thread suggesting a structure like:
/blog/[node:author:uid]/[node:created:raw], but I don’t want the URL to be too long or complex.

Any suggestions on how to make it cleaner and more consistent with user profiles?

 

Comments

For the view, I would possibly go with something like:

/blog/[user:name]

Where [user:name] would either be a user name like a handle or could be the Real Name which is overridden if that module is installed.

For posts, I would go with something like:

/blog/[user:name]/[node:nid]/[node:title]

Or

/blog/[user:name]/[node:published:custom:Y-m-d]/[node:title]

You want something in there, either date or nid that will make the URL unique if they decide to do more than 1 post with the same title.

 

Hello. Why I proposed /blog/[node:author:uid]/[node:created:raw]

1. The path will really look short and unique, like /blog/1/1741172018 (beauty in the eyes of the one who looks),
2. You can create a universal Views page that will display all user entries, receiving Uid from URL /blog/[uid].

As a result, what logic:
/blog/1 — all nodes of the user 1,
/blog/1/1741172018 — separate entry of the user 1.

You can replace [node:created:raw] of your choice, but 
1. the date of creation RAW gives a unique and short URL, even if two users created an entry in one minute (I had such a case) will be different Uid,
2. not connected with Title as[node:title], If you later want to change the heading of the publication, the old text will remain in the URL,
3. why  [node:author:uid] - in various Vievs you can always get and give Uid, to create links or get content specific user.

And, by the way, you can make a universal Views block “About the Author” on each blog page, with information about the author of the post, by receiving Nid from the URL.

You can create a universal Views page that will display all user entries.

1. Create new Views page, of Content.
2. Page settings – Path: blog/%
3. Contextual filters - Content: Author uid
-- Provide default value - User ID from URL
-- When the filter value IS in the URL or a default is provided - Override title - %1
-- Specify validation criteria - User - Allow both numeric UIDs and string usernames
4. Relationships - Content: Content author
5. Filter - Blog content type
6. Format, Sort criteria - as usual

Now, when the go to /blog/[any_real_user_id], you must see all the nodes of this user, and the user name in the page title.

Place the link to all user posts /blog/[user_id]
-- on the user profile page,
-- or in the block “About the Author” as I wrote earlier,
-- or in any other way, as fantasy will allow you.