New Theme Feature: %pathto()% support in theme files

New Feature: %pathto()% support in theme files

Some of you are using RwSetGet to provide this functionality, but as of RapidWeaver 7 it no longer works if the customer has cache-busting links enabled. Rather than leave this for you all to figure out, we brought the functionality in-house.

So now, simply add %pathto(path/to/your/image.jpg)% as you would have done already in your index.html file, and we’ll automatically populate that with the correct path.

If your theme supports this feature, add a TRUE boolean to the Info.plist for the RWSupportsPathToInFiles key.

This feature will be available in the next beta of RapidWeaver 7 (due out later today).

We’ve also started documenting theme changes on our new knowledge base (this is not public yet, so don’t share outside of this forum): http://support.realmacsoftware.com/article/36-7-0-theme-sdk-changes

Plugin SDK changes can be found here: http://support.realmacsoftware.com/article/31-rw7-plugin-sdk-changes

If you have any questions related to any of this, please feel free to ask away.

Cheers,
Dan

1 Like

I am confused. Foundation uses %pathto()% and everything seems to be working perfectly. If I don’t add this to the plist, it will break? Sounds like this should default to true.

@joeworkman Think he means it can be used outside the core template file, which hasn’t been possible previously (Edit: at least, not in script files, hence why many use RwSetGet).

@nimblehost Yup, that’s exactly right :slight_smile:

1 Like

@nimblehost - have you tested this yet? It will be a huge blessing.

It should be in the beta due out this afternoon!

@dan Was this new feature added already, just to make sure that it was so that I can try it.

yeah, around a month ago :wink:

Ok, thanks @dan It must be me then, I’ve tried to test it out, but can’t make it work, the reason I’ve asked.

Ok, just found the reason it was not working @dan.
The key needs to be added into the RWThemeCapabilities key on Theme.plist file not to the Info.plist, hope this helps anyone having trouble with it.

For those theme devs wanting to use RwSetGet to support both RW6 and RW7, see this topic.

1 Like

Dan,

This feature seems to be working incorrectly when the url is a subfolder …
Example: if my domain is at the root then %pathto()% correctly points to the file intened but if my domain is root/Folder then %pathto()% leaves out the “Folder” in the path.

Example: I am publishing to http://domain_.com/MyFolder
Whenever I use the %pathto()% to load an image from the themes Contents in a js file the path that gets produced is:
http://domain_.com/rw_common/themes/themeName/images/slides/demo-slide1.jpg

when it should be:
http://domain_.com/MyFolder/rw_common/themes/themeName/images/slides/demo-slide1.jpg