How to create a dynamic “this week’s menu” button for your intranet

People jokingly (or not) sometimes tell me the only reason for which they use the intranet is the cafeteria menu. So on a recent draft of a redesigned homepage, I introduced a prominent “Menu” button that would always be linked to the most recent menu uploaded by dining services.

menu

Previously people would click a link which took them to a document library where the current menu lived, and would open it there. 2 clicks.

I had two goals for this project.

  1. Get it down to 1 click.
  2. Never have to manually update the link for the button. Set it, forget it.

Note: this could easily be applied to newsletters, updates, meeting minutes, etc. Anything that is published on a regular basis that could benefit from an always-current hyperlinked button.

Here’s how you can do the same:

You need:

  • Document library or list where you keep your menus or links to menus
  • A classic view SharePoint page where you’ll be placing it (not compatible with modern experience)
  1. Create your graphic for the button (any image file). Feel free to download my chalkboard, and overlay your own text. Once edited as you’d like, resize to ~120×143 px. Upload the image to your Site Assets folder or wherever you place images like these in your SharePoint environment.
    menu-board
  2. Copy the URL to the newly uploaded image
    copy URL
  3. Navigate to the document library or list where you’re keeping your menus or links to menus
  4. Click “Library” from the ribbon menu then “Library Settings”
    library settings
  5. Create column
    create column
  6. Enter column settings, and make sure to remove the column from any views. You won’t need to see it for anything.
    1. Name your column. I called my column “WF_Img”
    2. If menus are the only thing in your library OR if you will only be doing a project like this for menus, just create a single line of text and set the default value to your image’s URL (recommended). Any items added after the creation of the column will get the image by default.
      wf_img text
      Single line of text (one document type OR the only use of this column is for menus)

      -OR-

      If you have multiple types of documents, create a calculated column (text format) that will look at a field like “Category” to determine if the document is a menu or not.

      =IF(Category="Menu","https://domain.sharepoint.com/site/SiteAssets/menu.png","")

      This will allow you to do similar projects later with the other files if they need a thumbnail/button/icon

      wf_img calc
      Calculated column (multiple content types)
  7. Create a content query web part on the classic/wiki page where you’d like to place the button.
    1. Click in white space or “Add a web part” where you’ll place the button
    2. In the ribbon, Click “Insert” –> “Web Part”
      insert web part
  8. “Content Rollup” –> “Content Query” –> “Add”
    insert content query
  9. This step might work best in Internet Explorer: Modify the settings for the newly added web part
    1. Click the dropdown arrow on the new web part and “Edit web part”
      EditWebPart
    2. Select “Show items from the following list” and paste or browse to the list or library where you upload or add your menus
    3. If your menus are a specific content type, select that to filter results. You can also use “Additional filters” to say things like “Show items when CATEGORY is equal to MENU.
      content query settings1
      content query settings2
    4. Sort items by Created in descending order, and limit the items to display to 1
    5. Set item style to image only, clickable
      content query settings3
    6. Leave Link to the default value (URL Path) and add WF_Img; (or whatever you named your image column) to the Image field
      content query settings4
    7. Set Chrome Type to “None”, Click “OK” and Save/publish the page
      content query settings5

That’s it! Your button will always be linked to the most recently created file or item.

menu

Advertisements