Giter Club home page Giter Club logo

docpad-plugin-multiplelayouts's Introduction

Multiple Layouts Plugin for DocPad

Travis CI Build Status NPM version NPM downloads Dependency Status Dev Dependency Status
GitHub Sponsors donate button Patreon donate button Flattr donate button Liberapay donate button Buy Me A Coffee donate button Open Collective donate button crypto donate button PayPal donate button Wishlist browse button

Add additional layouts to your documents by adding 'additionalLayouts' to a document's metadata.

Usage

Multiple layouts lets you add additional layouts to your document. You can do this by adding the additionalLayouts meta data property to your document's meta data like so:

---
title: Some Document
layout: default
additionalLayouts: data
---

Blah blah

If this document was located at src/documents/index.html and we had a layout default.html.eco and a layout data.json.eco then we would end up with the following output:

  • out/index.html
  • out/index-data.json

Install

Install this DocPad plugin by entering docpad install multiplelayouts into your terminal.

History

Discover the release history by heading on over to the HISTORY.md file.

Contribute

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

Backers

Maintainers

These amazing people are maintaining this project:

Sponsors

No sponsors yet! Will you be the first?

GitHub Sponsors donate button Patreon donate button Flattr donate button Liberapay donate button Buy Me A Coffee donate button Open Collective donate button crypto donate button PayPal donate button Wishlist browse button

Contributors

These amazing people have contributed code to this project:

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

License

Unless stated otherwise all works are:

and licensed under:

docpad-plugin-multiplelayouts's People

Contributors

balupton avatar dependabot[bot] avatar evantill avatar neilbaylorrulez avatar nfriedly avatar robloach avatar vsopvsop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docpad-plugin-multiplelayouts's Issues

New docs get created in docpad, but they don't actually get rendered / written (?)

I'm importing documents from MongoDB and trying to send them to a second layout with this plugin. I poked around with the plugin, adding logging at various places, and for the most part it appears to be working correctly - it creates new docs, sets the layout, relativePath, etc. But they never get rendered - I just get 404's in development and there's no trace of the extra files in the static output. There are no errors logged in a normal docpad run.

The only thing I notice was that the new docs were keeping the url value from the old ones, but even after I modified the plugin to correct that, I still don't get rendered files.

My source documents look like this:

    {

        "id": "rave",
        "production": true,
        "name": "Visualization Rendering",
        "url": "visualization-rendering.html",
        "category": "relating",
        "urlIcon": "img/service-icons/rave.png",
        "urlGif": "img/service-gifs/rave.png",
        "shortDescription": "Graphical representations of data analysis for easier understanding",
        "description": "...",
        "urlDocumentation": "http://rave.mybluemix.net/learn.html",
        "urlJumpTo": "http://rave.mybluemix.net/downloads.html",
        "urlJumpToText": "Download SDK",
        "hideBluemix": true,
        "urlDemo": "@rave@",
        "needsTeam": false,
        "needsContent": false,
        "needsTraining": false,
        "team": false,
        "content": false,
        "training": false,
        "input": [
            "Data to be visualized and a visualization description"
        ],
        "output": [
            "Interactive visualizations of the input data in your application"
        ],
        "intendedUseHeadline": "This service is an SDK that can be used to visualize any numeric data.",
        "contentSet_beta": null,
        "domainModel_beta": null,
        "example": "..."
    }

And this is the relevant bits of my config:

  plugins:

    mongodb:
      collectionDefaults:
        connectionString: services?.mongolab?[0]?.credentials?.uri || "mongodb://localhost/localdev"
      collections: [
        {
          collectionName: "Service" # note: we define a sub-collection named "services" that skips some services in production
          injectDocumentHelper: (doc) ->
            doc.set('title', doc.get('name'))
            doc.set('relativePath', doc.get('url'))
          meta: {
            layout: 'service-landing-page'
            stylesheet: 'service.css'
            scripts: ['js/vendor/bootstrap-scrollspy.js', 'js/vendor/jquery-scrollto.js', 'js/service-landing-page.js']
            additionalLayouts: 'embed'
          }
          sort:
            name: 1 # alphabetically, A's first
        }
        #, ...
      ]

This is the MongoDB plugin I'm using: https://github.com/nfriedly/docpad-plugin-mongodb

And, lastly, I'm on windows if that makes a difference. (Although I don't think it does - cloned this repo and ran the tests and they all passed.)

Any idea what's going on?

NPM version bump?

I just switched from my fork of this back to the NPM one, and I noticed that my documents were starting to get clobbered by their alternate layout (because the docs have a url in their metadata). When I dug in, I realized that while the fix was merged a while back but a new version hasn't yet been published to NPM.

Support splitting at the layout level

Would be great if we could have splitting happening at the layout level, in addition to just documents.

For instance we have the document src/documents/index.html that has:

---
layout: page
title: "Index"

---

Welcome

Then we have the layout src/layouts/page.html.eco that has:

---
layout: default

---

<article>
  <h1><%- @document.title %></h1>
  <div><%- @content %></div>
</article>

Then we have the layout src/layouts/default.html.eco that has:

<html>
<head>
  <title><%- @document.title %></article>
</head>
<body>
  <%- @content %>
</body>
</html>

Now say we want to split off at the page level, so we should be able to update src/layouts/page.html.eco with:

---
layout: default
additionalLayouts: ['data']

---

<article>
  <h1><%- @document.title %></h1>
  <div><%- @content %></div>
</article>

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.