Pages: [1]
  Print  
Author Topic: (Fixed) SEO Scaffolding issue when specifying path  (Read 1878 times)
drinkspiller
Gaia Guru
*****
Posts: 370


« on: September 12, 2008, 03:29:20 PM »

If, for a given page declaration in site.xml the seo attribute specified a path to a file, like so:

Code:
<page id="myClientProject1" src="swf/myClientProject1.swf" title="My Client's Big Campaign" seo="case-studies/my-client/my-client-project1.html" />

and then the Scaffold SEO Files Button was clicked it would trace that "case-studies/my-client/my-client-project1.html" was scaffolded. However, if the directory "case-studies" and or "case-studies/my-client/" did not yet exist, the file would not get created but the trace would still report that is was.

Of course, since I'm scaffolding, I want it to create the directory just as Gaia does for the not-yet-existent "swf" directory I specified in the same page declaration's src attribute. That's the beauty of defining structure in site.xml: the scaffold does the heavy lifting of creation. This is especially important since the path here since we're dealing with SEO and the path gets injected into the siteMap.xml and the alternate links for the xhtml page. Google (for one) is rumored to like this kind of logical hierarchy in blessing site's with its Google Site links. Long story short, for SEO, I wanted to have the directory structure I think is best for SEO.

A quick peek in GaiaSEO.jsfl  (in Vista, C:\Users\YourUser\AppData\Local\Adobe\Flash CS3\en\Configuration\GaiaFramework) revealed that no check for the folder's existence was occurring. A simple modification (attached below) creates the folder(s) if they don't exist.

At the end of the scaffoldSEO funtion, before "FLfile.write(seoPath, html);" is called, a check was called:
Code:
function scaffoldSEO(indexPath, deployPath, seoName, site, page, branch, menu)
{
var seoPath = deployPath + "/" + seoName;
var projectIndexPath = deployPath + "/index.html";
var html;
var swfObject = getIndexSWFObject(projectIndexPath);
if (fl.fileExists(seoPath) && branch != "index")
{
html = seoInject(seoPath, site, page, branch, menu, swfObject);
}
else
{
var css = getIndexCSS(projectIndexPath);
var thePath = (branch == "index") ? projectIndexPath : indexPath;
html = indexInject(projectIndexPath, site, page, branch, menu, css, swfObject, seoName);
}

checkValidPath(seoPath);
FLfile.write(seoPath, html);
}

and checkValidPath is defined as follows:
Code:
function checkValidPath(seoPath)
{
//strip the file name and extract the destination folder path
var destFolder = seoPath.split("/").slice(0, seoPath.split("/").length - 1).join("/");

//see if destination path exists
if (!FLfile.exists(destFolder)) {
//folder does not exist. create it.
FLfile.createFolder(destFolder);
}
}

That seems to do the trick.


« Last Edit: September 12, 2008, 05:44:59 PM by drinkspiller » Logged
steven
Gaia Author
Administrator
Gaia Evangelist
*****
Posts: 3871


gaiaframework
WWW
« Reply #1 on: September 12, 2008, 04:56:12 PM »

Nice catch and fix.  I'll put it in the next release.  Thanks!
Logged

Steven Sacks | Gaia Author
Please support Gaia by donating to the project!  Smiley
wrench
Gaia User
**
Posts: 33


WWW
« Reply #2 on: March 08, 2010, 08:40:54 AM »

Sorry to be digging up an old post, but I have a question related to the original question drinkspiller posted.

Is there anyway to have Gaia write the correct path to css and js files for pages that are designated to go into a folder? At the moment, it's assuming that files created within folders have the same path to the CSS and js files as the pages which are not inside a folder structure.
Logged
steven
Gaia Author
Administrator
Gaia Evangelist
*****
Posts: 3871


gaiaframework
WWW
« Reply #3 on: March 08, 2010, 11:36:00 AM »

If I'm understanding you correctly, I'm certain this is how Flash works - the first movie loaded is where all paths are relative to.  Loaded swfs use the relative path of the first swf loaded.
Logged

Steven Sacks | Gaia Author
Please support Gaia by donating to the project!  Smiley
wrench
Gaia User
**
Posts: 33


WWW
« Reply #4 on: March 08, 2010, 03:07:37 PM »

Hi Stevn,

I was referring to the css and js files that are referenced in the seo pages created when you scaffold a site. When you set the seo property of a page to say seo="myfolder/myfile.html" the links to the js files (and css if you've put them in an external file) are then incorrect mapped. Hopefully that clarifies what I was asking.
Logged
wrench
Gaia User
**
Posts: 33


WWW
« Reply #5 on: March 09, 2010, 09:33:29 AM »

I'm having major problems with using the SEO functionality of Gaia at the moment.

Firstly, here's an excerpt of the site.xml I'm using

Code:

<site title="Dixon Industries for FUSIONMASTER® PE butt welding equipment, and Teflon® coating services: %PAGE%" menu="true" domain="current" indexFirst="true" gaiaSiteVersion="0.2">
  <page id="index" src="index.swf" bytes="9948" menu="false" seoBytes="4866" title="Home" seo="true">
    <asset id="fonts" src="fonts.swf" bytes="30673"/>
    <page id="nav" src="nav.swf" depth="top" bytes="40750">
      <asset id="contentcss" src="css/flashcontent.css" bytes="1509"/>
      <asset id="navcss" src="css/flashnav.css" bytes="385"/>
      <asset id="footer" src="footer.swf" bytes="5877"/>
      <page id="home" title="Home" src="content.swf" menu="true" bytes="56355">
        <asset id="content" src="home.swf" bytes="20405"/>
      </page>
      <page id="about" title="About Us" src="content.swf" menu="true" bytes="56355" seo="true" seoBytes="6239"/>
      <page id="fusion" title="Fusion" src="content.swf" menu="true" bytes="56355" route="fusionmaster" seo="true" seoBytes="3745">
        <page id="buttfusion" title="Butt Fusion" src="content.swf" menu="true" bytes="56355" landing="true" route="fusion/butt-fusion" flow="cross" seo="fusion/butt-fusion.html" seoBytes="6052">
          <page id="mv70" title="MV70 Rural Welder" src="content.swf" bytes="56355" route="fusion/butt-fusion/mv70" flow="cross" seo="fusion/butt-fusion/mv70.html" seoBytes="5566"/>
          <page id="lf110" title="LF110 - 32mm" src="content.swf" bytes="56355" route="fusion/butt-fusion/lf110" flow="cross" seo="fusion/butt-fusion/lf110.html" seoBytes="4903"/>
          

When I scaffold this, the files and folders are created correctly.

The problem are arising from a multitude of path issues.

Firstly, none of the css or js files that the index.html file points to are updated for files that aren't in the root directory of the
project.

Secondly, and more importantly, the swfobject code still points to main.swf even for files that aren't in the root folder. Changing this to "../main.swf" for files one level deep, doesn't help as then the site.xml file can't be found. I've added siteXML: "../site.xml" to the flashvars for this page - but that then causes a whole raft of other issues where the files being loaded in the site.xml can't find where they're supposed to be loaded from.

The third issue is I can create a perfectly functional html page when viewed as HTML in a browser, that is referenced by the seo property in the site.xml (and brought into the Flash side via the copy.innerHTML property). However, if this page is one level out of the root folder, and it has an image on it, that image is no longer accessible from within the Flash site. Again, due to relative paths and the way Flash handles loading external resources.

I can't for the life of me think of how I'm going to use Gaia and the SEO stuff the way I was intending. This is my first foray into using the SEO property, so hopefully someone out there can lend some insight/assistance as to how they've got it to work for them. Right now, the number of hoops I'm having to jump through is getting kinda out of hand.
« Last Edit: March 09, 2010, 09:41:24 AM by wrench » Logged
steven
Gaia Author
Administrator
Gaia Evangelist
*****
Posts: 3871


gaiaframework
WWW
« Reply #6 on: March 09, 2010, 03:38:22 PM »

It seems to me that with the problems you are having even doing this manually, it would be a nightmare to try and figure out how to do this with automation.  Why are you doing this anyway?  Why can't all the html pages live on the same level?  If you really want them to be in folders because you want that in the address bar, why not just use mod_rewrite and save yourself the headache?
Logged

Steven Sacks | Gaia Author
Please support Gaia by donating to the project!  Smiley
wrench
Gaia User
**
Posts: 33


WWW
« Reply #7 on: March 09, 2010, 04:37:40 PM »

I guess because Gaia allows us to create hiearchies via the SEO property, I assumed it would do so in a way that didn't involve having to manually edit a bunch of code afterwards.

I managed to sort out all of my issues.

The issue I was having with the path to the main.swf not being rewritten was solved by rewriting it manually, and adding a "base: '../'" param. So for every level deeper into the hiearachy, another ../ needs to be added. This would probably solve my current qualms with how the scaffolding of the SEO pages is occuring if this could be automated. And given that there's the ability to scaffold into folders, it's kinda pointless then that those pages won't work when you visit them with a browser that has Flash.

I had to go through and manually edit the paths to the js and css files (I agree, that's pushing the boundaries of Gaia's scaffolding a bit ;-)

I managed to solve my issue with the images not loading (and links for that matter not pointing to the right location anymore) by some string replacements of the "../" in the src's and href's. I won't go into the details on that, but it's working how I'd hoped now so i'm happy.

And in response to why I want things in folders - well, for organisational sakes. I've been creating sites for 10 years now, and I really don't want to have a flat list of 50 files when I could organise them how I think they should be. The address bar is one factor as well.

Using mod_rewrite wouldn't work when I'm testing locally, and I don't want to have to upload things everytime I want to test them. So there's a few reasons why I've gone down this path. The overarching one is that I'm pretty comfortable with the way I develop sites (and in this case, I'm using the HTML copy to power the Flash content) so if I can continue using the methodologies I have for years now, I certainly will.

Here's the obligatory disclaimer on all that - you're continuing to do a marvellous job with the framework, and I'm continuing to push the boundaries of what I think it can do. Thanks again :-)
« Last Edit: March 09, 2010, 04:39:44 PM by wrench » Logged
steven
Gaia Author
Administrator
Gaia Evangelist
*****
Posts: 3871


gaiaframework
WWW
« Reply #8 on: March 10, 2010, 01:50:15 AM »

If you think you can take what you figured out and apply it, the GaiaSEO.jsfl file is in the folder and you can modify it.  That is where all of the html injection takes place.  If you get it working, please let me know and paste the code inside a code tag here.  Smiley
Logged

Steven Sacks | Gaia Author
Please support Gaia by donating to the project!  Smiley
Pages: [1]
  Print  
 
Jump to:  

TinyPortal v1.0 beta 4 © Bloc