Re: [nikola-discuss] Can put submenus on NAVIGATION_LINKS option in conf.py

12 views
Skip to first unread message

Chris Warrick

unread,
Feb 20, 2018, 6:16:13 AM2/20/18
to Nikola—Discuss
On 16 February 2018 at 03:27, MAVignau <mavi...@gmail.com> wrote:
>
> When I try to put:
>
> NAVIGATION_LINKS = {
> DEFAULT_LANG: (
> (
> ('https://apple.com/', 'Apple'),
> ('https://orange.com/', 'Orange'),
> ),
> 'Fruits'
> )
> }

You seem to be missing one level of tuple:

NAVIGATION_LINKS = {
DEFAULT_LANG: (
(
(
('https://apple.com/', 'Apple'),
('https://orange.com/', 'Orange'),
),
'Fruits'
), # note trailing comma here
),
}

(Trailing comma due to Python syntax oddity regarding tuples.)

--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16

MAVignau

unread,
Feb 25, 2018, 6:57:32 PM2/25/18
to nikola-discuss
Thanks!

Sadly, I must say it doesn't work

Just the same error:

########################################
TaskError - taskid:render_listings:output/listings/index.html
PythonAction Error
Traceback (most recent call last):
  File "/home/marian/PycharmProjects/blog/nikola/lib/python3.5/site-packages/doit/action.py", line 403, in execute
    returned_value = self.py_callable(*self.args, **kwargs)
  File "/home/marian/PycharmProjects/blog/nikola/lib/python3.5/site-packages/nikola/plugins/task/listings.py", line 177, in render_listing
    self.site.render_template('listing.tmpl', out_name, context)
  File "/home/marian/PycharmProjects/blog/nikola/lib/python3.5/site-packages/nikola/nikola.py", line 1484, in render_template
    template_name, None, local_context)
  File "/home/marian/PycharmProjects/blog/nikola/lib/python3.5/site-packages/nikola/plugins/template/mako.py", line 117, in render_template
    data = template.render_unicode(**context)
  File "/home/marian/PycharmProjects/blog/nikola/lib/python3.5/site-packages/mako/template.py", line 471, in render_unicode
    as_unicode=True)
  File "/home/marian/PycharmProjects/blog/nikola/lib/python3.5/site-packages/mako/runtime.py", line 838, in _render
    **_kwargs_for_callable(callable_, data))
  File "/home/marian/PycharmProjects/blog/nikola/lib/python3.5/site-packages/mako/runtime.py", line 873, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/home/marian/PycharmProjects/blog/nikola/lib/python3.5/site-packages/mako/runtime.py", line 899, in _exec_template
    callable_(context, *args, **kwargs)
  File "/home/marian/PycharmProjects/blog/site/cache/.mako.tmp/base.tmpl.py", line 98, in render_body
    __M_writer(str(rel_link(permalink, url)))
  File "/home/marian/PycharmProjects/blog/nikola/lib/python3.5/site-packages/nikola/nikola.py", line 1998, in rel_link
    dst = urljoin(src, dst)
  File "/usr/lib/python3.5/urllib/parse.py", line 415, in urljoin
    base, url, _coerce_result = _coerce_args(base, url)
  File "/usr/lib/python3.5/urllib/parse.py", line 111, in _coerce_args
    raise TypeError("Cannot mix str and non-str arguments")
TypeError: Cannot mix str and non-str arguments

Chris Warrick

unread,
Feb 26, 2018, 5:47:08 AM2/26/18
to Nikola—Discuss
Check if you’re using correct syntax. The example I posted works, you
might still have typos somewhere. (Paste NAVIGATION_LINKS if you still
encounter problems.)
> --
> You received this message because you are subscribed to the Google Groups
> "nikola-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nikola-discus...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages