Forums

NextGEN Gallery
SEO Permalinks -- Patch (34 posts)

  1. CraigWatson
    Member
    Posted 1 year ago #

    I've spent a couple of days rewriting NextGEN's rewrite code (no pun intended!) and here is the result:

    http://www.cwatson.org/odd/nextgen-1.5.5-cw.tar.gz

    Changed files are:
    nggfunctions.php
    lib/ngg-db.php
    lib/rewrite.php

    There are several code changes, so I won't list all changes here. You can either replace the files above or replace the whole nextgen-gallery folder in your plugins directory.

    After replacing the files, log into your wp-admin console and go to your NextGEN options. Click on the "Permalinks" tab, and the options should be self-explanatory.

    Disclaimer
    Note to anyone upgrading to this patch, obviously there is a risk in using this as it I haven't tested on anything other than my own website. Remember to backup your current nextgen-gallery plugin folder, as well as any customised CSS files you have.

    Demo gallery is here: http://www.cwatson.org/gallery

    I have submitted the code changes to Alex (NextGEN's developer) so hopefully they should be incorporated into a NextGEN release sometimes soon :)

    Any questions, please ask :)

    http://wordpress.org/extend/plugins/nextgen-gallery/

  2. CraigWatson
    Member
    Posted 1 year ago #

    Update: I have uploaded a zip version of the archive, as well as just the changed NextGEN files:

    http://www.cwatson.org/odd/nextgen-1.5.5-cw.zip
    http://www.cwatson.org/odd/nextgen-1.5.5-changed.zip

    I have also confirmed that the patch works on both the standard and ImageBrowser settings. If anyone spots any bugs or problems, please let me know :)

  3. aleksgeo
    Member
    Posted 1 year ago #

    This is just what I've been looking for the past few days, it's fantastic. I don't know if it's because I'm doing something wrong, though, but my URLs include the album ID rather than name.

    Check here for a couple of examples: http://www.aleksgeo.com/gallery/

    The way I understand it from the sample gallery you linked to, the URL linking to the gallery "Testing 1" should be http://www.aleksgeo.com/gallery/bulgaria/testing_1/ but it's http://www.aleksgeo.com/gallery/1/testing_1/.

    Like I said, not sure if I'm doing something wrong or if there's a problem with the files somewhere. Any help with the problem would be appreciated though.

    Oh, and uploading only the 3 changed files doesn't add the permalinks tab to the options page, so it's kinda hard to use it :P

  4. CraigWatson
    Member
    Posted 1 year ago #

    Apologies, I missed one file out of the changed files archive, so the options weren't added into the admin panel.

    I have replaced the changed files archive with the correct one so the problem is fixed now.

    The way I had my gallery set up is that I have album/subalbum/gallery, all placed into a main "Gallery" album. Can you give your layout?

  5. CraigWatson
    Member
    Posted 1 year ago #

    I've also been bugfixing some problems with albums embedded in posts - seems to be the same problem you're having.

    I've fixed the bug so if you can replace the files again, and also update your permalink structure, the problem should be fixed.

    I have a test post at http://www.cwatson.org/2010/07/07/test-gallery-post and that seems to be working fine :)

  6. aleksgeo
    Member
    Posted 1 year ago #

    Seems to be working great now!

  7. CraigWatson
    Member
    Posted 1 year ago #

    Aleks,
    Thanks for the feedback, glad it's working for you :)

    I've found some bugs with non-standard characters and quotes being used in album and gallery names, so these bugs have now been fixed. A proof of concept gallery for non-standard characters is:

    http://www.cwatson.org/gallery/we_will_%22r%C3%B6ck%27_you/s%C3%B6me_g%C3%A3llery_with_l%C3%B6ts_%C3%B6f_specialchars_&_o%27er_%22stuffs%22/

    As with previous bugfixes, you will need to update your permalink structure once after applying these fixes.

    The archives in the first post have been updated, so you can either download the full archive or the changed files.

    If anyone else can provide feedback (even a "it works!") it would be much appreciated - I'm trying to save Alex as much testing as possible :)

    Cheers,
    Craig

  8. aleksgeo
    Member
    Posted 1 year ago #

    I noticed gallery names with special characters messed it up, and the latest files are an improvement, but I managed to break it again.

    If you take a look here you'll find two galleries, one with an apostrophe and one with elliptical brackets in their names. When you click on them they work fine*, but once you try to move to the second (or any other) page the links break.

    The one with the apostrophe just gets a backslash added before the apostrophe, but the one with the brackets is weird. When you hover over the link it shows the brackets in the link you're about to go to, but they disappear once you click on it and the page loads.

    *Oh, I just noticed that IE, Opera and Safari can't display galleries or albums with apostrophes properly unless you change them to %27 in the URL bar. Hope that helps.

  9. CraigWatson
    Member
    Posted 1 year ago #

    Hi Aleks,
    Just to keep you (and everyone else here) updated about this, unfortunately I have some freelance projects that need to be completed, so I won't be able to address the issues until week beginning 19th July.

    After this, I should hopefully be able to look again at the plugin and deliver a more "complete" solution - the characterset problems can be solved by sanitising the gallery/album titles in the same way that WordPress sanitises page/post titles.

    To store sanitised information, extra fields need to be added into the database schema, so I'll need to test these fully (including migration scripts) and release a "v2" of the patch - that is unless Alex Rabe releases them in NextGEN.

    Cheers for all the help, please keep using the patch if you don't mind having to avoid special characters and quotes in gallery/album titles.

    Craig :)

  10. gearsdigital
    Member
    Posted 1 year ago #

    He Craig,

    you should remove the trailing whitespace in your files after the closing (?>) Php Bracket. I've got some "Headers allready sent" Errors. After removing the whitespace it works like a charm :)

    Thanks for your work.

  11. CraigWatson
    Member
    Posted 1 year ago #

    Hi,
    Cheers for the heads-up, I'll add it to the things I need to check for v2 - which file was producing the errors?

    Craig

  12. gearsdigital
    Member
    Posted 1 year ago #

    You'll find the whitespace in all of the 4 changed files. I've used a clean WP3 Install (german localization) to test it out. It seems to be reproducable.

  13. gearsdigital
    Member
    Posted 1 year ago #

    Craig,

    is there a way to display galleries like this http://example.com/photos/galleryname and any further gallery http://example.com/photos/other-galleryname ?

    http://example.com/photos/ should be an overviewpage of all Galleries.

    Currently i got urls like this one: http://example.com/photos/photos/galleryname.
    The first photos section is a wp-page where i call the album[album id=1 template=extend] .The name of the Album is also photos... Any suggestions?

  14. brightsites
    Member
    Posted 1 year ago #

    Legend... Just wanted to say thanks for this mod.

  15. brightsites
    Member
    Posted 1 year ago #

    Is there a way to change the Page title to me more SEO friendly?

  16. Sjeng
    Member
    Posted 1 year ago #

    I'm not sure if this is really related, but I've noticed something with the album links:
    I've made a page that contains all albums, which acts as the main page for all my photo-galleries.
    When I click a gallery in an album, the gallery opens in the same page where I was, only leaving out all other albums, and only showing me the gallery I clicked.
    The thing is, I've placed some text along with the albums, so when I click on a gallery, I see the gallery plus all the text from the main photo-album page, which is NOT what I wanted.
    I've created sub-pages for all seperate albums, like so:
    Photo-albums (main page with text + all [album id=x template=extend] codes)

  17. |___Album 1 (page with 1 [album id=x template=extend] code)
  18. |___Album 2 etc.
    1. |____gallery 1 (page with 1 [nggallery id=x] code)
    2. |____gallery 2 etc.

    These pages work fine when I use my menu navigation, but the albums do not link to these pages. Instead they open the albums on the same page they're on (the main photo-albums page) somehow. here's the page
    Linking the albums to these pages from the nggallery menu doesn't work, whether I use the permalinks option or not... I've actually noticed the same thing on the nextgen website itself... You can see how the page title remains the same, and in the link url of the albums you can also see the link isn't redirected to any subpages.

    So either I'm doing something wrong, or there's still something not quite right in the plugin...
    I hope I'm being clear :P kinda hard to explain...
    Would this patch fix that???

  • FotoAndy
    Member
    Posted 1 year ago #

    Craig, you're awesome for adding towards further improvement of NextGen, especially in the SEO gap. Gold star!

    I'll run it through my site over the next couple of days and post up some feedback. Since I use a host of extra Nextgen plugins (Tag Search v0.6, Custom fields, Voting, SEO Titles), could be interesting to see if it all plays nice.

    If I may ask, would this hack/eventual patch then eliminate need for the Nextgen SEO Titles plugin? One less plug-y to deal with is always good.

  • FotoAndy
    Member
    Posted 1 year ago #

    [test page link]
    Files are installed, patch activaed (slug is 'fotosets'), cache cleared etc, and yet sadly no visible changes in the source code. Also, disabled the Nextgen SEO Titles plugin to minimize possible conflict or confusion.

    I am presuming I'm looking for "

      img title=
    " to every thumb. Please inform if I'm mistaken on that, that has been what I've noticed is different about your sample pages.

    Could it be that code mods for a Nextgen Custom Field in my custom gallery.php is interfering? My php buddy moved stuff around, so if there's any reference to gallery.php I'd need to know which code it's looking for.

    Hope this is of help.

  • FotoAndy
    Member
    Posted 1 year ago #

    No love for the feedback?

  • CraigWatson
    Member
    Posted 1 year ago #

    gearsdigital, brightsides, Sjeng and FotoAndy,

    Thanks for your feedback, unfortunately I have a lot of freelance (paid) web development work outstanding at the moment and various personal situations that I need to deal with, so while I do really value the feedback, I'm unable to work on the plugin at this point - I'm trying to put as much on hold as I can to deal with everything.

    I should be able to start work again on Monday 2nd August. In the meantime, I will try and provide support if needed, however it will be on a "if I have time" basis.

    If anyone has the time to develop this fix further, please by all means email me at craig@cwatson.org or post here.

    What I'm planning to do is develop a full "version 2" of my patch, and release it as I have done here - this will supersede v1 above, and (should) fix the problems you have all experienced.

    This "v2" will involve changing the NextGen database schema to include a sanitised gallery name to solve the special characters problem.

    I'll address all of your problems individually in messages to follow. Thanks again for your feedback, hopefully you'll bear with me.

    Cheers,
    Craig

  • CraigWatson
    Member
    Posted 1 year ago #

    @gearsdigital:
    You should be able to create nested albums, my website at http://www.cwatson.org is using one main "Gallery" album, with separate sub-albums acting as categories.

    -------------------------------------------------------

    @brightsides:
    Page titles can be handled by a separate NextGEN plugin, available through the WordPress plugin system - the name is NextGEN SEO Titles I believe.

    -------------------------------------------------------

    @Sjeng: The way I have designed the plugin is that there is only *one* page within WordPress that handles the gallery. From there, navigation is handled by the URL, using WordPress' permalink rewrite structure to extract the full path to galleries/albums/subalbums.

    Basically: you have a single gallery "homepage" and the plugin does the rest for you - so no subpages for albums etc.

    If you would like text with each gallery, I would suggest using NextGEN's description field. My plugin doesn't alter any of the code output by NextGEN, just adds the permalink rewrite functionality.

    -------------------------------------------------------

    @FotoAndy:
    Similar to Sjeng above, my patch only provides URL rewrite functionality, it doesn't alter any of the XHTML code output by NextGEN or WordPress. From your test URL, you seem to have the plugin installed OK and it seems to be working fine - the prefix slug seems to be "sets" rather than "fotosets".

  • Sjeng
    Member
    Posted 1 year ago #

    Well, I just found out I completely misunderstood a setting that is actually in your plugin:
    I only needed to UNcheck "Deactivate gallery page link:" in the gallery options tab. This makes the Albums redirect to the page you entered in the "linked to" field, so this way, you CAN create subpages, link galleries to them, and have the albums do the same :D

    So in my case, problem solved (although you might want to clarify what this function does a little more in the readme ;) )

    Thanks!

  • CraigWatson
    Member
    Posted 1 year ago #

    @Sjeng:

    I'm not the main NextGEN developer - I'm just contributing the URL rewrite code.

    The patch I'm supporting here is just that: a patch to the main NextGEN Gallery plugin to enable users to create SEO-friendly permalink structures.

    The purpose of these structures is so that you don't have to use linked pages to create a "nice" URL structure with nested albums being handled automatically by the URL rather than being explicitly linked within WordPress by pages.

    A URL of http://www.example.com/gallery/holiday/london/zoo would automatically route to the appropriate place, without any "holiday", "london" or "zoo" pages existing in WordPress.

    Again, to clarify: my patch above is merely an unofficial modification to NextGEN, which I'm hoping Alex Rabe will incorporate officially when it has been tested enough :)

    Cheers,
    Craig

  • FotoAndy
    Member
    Posted 1 year ago #

    Thanks for the feedback Craig, as well as patience with the rest of us jonesing for this patchs' functions.

  • ginit
    Member
    Posted 1 year ago #

    Thankyou guys, especially Sjeng-

    You made me realize i overlooked that option (and the activate permalinks option) too.

    My problem was to create a nice breadcrumb for my NextGEN Gallery.

    You can find an explanation here.

  • michael divine
    Member
    Posted 1 year ago #

    Hi craig,
    This sounds like it might be what I've been looking for - better permalinks for the imagebrowser - album -> gallery -> imagebrowser

    RIght now it goes:
    http://WEBSITE.com/ALBIM/ ->
    http://WEBSITE.com/ALBUM/GALLERY/ ->
    http://WEBSITE.com/nggallery/page-638/image/461/

    .... which is terrible. I would love the imagebrowser to display this URL:

    http://WEBSITE.com/ALBUM/GALLERY/IMAGE-NAME
    or even
    http://WEBSITE.com/IMAGE/IMAGE-NAME

    I tried clicking through a few people's examples above but didn't find anything relevant - most people's images click through to .jpg and your own example seems to be giving a 403 Forbidden error.

    Any suggestions?

    Thanks!

  • CraigWatson
    Member
    Posted 1 year ago #

    Hi Michael,
    My own gallery should be back up now - problem was my web-host switching to the Litespeed server and it treating my setup slightly differently than Apache did, I basically have a WP page and a folder of the same name, something that Litespeed doesn't like!

    Unfortunately my mod doesn't go as far as image names, it just rewrites the gallery/album part of the URL. Hopefully when I get some spare time to work on the mod, I'll be able to add this, but ideally I'll be submitting a complete code change to Alex Rabe to release with NextGEN, as the changes needed are too complex to release as a standalone mod.

    Hope that's OK, sorry I couldn't be more help, I'm in about 10 places at the moment!

    Cheers,
    Craig

  • CraigWatson
    Member
    Posted 1 year ago #

    Hi everyone,
    Just an update to proceedings.

    I have now started work on version 2 of the patch, however I think the best way to continue work is to submit code to Alex Rabe (NextGEN's maintainer) to officially integrate, rather than releasing the patch as standalone.

    The reason for this is that the v2 of my patch incorporates database schema updates, and these are best left to NextGEN itself to deal with - I don't want to be responsible for people's databases breaking on future NextGEN upgrades.

    I will continue to support v1 of my patch here, but please be aware that there are problems/issues with it (discussed above) and it may not be a complete solution - though it has been proven to work with many people's installations.

    I hope to have v2 finished and submitted to Alex this week, so hopefully it'll make it into NextGEN 1.6.0, due for release in two weeks.

    Many thanks everyone,
    Craig

  • CraigWatson
    Member
    Posted 1 year ago #

    Quick progress update - v2 of my patch has been completed, though it won't make NextGEN until v1.7, as Alex has already frozen features for v1.6.0.

    If people are interested in testing v2, please post here or email me at craig@cwatson.org. Knowledge of patch files and database schemas are advised - though not required - the more independent testing I can do here, the less Alex needs to do in the future :)

  • mykkal
    Member
    Posted 1 year ago #

    Hey Craig any update? I have NextGen 1.7.4 installed and haven't experienced any SEO yet. Plus the URLS are still ugly.

    Tho I did see an option to prep the database for SEO friendly permalinks but that hasn't happened yet.

    Please advise... I' noticing your last reply was 7 months ago so I'm hoping there's an update.

    Thanks so much for your hard work. With all the images we have...getting nextgen indexed would be a huge boom for the site.

  • 12

    Topic Closed

    This topic has been closed to new replies.

    About this Plugin

    About this Topic

    Tags