SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,882
    Mentioned
    74 Post(s)
    Tagged
    6 Thread(s)

    Shaving even more milliseconds from page loading time, improving reducing clutter

    Info
    I have never been a big fan of JavaScript but recently discovered Google's AngularJS Library...

    I was intrigued at a particular feature that made it possible to shave quite a few milliseconds from the page loading time but most important of all; to render and display included files but NOT show the source!

    This technique will no doubt improve SEO because it will only show your "Golden Content" and reduce the "clutter" such as adverts, banners, superfluous javascript, footers, etc.

    Normal loading umpteen images - using PHP include '_snippet.php';
    Normal page loading of 1.90 meg images
    Notice how long the page takes to load
    and epecially the page source code which shows the loaded images

    Same '_snippet.php' file using Angular ngInclude
    Normal page loading of 1.90 meg images
    Notice how long the page takes to load
    and epecially the page source code which DOES NOT show the loaded images

    Source files:
    index.php | _menu_options.php | _snippet.php | style_sheet.css

    1. (PHP files extensions need to be changed from TXT)
    2. NB: Image files are NOT included.
    3. Please set "_snippet.php -> $RELATIVE_FOLDER to your own images folder.
    Please feel free to test using any relevant tools.
    Ideas, comments, suggestions, improvements, etc can be made on Sitepoint Forum.

    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Wolfshade on earning Member of the Month for August 2014

  2. #2
    Non-Member
    Join Date
    Feb 2012
    Posts
    892
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure what you've... discovered here. That AJAX content does not show in View Page Source... but it's available in browser Inspector?

  3. #3
    Non-Member
    Join Date
    Feb 2012
    Posts
    892
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    To be clear, this is hardly news, and AngularJS is certainly not necessary to "hide" certain content from your page, vanilla AJAX will do just fine. AngularJS is to AJAX what jQuery is to JavaScript. BTW, large "surprise" AJAX content will score you negative SEO points and raise suspicion about your intentions.

    Also, you should add to the page loading time, AJAX fetching time and page re-rendering time to be on the fair side.

    It seems a small clarification is needed, AngularJS is for making webapps, not webpages, with emphasis on SPAs. As a pitfall, moving all the logic at once to the client-side also adds the risque of user meddling where they shouldn't be able otherwise.

  4. #4
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,882
    Mentioned
    74 Post(s)
    Tagged
    6 Thread(s)
    Many thanks for your useful insights and observations.

    I initially liked the idea of AngularJS and tried to use the AngularJS->ngInclude but had difficulty; the included files were missing numerous variables and constants. It only works on plain HTML text.

    I acknowledge the points you made about "vanilla Ajax" and also intrigued by the possible negative SEO impact of AngularJS?

    What I would like to do is make the site load a small template and use the "scroll forever" feature instead of clicking to load the next page.

    I have researched and found a Github Ajax script, with numerous updates, This should interface with my CI project because it is written by Derek Jones from CodeIgniter. I hope to give it a whirl tomorrow.



    Quote Originally Posted by myty View Post
    To be clear, this is hardly news, and AngularJS is certainly not necessary to "hide" certain content from your page, vanilla AJAX will do just fine. AngularJS is to AJAX what jQuery is to JavaScript. BTW, large "surprise" AJAX content will score you negative SEO points and raise suspicion about your intentions.

    Also, you should add to the page loading time, AJAX fetching time and page re-rendering time to be on the fair side.

    It seems a small clarification is needed, AngularJS is for making webapps, not webpages, with emphasis on SPAs. As a pitfall, moving all the logic at once to the client-side also adds the risque of user meddling where they shouldn't be able otherwise.
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Wolfshade on earning Member of the Month for August 2014

  5. #5
    Non-Member
    Join Date
    Feb 2012
    Posts
    892
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by John_Betong View Post
    I acknowledge the points you made about "vanilla Ajax" and also intrigued by the possible negative SEO impact of AngularJS?
    A crawler, like the Google indexing bot, when it reads your AngularJS page, it finds a lot of handlebars, mustaches: "{", with meaningless placeholder names inside them, like pageName, userName, postTitle. That's because the dynamic rendering part happens at client side, whereas with traditional dynamic pages, it gets generated at server side. What the bot needs for a successful crawl and index instead, it's the actual content.

    The difference is that your content is being generated with AngulatJS upon page arrival at client, whereas with node.js for example, is being generated at server request time for the page. This doesn't exclude that there may still be some AJAX-ing action going on after the initial response, but there is already a comprehensible content in place.

    One way to overcome this, is to read the user agent data and when a crawler like Google bot is identified, it should trigger the server side rendering for it, generating the content for the bot. Sounds easy? Let's read again: now you need to generate pages dynamically not only at server side, for the crawler, but at client side also, for the user. That's why AngularJS (or ample AJAX generated content) is best suited for webapps, not for webpages.

    There is also the concern of misrepresentation. Say you put a "My little pussy - adorable, soft and pink" title, and then a lot of cat lovers are suddenly starring at mature content instead. That's why crawlers are wary of this type of page construct, and that's why it may hurt your page rank.

  6. #6
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,882
    Mentioned
    74 Post(s)
    Tagged
    6 Thread(s)
    Hi @myty ;

    I have researched further and eventually, after a struggle, managed to use AJAX to load 500 thumbnails in less than half a second!

    There are quite a few AJAX versions and searching revealed numerous solutions which were not applicable. AJAX CodeIgniter has two different implementations, the first I tried, sounded very good but the documentation is sadly lacking. What made it worse was PHP 5.3 was the highest acceptable version, error_reporting level could not be set to STRICT (-1). and developing/Debugging could only be done Online. I get the distinct impression that the script was written by a Javascript programmer that tried to interface CodeIgniter. Unfortunately the subtle MVC simplicity was lost and convoluted resulting in numerous unhappy programmers requesting clarification. The author upgraded Github with the latest version about three weeks ago and since been unreachable for comments...

    The other version also has poor documentation but fortunately accepts PHP Version 4.6 along with error_reporting(-1) which made debugging on Localhost far easier.

    Online Demo www.johns-jokes.com/ci/ci_application/

    and most important of all: the Pingdom results:

    ajax-load-test-pingdom-777x262.jpg

    I did notice when viewing page source (using the five most popular browsers), not a single image link was shown BUT Pingdom does show all 500 thumbnail links?

    At the moment, I think that this technique not only satisfies the page speed rendering and load times but also the "Golden Content " is preserved as far as SEO is concerned
    Last edited by John_Betong; Oct 14, 2013 at 01:41. Reason: spelling: not my fortay :(
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Wolfshade on earning Member of the Month for August 2014


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •