Hello MODX-world,
I have a question on the Friendly Alias Path.
The case is that we have switched off the friendly alias path in the
friendly url section because we do not want to have the paths
included in our urls. Reason is that we structure our document-tree
in such a way that we don’t want this to show to the world.
However, for some urls we DO want alias paths. These are the
Google optimized urls in the site.
We have experimented with adding a slash in the Document Alias,
but this does not work.
Another option is to put the urls with the slash (=path) in them
hardcoded in the .htaccess file. But we do not want to change the
standard .htaccess file delivered with MODX.
What would be ideal is either one of two options:
1) MODX allows slashes in the Document Alias
2) It is possible to specify per document if it should include
the path in the url-friendly url.
Are there any other options?
Are there already any hacks on the MODX core to achieve this?
Does anybody else have the same need?
Do the core-developers see this as a nice feature for the next release?
Any help is appreciated.
Regards,
Bert Catsburg
Strange coincidence.
I’m just looking at taking on an existing site that has a similar requirement due to multilingual folders.
It would be nice to able to have the second level and lower docs to have the alias path type url’s.
Hello Bunk,
You want something slightly different I guess.
You want to define the alias path but not take the whole path
and start at a lower level. So, you probably have the language
codes at the highest level but do not want them to show in
the friendly url.
To combine the solution with my request makes that the
best solution is that the "Document Alias" field in the document
accepts (and don’t throw away) slashes in the urls.
That way everybody can do what they want.
A restriction might be that slashes are taken away if
Alias Path is set to Yes.
If Alias Path is set to No, then slashes in the Document Alias
are not taken out.
(Somebody more familiar with the core code is in a
better position to decide if this change is possible)
Your idea seems like it would work in most scenarios.
I’ll have to look at the way aliases are formed.
-
MODX Staff
- 10,725 Posts
You can do this in Revo by changing the setting for alias paths on separate Contexts. Or at least if you can isolate the Resources you want to have full paths to one Context and those that do not to another.
I do not think this is an easy change for Evo, though I can’t recall exactly why I believe that to be true. However, if someone comes up with a solution, we’d certainly be willing to implement it if tests determined it did not have any negative effects.
Just tested this on 0.9.6.3 and there is a problem with the solution.
The url does work, the slash remains there.
But when you use images in the document, the TinyMCE (or something else in MODX) makes the urls relative.
So, an image resides in href="assets/imges/myimage.jpg".
This is a relative url based on the url of the document. And then the images are not found.
Regards,
Bert
Bert,
Inserting images via the File Browser or TinyMCE both work for me on a page using a / in the document alias.
Do you have <base href="[(site_url)]"></base> or something similar in your template?
Or maybe your TinyMCE Plugin Configuration is different to mine, (I have Path Options : docrelative)?
David,
I also have Docrelative in my TinyMCE settings, this seems to be the default.
But I don’t see my imagesin the browser, although I do see them in the MODX-edit-page.
I changes the TinyMCE to rootrelative and it worked, however I have to add the slash to all images
in the HREFs on those pages having a slash in the document alias.
I do NOT have a BASE tag in my template? Should I add that?
Bert
I think almost everyone uses the <base> tag, mainly to avoid issues with relative url’s.
Try it and see if it solves the image issue.
I didn’t have to add any forward slashes when using TinyMCE to insert an image, or when using the File Browser from a TV.