Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing blog_list route from links #18

Open
phideas opened this issue Jan 9, 2017 · 2 comments
Open

Missing blog_list route from links #18

phideas opened this issue Jan 9, 2017 · 2 comments

Comments

@phideas
Copy link

phideas commented Jan 9, 2017

I did setup 2 separate blogs on site using 2 blog_list pages. Archive plugin missing the blog_list page route in links to archived pages. I solved this with a quick hack. Please check it out.

Added new variable "route" in user/plugins/archives/archives.php

            if ($new_approach) {
                 $collection = $page->children();
+                $this->grav['twig']->twig_vars['route'] = $page->route();
            } else {

Added "route" in user/plugins/archives/templates/partials/archives.html.twig

    	<a href="{{ base_url }}{{ route }}/{{ config.plugins.archives.taxonomy_names.month }}{{ config.system.param_sep }}{{ month|date('M_Y')|lower|e('url') }}">
@kenton-r
Copy link

This can also be added with the following in the partial templates:
{% include 'partials/archives.html.twig' with {base_url:base_url ~ page.url} %}

This adds the link to route to the same page (blog) that you are on.

@hkockerbeck
Copy link

As a short remark, if you're using multiple languages, you need to use another variable, because both base_url and page.url contain the language code. With base_url:base_url ~ page.url, you'll end up with something like https://your-site.tld/en/en/blog/archives_month:aug_2019, which will lead to a 404 error. The theme variable base_url_simplecontains the base url without the language code. So you can just use base_url:base_url_simple ~ page.url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants