Open JesperFiltenborg opened 1 year ago
I can confirm that I ran into this issue as well.
Create a top-level page with slug: "test-af-already-taken" in the primary site/locale Create a top-level page with slug: "test-af-already-taken2" in all site/locales
Create a child page for: "test-af-already-taken2". ( This should work ) Create a child page for: "test-af-already-taken2" with the sites second site/locale. ( This should return a better error )
Just to clarify, you're creating the child entry in "Site A" first, then you're going into "Site B" and creating it there too? Is that when you're receiving the error?
I'm only able to replicate the same error if I:
@duncanmcclean The problem happens when i create a top-level entry in 2 languages. (Primary language) One called: test-af-already-taken (Secondary language) The other called: test-af-already-taken2
Then when i attempt to create a child page for: test-af-already-taken2 When i do this without creating a child page on the primary language i get the error. URL IS ALREADY TAKEN When the actual problem that happens is "page missing in primary language"
Can you provide your config/statamic/sites.php
file and the yaml file for the collection?
Hey @jasonvarga here is the sites.php and the yaml for the collection. Be aware that the collection uses some field sets, so you would need to change them in order for the code to run. But i get this issue with all my collection with that uses multiple languages and has a child pages.
Sites.php
<?php
return [
/*
|--------------------------------------------------------------------------
| Sites
|--------------------------------------------------------------------------
|
| Each site should have root URL that is either relative or absolute. Sites
| are typically used for localization (eg. English/French) but may also
| be used for related content (eg. different franchise locations).
|
*/
'sites' => [
'da' => [
'name' => 'Danish',
'locale' => 'da_DK',
'url' => env('APP_URL'),
'attributes' => [
'text' => 'Dansk',
'hreflang' => 'da-dk',
],
],
'en' => [
'name' => 'English',
'locale' => 'en_US',
'url' => env('APP_URL') . '/en/',
],
],
];
Collection yaml file
title: Overview
sections:
main:
display: Main
fields:
-
handle: title
field:
type: text
required: true
display: Name
localizable: true
width: 50
validate:
- required
-
handle: headline
field: common.headline
config:
width: 50
validate:
- required
-
handle: label
field: common.label
config:
width: 50
-
handle: description
field: common.description
config:
width: 50
seo:
display: SEO
fields:
-
import: seo
prefix: meta_
widget:
display: Widget
fields:
-
import: widget
prefix: widget_
sidebar:
display: Sidebar
fields:
-
handle: slug
field:
type: slug
localizable: true
validate:
- required
-
handle: theme
field: common.theme
config:
validate:
- required
-
handle: date
field:
type: date
required: true
display: Visible
mode: single
time_enabled: true
localizable: false
validate:
- required
-
handle: parent
field:
type: entries
collections:
- pages
max_items: 1
listable: true
localizable: true
create: false
-
import: last_edited
Bug description
I created a child page in 2 languages, and got the error "URL IS ALREADY TAKEN" on the second language. I expected it to return something like "parent page missing language {$site}".
How to reproduce
Create a top-level page with slug: "test-af-already-taken" in the primary site/locale Create a top-level page with slug: "test-af-already-taken2" in all site/locales
Create a child page for: "test-af-already-taken2". ( This should work ) Create a child page for: "test-af-already-taken2" with the sites second site/locale. ( This should return a better error )
Logs
No response
Environment
Installation
Fresh statamic/statamic site via CLI
Antlers Parser
None