I just want to raise the issue of symlink behaviour.
Say I have a symlink pointing to a resource, both with the same template and template variable but with different values:
SYMLINK (template var = A) --> RESOURCE (template var = B)
When the symlink displays, I expect the value of its template variable to override that of the resource it points to. Unfortunately, this is not the case. Similarly, the page title of the Symlink does not seem to override that of the resource so [[*pagetitle]] returns the value of the resource’s title rather than the symlink’s.
It seems to me the intent of a symlink is to have a dynamic resource that is very similar to a static resource except it borrows its content from another resource. Was that the intent?
The docs describe a symlink as a "similar to Weblinks in that they redirect to another Resource or URL; however, symlinks will persist the current URL."
Perhaps we missed a good opportunity to make symlinks much more than just a redirect.
Cheers
JG
-
MODX Staff
- 10,725 Posts
The original intention was simply to display a Resource at the URL of another Resource, without consideration of the original Resource. But this is definitely something we want to achieve (yes, we’ve run into the same issue ourselves). If you could please add a JIRA ticket for the feature request, we’ll get it on the official roadmap.
FWIW; After recognizing Symlink is simply redirecting the url and does not reflect system variables for newly created resources, nor can take another template, I came up with workaround using a TV, taking a cue from other posting that discussed showing multiple contents from other resources on one page. Here is what I have done.
In my template, modify the
[[*content]]
to
[[*content]][[*linkedContent]]
then created a TV and named linkedContent, leave default value to blank.
When I want to link a particular resource to a page, I create a new resource and keep the content part blank, then in the linkedContent TV field, enter "@document nn" where nn is a resource id that I want to link. (BTW, Revo document tell me to use @resource nn instead, but I could not make it work. and there is no mention about @document in the document but it works)
In this way this page shows the content from the resource nn but [*pagetitle][*introtext] etc., are taken from the new resource page. (even those variables contained in the original resource will take values from new resource page)
-
MODX Staff
- 10,725 Posts
Yes, symlink fields that are non-empty will override the target.