Useful function to get complete URL of current page

Walter


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Walter,
Clever stuff. Unfortunately this highlights the need for some good documentation as you can already do this with fwPage.fwWebAddress() rather than building the path from the site root yourself. I believe you can use any site level item here so document, folder or page should all work.
Regards,
Tim.

On 20 May 2014, at 14:20, Walter Lee Davis wrote:

Get a complete URL of the current page in a Freeway Action · GitHub


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Damn! Here, I thought I was being clever because I rewrote something I found in the Blogger Action.

Walter

On May 20, 2014, at 9:57 AM, Tim Plumb wrote:

Hi Walter,
Clever stuff. Unfortunately this highlights the need for some good documentation as you can already do this with fwPage.fwWebAddress() rather than building the path from the site root yourself. I believe you can use any site level item here so document, folder or page should all work.
Regards,
Tim.

On 20 May 2014, at 14:20, Walter Lee Davis wrote:

Get a complete URL of the current page in a Freeway Action · GitHub


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On 20 May 2014, at 15:43, Walter Lee Davis email@hidden wrote:

Damn! Here, I thought I was being clever because I rewrote something I found in the Blogger Action.

:slight_smile:


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

While you all are busy smirking at me, any hope of understanding what it would take to unpack JSON in an Action? I’ve tried eval, and I keep getting an “invalid label” error. The test string I am unpacking is this:

{"url":"http://www.wdstudio.com/test/deeper/index.html","controller":"pages","action":"inspect","format":"json"} 

Are there any magic words in there that an Action’s eval method would choke on explicitly? The really odd thing is that when I put that string in the Action, I do get an object back. But when I insert it as the return of a method, I get the error.

Walter

On May 20, 2014, at 10:52 AM, Joe Billings wrote:

On 20 May 2014, at 15:43, Walter Lee Davis email@hidden wrote:

Damn! Here, I thought I was being clever because I rewrote something I found in the Blogger Action.

:slight_smile:


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I’ve used this before:

function parseJSON(data)
{
	if(!data)
		return;
	return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(data.replace(/"(\\.|[^"\\])*"/g, ""))) && eval("(" + data + ")"); //"
}

Source: http://www.json.org/draft-crockford-jsonorg-json-04.txt

On 20 May 2014, at 16:09, Walter Lee Davis email@hidden wrote:

While you all are busy smirking at me, any hope of understanding what it would take to unpack JSON in an Action? I’ve tried eval, and I keep getting an “invalid label” error. The test string I am unpacking is this:

{“url”:“http://www.wdstudio.com/test/deeper/index.html",“controller”:“pages”,“action”:“inspect”,“format”:"json”}

Are there any magic words in there that an Action’s eval method would choke on explicitly? The really odd thing is that when I put that string in the Action, I do get an object back. But when I insert it as the return of a method, I get the error.

Walter

On May 20, 2014, at 10:52 AM, Joe Billings wrote:

On 20 May 2014, at 15:43, Walter Lee Davis email@hidden wrote:

Damn! Here, I thought I was being clever because I rewrote something I found in the Blogger Action.

:slight_smile:


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Wow. That is making my head spin. But it does work.

Thanks very much,

Walter

On May 20, 2014, at 11:32 AM, Joe Billings wrote:

I’ve used this before:

function parseJSON(data)
{
	if(!data)
		return;
	return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(data.replace(/"(\\.|[^"\\])*"/g, ""))) && eval("(" + data + ")"); //"
}

Source: http://www.json.org/draft-crockford-jsonorg-json-04.txt

On 20 May 2014, at 16:09, Walter Lee Davis email@hidden wrote:

While you all are busy smirking at me, any hope of understanding what it would take to unpack JSON in an Action? I’ve tried eval, and I keep getting an “invalid label” error. The test string I am unpacking is this:

{“url”:“http://www.wdstudio.com/test/deeper/index.html",“controller”:“pages”,“action”:“inspect”,“format”:"json”}

Are there any magic words in there that an Action’s eval method would choke on explicitly? The really odd thing is that when I put that string in the Action, I do get an object back. But when I insert it as the return of a method, I get the error.

Walter

On May 20, 2014, at 10:52 AM, Joe Billings wrote:

On 20 May 2014, at 15:43, Walter Lee Davis email@hidden wrote:

Damn! Here, I thought I was being clever because I rewrote something I found in the Blogger Action.

:slight_smile:


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Just in case you have a need for this: you can go the other way (Object to String) using Object.toSource()

Joe


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I discovered this thread while searching for ways to hack the SiteMapper action to enable HTTPS links instead of the default HTTP. Inside the SiteMapper action, I see the following code:

outputcode += "tt<loc>" + myPage.fwWebAddress() + "</loc>r";

The resulting XML file generates “http://” links within the “” tags. I want to change it to “https://” but how do I accomplish that?

Thanks,

James Wages

P.S. I’ll be honest. I detest the SiteMapper action because it perpetually dirties all the pages in my site. But to not use it would mean a lot of many labor for me in that I’d need to use an online tool to generate the sitemap AND THEN I would need to upload it to my site and then ping search engines as to its location. The SiteMapper action does all that for me.


actionsdev mailing list
email@hidden
Update your subscriptions at:

Hi James,
Change the Web Address setting in File > Document Setup to https and you should find that all of your links in the site map get updated.
Regards,
Tim.

On 26 Jan 2017, at 02:49, JDW email@hidden wrote:

The resulting XML file generates “http://” links within the “” tags. I want to change it to “https://” but how do I accomplish that?


actionsdev mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

File > Document Setup > Upload > Web Address

Perfect! Thank you for the hand-holding, Tim!

James W.


actionsdev mailing list
email@hidden
Update your subscriptions at:

No problem James. The fwWebAddress() function simply pulls the value from this field so whatever you add will be used in the Action.

This is one of those Actions that has always had issues with pages getting dirtied (published) out of place. Make sure you are using the latest version of the Action (I’m looking at version 1.5.3 in Freeway 7.1.3) as I seem to recall we added the Site Mapper File Location Action to try and overcome some of these issues. That Action is set to always publish the page as it needs to trawl through the site and force the other sitemapper pages to update their content.

It’s been a long while since I’ve last looked at this Action but you could try editing it to remove the fwIsDirty() function (line 541) which should stop the Action from dirtying the rest of the site each time the sitemap needs updating.

function fwIsDirty()
{
	return true;
}

To prevent publishing a partial sitemap (which is what will happen if this is disabled) I’d suggest holding down the control key when you select File > Publish which will change the menu to Publish Everything and should force Freeway to rebuild the site with a complete XML sitemap.
Regards,
Tim.

On 26 Jan 2017, at 09:43, JDW email@hidden wrote:

Perfect! Thank you for the hand-holding, Tim!


actionsdev mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Tim,

I too am using Site Mapper 1.5.3 on Freeway Pro 7.1.3 along with the Site Mapper Location action 1.0. I have the Site Mapper 1.5.3 action applied to the folder containing all my web pages and “Change frequency” is set to “Weekly” but still I get dirtied pages about every 24 hours. And when they happens I must Publish the site twice before all pages stop dirtying themselves. I consider that strange. You’d think that the first Publish would do it, but it doesn’t. If I Publish all pages and then go to Upload, it builds the pages again before uploading. But usually after that I am good until the next day. I’ve been using this Action for ages, and I use Freeway often, so this is a painful part of my daily routine.

Because of the page dirtying problem, I’ve long wanted to ditch the action entirely, but I want site maps and using this action is the easiest way to not only get the Site Map built automatically but ping the search engines automatically too. Nothing else I’ve seen online (third party site mappers) does all that.

Thank you for the code-change suggestion. If I delete those 4 lines, you are telling me that the Action won’t dirty the entire site anymore (bringing great joy to my soul), but you are also telling me that if the Action needs to update itself, it would create a partial Site Map (which is bad). Since there is no way for me to confirm WHEN the Action thinks it needs to update itself (again, my “Weekly” setting doesn’t seem to be working since my site dirties itself every 24 hours), the Action might in fact try to update daily, and in that case I would have a partial (defective) site map most of the time, at least until I manually dirty the entire site with Publish Everything. What are your thoughts on this?

Many thanks,

James W.


actionsdev mailing list
email@hidden
Update your subscriptions at:

Tim,

I probably typed too my info in my previous post for you to spot my QUESTION, so here it is again…

If I delete those 4 lines, you are telling me that the Action won’t dirty the entire site anymore (bringing great joy to my soul), but you are also telling me that if the Action needs to update itself, it would create a partial Site Map (which is bad). Since there is no way for me to confirm WHEN the Action thinks it needs to update itself (again, my “Weekly” setting doesn’t seem to be working since my site dirties itself every 24 hours), the Action might in fact try to update daily, and in that case I would have a partial (defective) site map most of the time, at least until I manually dirty the entire site with Publish Everything. What are your thoughts on this?


actionsdev mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Hi James,
The setting in the action doesn’t set the frequency the Action crawls the site looking for data but the suggested frequency that search engines return and trawl the site. If you set this to a week then you are giving these bots the indication that they can find new content on a weekly basis. A news site, on the other hand, will have updates on a daily basis.

If the constant publishing issues are annoying you then try the suggestion I made in my email and see if it works for you. If it doesn’t then simply revert back to your existing workflow.
Regards,
Tim.

On 30 Jan 2017, at 01:08, JDW email@hidden wrote:

If I delete those 4 lines, you are telling me that the Action won’t dirty the entire site anymore (bringing great joy to my soul), but you are also telling me that if the Action needs to update itself, it would create a partial Site Map (which is bad). Since there is no way for me to confirm WHEN the Action thinks it needs to update itself (again, my “Weekly” setting doesn’t seem to be working since my site dirties itself every 24 hours), the Action might in fact try to update daily, and in that case I would have a partial (defective) site map most of the time, at least until I manually dirty the entire site with Publish Everything. What are your thoughts on this?


actionsdev mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Hi Tim,

If I delete the following code from the Site Mapper action, and then edit a couple pages in my site and upload, a “partial” site map will be created, right? And in that case, I would need to Publish Everything to force the Site Mapper action to then act as if the following 4 lines were still there, right? So, if I need to Publish Everything each time I upload in order to avoid uploaded “partial” (incomplete) site maps, how would that be an advantage over just leaving things the way they are now?

function fwIsDirty()
{
    return true;
}

actionsdev mailing list
email@hidden
Update your subscriptions at:

Did you try it James? If you try it and it works for you then great. If you don’t try it then that is also great. I’m just putting a suggestion to you here.

On 30 Jan 2017, at 09:22, JDW email@hidden wrote:

If I delete the following code from the Site Mapper action, and then edit a couple pages in my site and upload, a “partial” site map will be created, right? And in that case, I would need to Publish Everything to force the Site Mapper action to then act as if the following 4 lines were still there, right? So, if I need to Publish Everything each time I upload in order to avoid uploaded “partial” (incomplete) site maps, how would that be an advantage over just leaving things the way they are now?


actionsdev mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Tim,

I did precisely as you suggested. I used dual-slashes to comment-out those 4 lines inside Freeway Pro.app/Contents/Shared Support/Actions/ FAST/SiteMapper.fwaction, as follows:

// Commented-out the next 4 lines as per Tim Plumb 1/30/2017 to prevent page dirtying:
// function fwIsDirty()
// {
// 	return true;
// }

I did that using TextWrangler and saved. I then used File Buddy to delete the “TYPE” (but leaving CREATOR intact), so as to restore the icon.

I then relaunched Freeway.

I opened each of my sites and did a File/Publish. All pages were dirtied and rebuilt. I thought that happened because I just edited the Site Mapper action, however, I then did another File/Publish and all pages got dirtied and rebuilt again, so that means things have not changed. I tried File/Publish a third time, and nothing got dirtied or published, which is normal (even before I commented out those 4 lines).

I then looked in my Site Folder and I see “sitemap.xml” with a modification time stamp showing the same time I published the site. Looking inside, I see today’s date applied.

So it seems that commenting-out those 4 lines has no effect whatsoever. Should I notice something different?

Thanks,

James


actionsdev mailing list
email@hidden
Update your subscriptions at:

Tim,

Should I interpret your lack of reply to my previous post as “put the action code back the way it was before”?

:slight_smile:

–James W.


actionsdev mailing list
email@hidden
Update your subscriptions at:

Tim…?


actionsdev mailing list
email@hidden
Update your subscriptions at: