I have a model named Portfolio. I list all the Portfolios I created on my page in a drop down menu like this:
<ul>
<% #portfolios.each do |portfolio| %>
<li style="z-index: 2;"><%= link_to portfolio.name, portfolio_path(portfolio) %></li>
<% end %>
</ul>
I have three Portfolios in the drop down menu: Advertising, Graphic Design, Web Development. Then I also have a menu item called Photography which opens up a sub-menu of Portrait, Landscape, and Editorial. So Advertising, Graphic Design, Web Development, Portrait, Landscape, Editorial are all models of Portfolio. Photography is just there to facilitate a sub-menu for Portrait, Landscape, and Editorial. I'm not really sure how to set this up. Should I create a new model named something like Photography_Portfolio? And how do I create the Photography menu item if it's not a Portfolio?
What are you storing in the Portfolio model? I would probably just hard code the menu.
Depending on the use case I would hard code the Top level menu items and pull in the different portfolios in the drop down menu, you could, for example, create different scopes for the different types.
Related
I'm new to shopify and customizing an existing theme. I was wondering how to do the following.
I have two navigation items (in navigation section of admin):
COLLECTIONS
Men
Women
Kids
-and-
INSPIRATIONS
Casual
Vacation
Weekend
Business
Currently I have two items in my main menu corresponding to COLLECTIONS and INSPIRATIONS (with corresponding dropdowns). I was wondering how to put them both under one main item
SHOP--------------------------------------
COLLECTIONS INSPIRATIONS
Men Casual
Women Business
...
Thanks in advance
Julia
What you are talking about is called "Link Lists" in Shopify. This is what you need to do
Go to Admin -> Navigation and edit menu of "Main Menu"
Add a single item "Shop" and select "All Collections" as the link
Go back to "Navigation" and create a new menu "Shop"
Add two items "Collections" and "Inspirations"
Now you have linked "Collections" and "Inspirations" menu to a parent menu "Shop"
Note: The title of the items inside a menu should always be the same as that of the menu you want to link together.
Refer to this for more details: Create a drop-down menu on my storefront
Next comes displaying submenus inside the menu. Shopify default theme doesn't have this feature out of the box. You can refer to this Shopify thread for implementation: Multi-level menus in Shopify. It is fairly straightforward.
I'm setting up a RefineryCMS site, I'd like to have the menu links showing the page full title on hover. In other words, every li element of the menu should be in this form:
<li>my_page_menu_title</li>
Where "my_page_main_title" is the one the admin enters at the top of the Page form and "my_page_menu_title" is the one in the advanced options.
I figured out I have to override _menu_branch.html.erb, but what should I put after title: ?
<%= link_to(menu_branch.title, refinery.url_for(menu_branch.url), title: ) -%>
Thank you.
PS: I'm riding refinerycms-core v.2.0.9
If you simply want to display the page title as the title attribute and the menu title as the one in the link tag like this:
<a href='/my_page_url' title='Entered Top Of Page Form'>Menu Title</a>
Then you'd have to decorate the model and override the branch like so: https://gist.github.com/parndt/5147926
I've added a custom engine into my refinery app with an image field. It all links up great and in the admin areas I can add images to it, etc.
I have a question about adding said images to a view however. At the moment I have the following code in a view:
<img src="<%= project.picture.url %>" alt="Image description" />
This displays my image nicely (although its probably not the best method - tips welcome) but I wanted to know how to access the thumbnail of that image. I noticed in others areas of refinery you can call a thumbnail method on an image object.
<%= image_fu image, ::Image.user_image_sizes[thumbnail.to_sym],
:class => "brown_border",
:class => "current_picked_image" %>
Please could someone run me through the steps of how to achieve this. The code snippet above comes out of the image_picker page code. Being quite new to rails I'm not sure how I would achieve this in my own page.
Thanks in advance for your help!
With image_fu:
<%=link_to (image_fu project.picture, '160x104'), project.picture.url %>
I'm running sphinx, thinking sphinx and have a basic ordering system with companies, users, order, notes, comments amongst others.
TS is running fine, searching in individual models and their nested resources is working brilliant.
What I wanted to do is have a global search form in my header (application.html.erb). The problem is where my form's posting to.
<%= form_tag companies_path, :method => 'get', :id => "companies_search" do %>
<p>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag "Search", :name => nil %>
</p>
<% end %>
Obviously this works for my companies and nested resources. If I put it in my header, any result will be returned on my company layout.
Is it possible to create a dynamic alternative to companies_path?
Or, should I create some special layout?
What does everyone else do here?
I'd create a separate action for handling global searches - or at least, separate routing back to a reusable search action, and have that action detect whether it's a global search, company search, etc.
As for the header - do you always want it global? Because that's easy enough - just use the global/generic search action for the form constantly. If you want it done dynamically, though - defaulting to the context of the models if appropriate? - I'd probably opt for a content_for block, and add the appropriate search form in each of the relevant views.
Of course, that gets messy, so a different way could be to just customise the url via a helper that looks at params[:controller] to see what the current context is. No idea how fragile this might get, though.
I am building an e-commerce site and am wondering if having 2 identical navigation menus will hurt my SEO efforts.
I have a drop-down menu at the top of the page. That lists main categories, followed by sub-categories.
On my left navigation I have the same thing.
Both are structured like so:
<ul>
<li>Main Category 1
<ul>
<li>Sub Category</li>
<li>Sub Category</li>
<li>Sub Category</li>
</ul>
</li>
<li>Main Category 2
<ul>
<li>Sub Category</li>
<li>Sub Category</li>
<li>Sub Category</li>
</ul>
</li>
</ul>
The only difference is that I am using CSS to hide the main categories on the left navigation. Search engines will not be able to see this and will interpret it as an identical menu as the top menu.
Will this confuse the search engines? If so what if I just display sub-categories on the left menu without using CSS to hide the main categories?
Thanks in advance,
JR
You'll really want to consider the link structure on the rest of the page before making a complete decision, however, for the most part you should be fine.
There are SEOs who would say that you're diluting the impact of your other links by adding duplicate links to your page. There are some that believe that only the first link actually counts; and there are others who say the more the merrier.
It sounds like you're hiding the main categories mostly to improve the look of the left navigation so it doesn't look redundant but you still want to maintain the semantic hierarchy of the menu. I think this is perfectly reasonable as long as you believe you're improving the user experience (Ux) of the page.
The minutia that you're concerned about here is insignificant compared to other factors of the page.
Simply put, duplicating the navigation like this probably won't help or hurt your SEO initiatives. Just opt for what provides you the best user experience while taking into account code maintainability. Conversions from a better Ux will greatly out weight a small SEO tweak like this.
Making two different menus in your website is good as far as SEO is concern as Google or other search engines give value to user friendly layouts of websites. Having a menu on left side make it much more convenient for a visitor to navigate through your websites. As far as my knowledge is concern, there will be no harm and your website will work fine with search engines.
Although, you can not hide anything from search engines and they surely do not like hidden things. Why not you make an accordion style menu in which you only show main categories on the side menu. Once user click on a main category, it gets expand and show sub-categories. While clicking the same main category again will shrink the menu back to its original structure. Hope you will understand my point.
If anything you're doing only exists for the sake of bots, you might want to reconsider why you're really doing it. There are numerous resources that talk about what not to do in terms of SEO.