Search code examples
pythonhtmlcsspelican

Python Pelican order menu items


This is a followup question based on the answer provided by jcollado over here. I setup my menu as he described but now I am unable to actually add my active css to the active item.

DISPLAY_PAGES_ON_MENU = False
DISPLAY_CATEGORIES_ON_MENU = False
MENUITEMS = (
    ('HOME', '/'),
    ('ABOUT', '/pages/about.html'),
    ('JOURNAL', '/category/journal.html'),
    ('CONTACT', '/pages/contact.html'),
)

When I go back and remove the display pages and categories on menu and menu items. The menu's active css works but then my menu has terrible ordering.

Is there some way that I can order the pages without breaking my css?

I have pages defined as markdown files. If my menu was only pages I could order by a custom attribute. The problem is that there are 3 pages and 1 category, the category is based on a folder inside the /content/category

Is it possible to overcome this obstacle?


Solution

  • Pelican 3.5, which was just released this week, includes a new PAGE_ORDER_BY setting. This was discussed at length in issue #420 and is briefly mentioned in Pelican Docs > Settings.

    If you want the pages to appear at example.com/yourpage, use the appropriate URL settings:

    PAGE_URL = '{slug}'
    PAGE_SAVE_AS = '{slug}'