• Resolved michaeltw

    (@michaeltw)


    Hi, I’ve searched around and tried different things but can’t find a solution.

    For crawling purposed I’d like to have each gallery/album have its own unique page title instead of it being just the page title that the shortcode was inserted on.

    I’ve done part of this with a function in functions.php updating the canonical URL for each album/gallery. Now I’d like to update the page titles so they take into account the actual gallery I’m viewing.

    I was suggested to try the code below as a start but can’t figure out how to implement it in a function that returns the page title. I can staticly set a page title via another simple function and just want to feed it the current gallery title to do the rest.

    $router = C_Router::get_instance();
    $slug = $router->param(‘gallery’);
    $gallery = C_Gallery_Mapper::get_instance()->get_by_slug($slug);
    return $gallery->title;

    Any ideas? Advice? Links? Just need a hint on best way to handle it.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Michael, I’m not advanced enough to help decode that, just a fellow user, but I wonder if there is an easier way to generate it? If you have an album named ALBUM1, and you have a GALLERY named GALLERY1, and in Other Options / Miscellaneous / URL Slug you have the URL sub-slug as NGGallery, then regardless of what “page” it is on, your gallery has a URL of:

    https://www.domain.com/Album1/NGGallery/Gallery1

    It isn’t an actual “page”, it is generated by NGG when you go to it, and you can change the URL slug to something shorter, but it might be easier to generate “that” than to pull it from the page it is inserted on? Just a thought…

    Paul

    Thread Starter michaeltw

    (@michaeltw)

    Thanks for the suggestion. My URL situation is great right now and the function I added to set my canonical seems to do just what I want too.

    I’d just like to try and set the page title dynamically from the gallery title.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding gallery title to page title’ is closed to new replies.