Skip to content

Using %url_path% with macros that accept <filename> to use %url_path% specific files

I want to use files that are specific to a single url I am submitting for the content GSA uses.

For example, when creating blog comments in a project, I'd like to use a different blog comment text file for each url I am submitting. Is this possible without creating a new project for every single url I want to submit?

I've looked at little bit at the macro guide and I feel like something similar to below would work:

%spinfile-<[Map_Url_To_File_Name(%url_path%)>% 

But, I have not found a way to implement the Map_Url_To_File_Name function.

Thanks for any help!
 

Comments

  • SvenSven www.GSA-Online.de
    %spinfile-$url_path$% << this should work
  • edited August 2016

    Thanks! I've got a few more related questions.

    Suppose the urls I want to create links for are http://www.example.com and http://www.example.com/index.html.

    First, are my guesses for the return values of the macros below right?

    %url_path% becomes "/" and "/index.html"

    %url_domain% becomes "www.example.com" and "www.example.com"

    Second, I don't think the windows file system allows "/" characters in file names. How do macros that use filenames process "/" and other characters not allowed in file names?

    Third, is syntax like %spinfile-C:\Path\To\Directory\$url_path$.txt% valid?

    Last, is there an easy way to see how these macros behave and test macros besides running a project and waiting for results? If macros are correctly entered, will they be evaluated when I click the test button on the project screen?

  • SvenSven www.GSA-Online.de

    >%url_path% becomes "/" and "/index.html"

    >%url_domain% becomes "www.example.com" and "www.example.com"

    correct


    >Second, I don't think the windows file system allows "/" characters in file names. How do macros that >use filenames process "/" and other characters not allowed in file names?


    chars who can not be used in file names are converted to "_".

    >Third, is syntax like %spinfile-C:\Path\To\Directory\$url_path$.txt% valid?

    yes

    >Last, is there an easy way to see how these macros behave and test macros besides running a project and waiting for results? If macros are correctly entered, will they be evaluated when I click the test button on the project screen?

    Actually no, the %url_path% macro is only resolved during submission.
  • Awesome, thanks for the help with my questions!
Sign In or Register to comment.