-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to change slug on edit #308
Comments
Just a thought, but might want the slug edit to be implicit by adding a editable field for edit view only.
|
it would be wonderful to have this feature |
When I get a little time this weekend I'll look at doing a PR for that. Something similar to how WordPress managed permalink changes. |
Btw, just tried a stupid thing. I edited the DOM from my browser inspector. <input value="what-the-slug-is-this" label="URL Slug" type="text" disabled="true" placeholder="Will be set automatically" name="slug"> Then save, it works. 👍 Not sure if it's expected or not |
That might be all you need. I'll still take swat at it. Just remove the style. Adding a button that
makes that field editable might be a good idea. I want to check for
unwanted words, like "the, a, and. . . ." since Google Search ignores them.
But not sure if that's what every user wants.
|
Found out, it doesn't work as expected. while I can retrieve the item using the original slug {
"data": [
{
"uuid": "eeb0b6ed-ddda-4738-adae-7a3c8ef5d653",
"id": 4,
"slug": "what-the-slug-is-this",
"timestamp": 1558083709000,
"updated": 1558162849040,
"title": "what the slug is this",
"content": "update pls<br>",
}
]
} still need help to update slug and make the item retrievable by the edited slug |
Will do and update here. |
if you override the item's implementation of // provide custom slug here
func (a *Article) ItemSlug() string {
return strings.Replace(a.Title, " ", "-", -1)
} |
Hi guys, I've opened a PR for this issue. If you have time, please take a look at #309 |
#309 just got merged into ponzu-dev. @junnotantra thanks on behalf of the Ponzu community for your work on that, it will be useful for a good number of users. Closing this issue |
Hi, I'm able to customize my slug by overriding
String()
When I make an item with title
what the slug
, the slug will bewhat-the-slug
But this only happen when the item was first created. When I edit the title to be
what the slug is this
, I want the slug to change towhat-the-slug-is-this
instead of keeping the original slugwhat-the-slug
. Is this possible?I've tried to update the slug on
BeforeSave()
but changing the slug there not work as expected.Btw, thanks for the awesome CMS 👍
The text was updated successfully, but these errors were encountered: