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

Add support for importing page aliases and external links #50

Open
wants to merge 40 commits into
base: master
Choose a base branch
from

Conversation

mlocati
Copy link
Contributor

@mlocati mlocati commented Jan 17, 2025

@mlocati mlocati force-pushed the import-aliases-externallinks branch 3 times, most recently from e459ddb to 825d477 Compare January 23, 2025 13:32
@mlocati mlocati force-pushed the import-aliases-externallinks branch from 825d477 to a48e779 Compare January 23, 2025 13:49
@mlocati mlocati force-pushed the import-aliases-externallinks branch from 1bcd6df to 1bcafb4 Compare January 28, 2025 15:13
@mlocati mlocati marked this pull request as ready for review January 28, 2025 16:20
@mlocati
Copy link
Contributor Author

mlocati commented Jan 28, 2025

This PR should be ready, it should be able to import a CIF like this:

<?xml version="1.0" encoding="UTF-8"?>
<concrete5-cif version="1.0">
    <pages>
        <page name="Home" path="" public-date="2023-02-14 09:06:18" filename="" pagetype="page" template="full" user="admin" description="" package="" root="true">
            <locale language="en" country="US"/>
            <hreflang>
                <alternate locale="fr_FR" path="/fr" />
                <alternate locale="it_IT" path="/it" />
            </hreflang>
            <area name="Main">
                <blocks>
                    <block type="content">
                        <style>
                            <borderWidth>2px</borderWidth>
                            <borderColor>rgba(255,0,0,1)</borderColor>
                            <borderStyle>solid</borderStyle>
                            <borderRadius>10px</borderRadius>
                        </style>
                        <data table="btContentLocal"><record><content>Content for page '/'</content></record></data>
                    </block>
                </blocks>
            </area>
        </page>
        <page name="Home IT" path="/it" user="admin" public-date="2025-01-16 16:00:22" filename="" pagetype="" template="full" description="" root="true" package="">
            <locale language="it" country="IT"/>
            <hreflang>
                <alternate locale="en_US" path="/" />
                <alternate locale="fr_FR" path="/fr" />
            </hreflang>
            <area name="Main">
                <blocks>
                    <block type="content">
                        <style>
                            <borderWidth>2px</borderWidth>
                            <borderColor>rgba(255,0,0,1)</borderColor>
                            <borderStyle>solid</borderStyle>
                            <borderRadius>10px</borderRadius>
                        </style>
                        <data table="btContentLocal"><record><content>Content for page '/it'</content></record></data>
                    </block>
                </blocks>
            </area>
        </page>
        <page name="Home FR" path="/fr" user="admin" public-date="2024-11-07 13:37:00" template="full" root="true">
            <locale language="fr" country="FR" />
            <hreflang>
                <alternate locale="en_US" path="/" />
                <alternate locale="it_IT" path="/" />
            </hreflang>
            <area name="Main">
                <blocks>
                    <block type="content">
                        <style>
                            <borderWidth>2px</borderWidth>
                            <borderColor>rgba(255,0,0,1)</borderColor>
                            <borderStyle>solid</borderStyle>
                            <borderRadius>10px</borderRadius>
                        </style>
                        <data table="btContentLocal"><record><content>Content for page '/fr'</content></record></data>
                    </block>
                </blocks>
            </area>
        </page>
        <page name="Example" path="/example" user="admin" public-date="2024-11-07 13:37:54" filename="" pagetype="page" template="full" package="">
            <additional-path path="/test" />
            <hreflang>
                <alternate locale="fr_FR" path="/fr/exemple" />
            </hreflang>
            <area name="Main">
                <blocks>
                    <block type="content">
                        <style>
                            <borderWidth>2px</borderWidth>
                            <borderColor>rgba(255,0,0,1)</borderColor>
                            <borderStyle>solid</borderStyle>
                            <borderRadius>10px</borderRadius>
                        </style>
                        <data table="btContentLocal"><record><content>Content for page '/example'</content></record></data>
                    </block>
                </blocks>
            </area>
        </page>
        <page name="Exemple" path="/fr/exemple" user="admin" public-date="2024-11-07 13:37:00" filename="" pagetype="page" template="full" package="">
            <hreflang>
                <alternate locale="en_US" path="/example" />
            </hreflang>
            <area name="Main">
                <blocks>
                    <block type="content">
                        <style>
                            <borderWidth>2px</borderWidth>
                            <borderColor>rgba(255,0,0,1)</borderColor>
                            <borderStyle>solid</borderStyle>
                            <borderRadius>10px</borderRadius>
                        </style>
                        <data table="btContentLocal"><record><content>Content for page '/fr/exemple'</content></record></data>
                    </block>
                </blocks>
            </area>
        </page>
        <external-link name="External Link" path="/fr/go-out" destination="https://path.to/url?p1=one&amp;p2=two" new-window="true" user="admin" public-date="2024-11-09 12:38:54" package="" />
        <alias name="Alias Name" path="/fr/alias" original-path="/fr/exemple" user="admin" package="" />
        <page name="/a/b" path="/a/b" user="admin" public-date="2024-11-07 13:37:00" pagetype="page" template="full" />
        <alias name="/d" path="/d" original-path="/a/b" user="admin" />
        <page name="/a" path="/a" user="admin" public-date="2024-11-07 13:37:00" pagetype="page" template="full" />
        <page name="/d/e" path="/d/e" user="admin" public-date="2024-11-07 13:37:00" pagetype="page" template="full" />
    </pages>
    <stacks>
        <folder name="Root Folder" path="/" />
        <folder name="A/B Test" path="/Root Folder" />
        <stack name="Stack Name" path="/Root Folder/A/B Test">
            <area name="Main">
                <blocks>
                    <block type="content">
                        <style>
                            <borderWidth>2px</borderWidth>
                            <borderColor>rgba(255,0,0,1)</borderColor>
                            <borderStyle>solid</borderStyle>
                            <borderRadius>10px</borderRadius>
                        </style>
                        <data table="btContentLocal"><record><content>Content for stack (neutral)</content></record></data>
                    </block>
                </blocks>
            </area>
        </stack>
        <stack name="Stack Name" path="/Root Folder/A/B Test" section="it_IT">
            <area name="Main">
                <blocks>
                    <block type="content" custom-template="my_custom_template">
                        <style>
                            <borderWidth>2px</borderWidth>
                            <borderColor>rgba(255,0,0,1)</borderColor>
                            <borderStyle>solid</borderStyle>
                            <borderRadius>10px</borderRadius>
                        </style>
                        <data table="btContentLocal"><record><content>Content for stack (it_IT)</content></record></data>
                    </block>
                </blocks>
            </area>
        </stack>
    </stacks>
</concrete5-cif>

@mlocati mlocati force-pushed the import-aliases-externallinks branch from c83bae5 to 885b6b2 Compare January 28, 2025 16:34
@mlocati
Copy link
Contributor Author

mlocati commented Jan 29, 2025

In this PR I added the new property/setting Destination of the publication to the Import\Batch entity.

Here it is when creating a new import batch:

screenshot

And here it is when edining the basic details of an existing batch:

screenshot

Hovering the question marks, we have these tooltips:

screenshot

screenshot

Why? When importing a page that's the root of a language, we need to create a new multilingual section (aka tree), and doing that under the /!import_batches/{batch-id} system page.

Creating multilingual sections is also required in order to import the localized versions of stacks and global areas.

By default, the setting is backward compatible, meaning that pages will be imported under the /!import_batches/{batch-id} system page and we won't create multilingual.

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

Successfully merging this pull request may close these issues.

1 participant