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

[5.x]: Sites & localization: sites cannot be duplicated with content preservation of desired existing site #15698

Closed
martijnvhummel opened this issue Sep 9, 2024 · 1 comment
Labels

Comments

@martijnvhummel
Copy link

What happened?

Description

For our client, we have an existing multi language Craft setup with multiple sites: a separate site for each country.
There are already hundreds of entries with content per site (country).

To clarify: when talking about site(s), we are talking about sites within the same craft setup (settings > Sites).

Example list of site names, for each site a country code:

  • (DE) -> German language
  • (NL) -> Dutch language
  • (UK) -> English language
  • (BE/FR) -> French language
  • (FR) -> French language
  • (AT) -> German language

Some sites (should) have the same content, in the same language. For example DE (Germany), AT (Austria) and CH_DE (Swiss, German variant). In this case, it would be desired, for example when creating a new CH/DE (German language) site, the existing DE (German) site could be duplicated with the same content, but obviously with unique new Name, Handle and Base URL.

However: when creating a new site (settings > Sites > "+ New site") for a new country, there is no way to (optionally) select another existing site from where entries/content should be duplicated from.
In other words: it's currently not possible to duplicate an existing site, including content.
Currently, after adding a new site and enabling the new site on all existing sections, the newly added site's sections are 'randomly' filled with content of another site (the FR French site in this case). When a newly added site's entries would be filled with content of the 'default' site, it would have made more sense, but the FR (French) site is neither the first site of the settings' site list, nor the default site.

Scherm­afbeelding 2024-09-09 om 14 42 35

Example image showing FR (French) content duplicated from undesired FR site, on newly added (DE) site.

Basically in this case there are 2 types of issues and unexpected behaviour:

  1. It is not possible to duplicate an existing site, including/persisting content of an optionally selected existing site.
  2. When creating a new site, the newly added site is filled with content of a 'random' other existing site, instead of content from a desired site.

Using the same site for multiple countries is not possible as a workaround, because unique content for some entries on each site is also desired.

Steps to reproduce

  1. Create Multiple sites in the Craft setup, for each site a different country.
  2. Fill entries with language-specific content for each site.
  3. Create a new site, that should have the same language content as an existing site.
  4. Enable the newly added site to existing sections.
  5. Result: newly added site's content is a copy of an undesired existing site, instead of one by choice.

Expected behaviour

When creating a new site (settings > Sites > "+ New site"), optionally, an existing site can be selected to duplicate existing content from. Resulting in a duplication of the selected site, including content in that language, but obviously with unique Name, Handle and Base URL for the newly created site.
In other words: when site A with language 1 and site B with language 2 already exist, it is possible to add new site C with entry content duplicated from site A with language 1.

Actual behaviour

When creating a new site (settings > Sites > "+ New site", it is not possible to (optionally) select an existing site to duplicate from, thus, after enabling the newly added site on all sections, the newly added site's entries are filled with the same content of an undesired other existing site.

Craft CMS version

Craft Pro 5.2.4.1

PHP version

8.2.13

Operating system and version

Linux 6.5.11-linuxkit

Database type and version

MySQL 8.0.33

Image driver and version

Imagick 3.7.0 (ImageMagick 6.9.11-60)

Installed plugins and versions

  • Feed Me: 6.1.0
  • Redactor: 4.1.0
  • Redactor Anchors: 1.5.0
  • SEO: v5.0.0-rc4
  • Super Table: 4.0.1
  • Typed link field: dev-main
  • Webhooks: 3.1.0
@i-just
Copy link
Contributor

i-just commented Sep 10, 2024

Hi, thanks for getting in touch and for a clear description!

It is not possible to duplicate an existing site, including/persisting content of an optionally selected existing site.

Yes, that’s not currently possible, but we are working on a copy field values from other sites functionality. Here’s a related discussion and a draft PR, where you can follow along.

Currently, after adding a new site and enabling the new site on all existing sections, the newly added site's sections are 'randomly' filled with content of another site (the FR French site in this case). When a newly added site's entries would be filled with content of the 'default' site, it would have made more sense, but the FR (French) site is neither the first site of the settings' site list, nor the default site.

Which site will be used to copy the content from depends on whether the section is enabled for the default site or not. If the default (primary) site is enabled for the section, then it’s the one that should be used. Otherwise, the site with the lowest sortOrder value in the sites table should be used. (The site that shows at the top of the Settings > Sites > All sites list doesn’t have to have the lowest sortOrder.)

I hope this clarifies things.

@i-just i-just closed this as completed Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants