Git Product home page Git Product logo

Comments (5)

rhukster avatar rhukster commented on June 20, 2024

Ok tracked down the problem. Basically shortcode-core was only setting the twig vars in onTwigSiteVariables() event. This is not available when Modular pages are rending, so i needed to add some logic for onTwigPageVariables(). So should be good after next release.

from grav-plugin-shortcode-core.

rhukster avatar rhukster commented on June 20, 2024

ok fixed in latest release.

from grav-plugin-shortcode-core.

giansi avatar giansi commented on June 20, 2024

Just tried and it does not work for me. When I have this setting in my page's header:

content:
  items: @self.modular
  order:
    by: default
    dir: asc
    custom:
        - _what_we_do
        - _portfolio
        - _clients
        - _team
        - _where_we_are
        - _contacts

shortcode variable is still null: am I missing something?

from grav-plugin-shortcode-core.

rhukster avatar rhukster commented on June 20, 2024

I think your confused as to the way modular pages work. It's quite similar to a blog list in that the modular.html.twig template loops over a page collection to create the resulting total page. Each modular page though gets it's content() method called and in each of those modular sub pages. The shortcodes are then associated with each modular sub-page, not the parent page.

The way I tested was to use the one-page skeleton and then add an 'author' section shortcode to the showcase.md modular page. Then I added a {{ shortcode.section.author }} in the templates/modular/showcase.html.twig file that renders it, and it worked fine.

BTW, you should be able to get to the shortcodes from each modular page with the page.find() technique.

from grav-plugin-shortcode-core.

giansi avatar giansi commented on June 20, 2024

Got it.

from grav-plugin-shortcode-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.