Skip to content
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

Copying page in Admin makes resulting page have same slug #394

Closed
paulhibbitts opened this issue Jan 15, 2016 · 13 comments
Closed

Copying page in Admin makes resulting page have same slug #394

paulhibbitts opened this issue Jan 15, 2016 · 13 comments
Assignees

Comments

@paulhibbitts
Copy link
Contributor

When copying a page the slug of the new page does not seem to get changed, and is the exact same slug as the original page which then causes various issues.

I've attached a screenshot, look at the new copy folder name field vs. slug field.

edit grav cms for educators flipping your lms with an open and collaborative web platform designing and building open source learning environments 2016-01-14 17-21-06

To repeat issue:

  1. Open existing page
  2. Click "copy" button
  3. Go back to page list
  4. Open newly created page
  5. View slug on "Advanced" pane

Thanks very much,
Paul

@flaviocopes
Copy link
Contributor

What you suggest, adding *-copy to the slug?

@paulhibbitts
Copy link
Contributor Author

Hi Flavio,

I think we want to make it align with the current naming scheme logic, which seems to be using a " - #" format where # is either 2 or adding 1 to the existing value.

So, let's say there is a page called "New Page" and we make a copy. Here is what I would expect:

Copied page

  • title: "New Page 2" (currently it is not, just the same title as orig - I suggest we change it)
  • folder : "new-page-2" (currently as-is)
  • slug: "new-page-2" (currently it is not, just the same slug orig. This is not an issue if no slug is defined on original page as new page slug field is then left blank)

What do you think?

Thanks very much,
Pau

@flaviocopes
Copy link
Contributor

👍 sounds good!

@flaviocopes flaviocopes self-assigned this Jan 15, 2016
flaviocopes added a commit that referenced this issue May 2, 2016
…ing a copy of the page

Does not change the page title, just the page route property if set in
the header, to avoid two pages with the same slug / route / raw route.
@flaviocopes
Copy link
Contributor

Created a PR to solve this. Works at the basic level, still need to test with multilanguage and edge cases.

@flaviocopes
Copy link
Contributor

Doing final tests to merge this

flaviocopes added a commit that referenced this issue Jun 7, 2016
…ing a copy of the page (#537)

Does not change the page title, just the page route property if set in the header, to avoid two pages with the same slug / route / raw route. Handles ordering too, and pages with custom slug. Independently updates the slug and the folder name.
@flaviocopes
Copy link
Contributor

Fixed by #537

@flaviocopes
Copy link
Contributor

@paulhibbitts give it a try when you have time, just to make sure there are no issues I didn't find

@paulhibbitts
Copy link
Contributor Author

This is really awesome @flaviocopes! I've been able to do some testing and looks like a winner 👍

This is a perfect way to blow the mind of a WordPress person... 'you can even have two or more blogs in one Grav site, look it's so easy just a simple page copy and you're done.' 😉

@paulhibbitts
Copy link
Contributor Author

So everything is working really nicely, but I think there will be less possible user confusion if the new title of copied pages is also updated.

For example, I have a page called ‘My Apple’ with the slug ‘apple’. After making a page copy I have ‘My Apple 2” with the slug ‘apple-2’.

Another example is that I have a page called 'Home' with the default slug 'home. After making a page copy I have "Home 2" with the slug 'home-2'.

@flaviocopes
Copy link
Contributor

Should now be fixed in develop. Copy "Test", the title is "Test 2". Copy "Test 2", the new title is "Test 3", and so on.

@paulhibbitts
Copy link
Contributor Author

Thanks very much Flavio. I did some tests on noticed one issue:

If you start with 'Home' and make a copy you get 'Home 2' and 'home-2'. Make a copy of that and you get 'Home 3' and 'home-3' - perfect :-)

However if you at this point make another copy of 'Home 2' you get a page named 'Home 3' but with the right slug 'home-4'. Here is a snapshot:

2016-06-15_06-46-02

If the name # could match the slug # then I think it's good to go.

Thanks again,
Paul

@flaviocopes
Copy link
Contributor

I did this on purpose - the slug must be unique, the title does not.

The usage most likely is to copy a page one time, so you get its title + "2".

If you want to copy it again, you'll get the page title + "3", but it's unlikely you'll keep the title the same on all pages.

@paulhibbitts
Copy link
Contributor Author

Sounds fine, thanks. It is a more extreme use case I am testing with - as you say more likely to copy one page at a time and then change page names too.

Great to have page copying working even better in the new Admin Panel 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants