You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The URL generated for internal links to the current site differs depending on whether the plugin is located in a static placeholder or a regular placeholder.
In a regular placeholder, a link in the format /<slug> is generated.
In a static placeholder, a link in the format //example.com/<slug> is generated.
I'd say that the behaviour should be the same for both cases.
My (probably naïve) suggestion would be to change the following code:
Instead of overriding ref_page with the current site, I think it should be retrieved from the self.internal_link property, and cms_page_site_id should be retrieved from the current site. That way a meaningful comparison can be made and it can be decided whether the domain prefix is necessary.
The text was updated successfully, but these errors were encountered:
cms_page = self.placeholder.page if self.placeholder_id else None
Static placeholders act different than regular placeholder and thus self.placeholder.page is not available resulting in the reformatting of the link through:
This is a bit tricky to figure out as the else is designed to adapt links if there is no placeholder attached as a fallback. There'd need to be an additional conditional statement checking for the static_placeholder's page itself.
@czpython would you have any advice on how to get the page from a static placeholder?
The URL generated for internal links to the current site differs depending on whether the plugin is located in a static placeholder or a regular placeholder.
In a regular placeholder, a link in the format
/<slug>
is generated.In a static placeholder, a link in the format
//example.com/<slug>
is generated.I'd say that the behaviour should be the same for both cases.
My (probably naïve) suggestion would be to change the following code:
https://github.com/divio/djangocms-link/blob/fbb67410377c953ff1e153a91e5306080b2a46fa/djangocms_link/models.py#L150-L153
Instead of overriding
ref_page
with the current site, I think it should be retrieved from theself.internal_link
property, andcms_page_site_id
should be retrieved from the current site. That way a meaningful comparison can be made and it can be decided whether the domain prefix is necessary.The text was updated successfully, but these errors were encountered: