• Resolved Greg_R

    (@greg_r)


    Since I am using a dropdown to filter my galleries, the resulting urls are OK, but not very user friendly. Specifically, I need to replace ?current_item=. Is there a method within MLA to enter SEF urls, or will that require a modification or additional plugin?

    • This topic was modified 7 years, 4 months ago by Greg_R.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author David Lingren

    (@dglingren)

    Good to hear from you again. I assume this new question is a follow-on to your earlier topic:

    Can a gallery be filtered by a dropdown and no submit button?

    In the earlier topic we worked out a solution that combined an [mla_term_list] shortcode to select an attachment_category term with an [mla_gallery] shortcode that displayed items assigned to the selected term. The current_item query parameter assed the selected term from the term list to the gallery display.

    Since you are using a custom template to present the term selection control you have some flexibility in the way it passes the chosen term to the gallery display. You can add some JavaScript code to your template to compose any URL you want. You might need to use the hooks MLA provides in [mla_gallery] to process the URL in a different way, extracting the selected term for filtering the gallery display.

    If you can give me a more specific explanation and an example of your “SEF urls” I can ponder a possible solution. Thanks for any additional information you can provide.

    Thread Starter Greg_R

    (@greg_r)

    Ok, currently with the above shortcodes you have listed, a typical page, which is a combination photo gallery and Woocommerce thumbnail layout, has a subcategory url like this:

    https://mysite.com/fireplace-hearth-products/?current_item=fireplaces

    The ideal would be for the url to display as: https://mysite.com/fireplace-hearth-products/fireplaces

    The only caveat, and probably the deciding factor, is that each subcategory needs to have a different header banner and an introductory paragraph above the gallery. There are about 81 subcategories total. Therefore, in addition to the url change, I need to pull in the Att. Category description field, populate an <h2> tag with the Att. Category name, and change a CSS attribute for the banner.

    The alternative is that I create all of these pages manually, and simply use the shortcodes to generate only one subcategory of gallery at a time, with manual links to each parent category.

    Plugin Author David Lingren

    (@dglingren)

    Thanks for the additional details. In your first post you wrote “the resulting urls are OK, but not very user friendly.” and later mentioned “SEF urls“, which I understand to mean “Search-engine Friendly”. Is that right?

    I am hard-pressed to understand why a (human) user would object to the current_item format. After all, they get the display they are after. I can understand the search-engine objective, but I am not sure there is a solution that would help in that regard. Your “typical page” has a dropdown select control that generates a query argument when a user selects a term from the list. How do you get a search engine to figure out how to select each item on the list an see where it goes? You wrote “The ideal would be for the url to display as: …” If the URL only displays after a user clicks in the dropdown list, and the search engine doesn’t know how to click in the list, the search engine will never “see” the URL. Have I missed something?

    I am not an SEO expert by any means, but it seems to me that a search engine needs a way to discover the page(s) on a site and then call up each page to discover what’s in it. What am I missing?

    Thread Starter Greg_R

    (@greg_r)

    David, thanks again for the reply and asking for details. Yes indeed, SEF stands for search engine friendly. Certainly as a coder, it’s not bothersome to see question marks and equal signs in URLs, but it is standard practice to remove those where possible. For the end user, including this client, and every client I’ve ever worked with, it’s preferable to not have those characters (?,=) in a link, because we don’t use them that way in a sentence. Keep in mind that WordPress’ own Permalinks system is an SEF url system, and its job is mostly to remove question marks and equal signs. That’s why an add_rewrite_rule() function exists in the core code.

    On the purely SEO side of things, one thing to understand is that any URL that exists within the source code of an HTML page will be followed by search engines unless you tell them not to. For my needs on this particular project, in addition to the dynamically generated gallery, I need to link directly via menu to each subcategory. That’s why it would be very helpful if not essential, to have SEF links.

    Plugin Author David Lingren

    (@dglingren)

    Thanks for the additional information. As I wrote, I am not an SEO expert and I always appreciate the opportunity to learn more about it. SEO has been a popular topic over the years, and you can find quite a bit of information in these earlier topics (and additional topics they link to):

    MLA no image attachments in sitemap

    No Posts for Archive Pages Att. Tags & Att. Categories

    ‘Page not found’ when clicking Att. Tag in WP default Tag Cloud widget?

    The SEF friendly links you propose, e.g., https://mysite.com/fireplace-hearth-products/fireplaces, look like those WordPress generates for “archive pages”. In the earlier topics you will see that WordPress archive pages are expressly coded to omit the media/attachment pages associated with Media Library items. Several earlier topics give solutions to this problem that involve modifying the theme’s PHP template files for taxonomy archive pages to select and display images and other Media Library items. This might be a good approach for your application.

    There are many ways to let a user pick a taxonomy term for filtering a display. The [mla_tag_cloud] and [mla_term_list] shortcodes can generate links for each term along the lines you want. Your current application is a bit different; is uses a form and a dropdown control for term selection. When the user selects a term in the dropdown control a bit of JavaScript submits the form. The current_item contains the value of the control, but the only “link” on the page simply returns to the same page; the control value is not part of the link until the form is submitted. I don’t know if a search engine will contain logic to try selecting each value from the dropdown control and submitting the form.

    You wrote “I need to link directly via menu to each subcategory“. You can do this with [mla_term_list] by selecting a different mla_output value, such as “flat” or one of the list formats. All of these generate static links and you can format the link in the SEF way you propose. You could generate the list in a hidden part of the page if you don’t want the user to see or use it.

    You would still have to solve the problem of generating the subcategory/archive pages once the link is followed. Modifying the template files might be the best way to implement a dynamic solution that doesn’t require maintenance when the term list changes.

    I hope the above suggestions and links are helpful. I am happy to give you more specific help once you decide on the approach that works for your application. Thanks for a stimulating discussion.

    Plugin Author David Lingren

    (@dglingren)

    It has been a month since my last post in this topic. I assume you have found a solution that works for your application.

    I am marking this topic resolved, but please update it if you have any problems or further questions regarding the above suggestions. Thanks again for your interest in MLA.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Can query urls be replaced with SEF urls?’ is closed to new replies.