Giter Site home page Giter Site logo

docpad-plugin-link's Introduction

Link Plugin for DocPad

PayPayl donate button Flattr donate button

Summary

Take the document's id and generate the corresponding HTML link.

Purpose

Prevents the breaking of links when a document is moved to a different directory, or gets renamed. Also keeps links DRY, since the link title and text is pulled from the document's meta data.

Install

npm install --save docpad-plugin-link

Install for testing

git clone https://github.com/oleersoy/docpad-plugin-link.git
cd docpad-plugin-link
npm install
make compile

Test

make test

Configuration

Override the following defaults when necessary:

# ...
{
	templateData:
		site:
			url: 'http://localhost:9778/base'
}
# ...

Examples

Run the tests to see the below executed.

Document Location Document ID Document title Call Returned
root_document.md.eco 1 Root Meta Data Title for 1 @link(1) <%- @link(1)%>
root_document.md.eco 1 Root Meta Data Title for 1 @link(1, {title: "Custom Title 1"}) <%- @link(1, {title: "Custom Title 1"})%>
root_document.md.eco 1 Root Meta Data Title for 1 @link(1, {text: "Custom Text 1"}) <%- @link(1, {text: "Custom Text 1"})%>
root_document.md.eco 1 Root Meta Data Title for 1 @link(1, {title: "Custom Title 1", text: " Custom Text 1"}) <%- @link(1, {title: "Custom Title 1", text: "Custom Text 1"})%>
sub/sub_document.md.eco 2 Sub Meta Data Title for 2 @link(2) <%- @link(2)%>
sub/sub_document.md.eco 2 Sub Meta Data Title for 2 @link(2, {title: "Custom Title 2"}) <%- @link(2, {title: "Custom Title 2"})%>
sub/sub_document.md.eco 2 Sub Meta Data Title for 2 @link(2, {text: "Custom Text 2"}) <%- @link(2, {text: "Custom Text 2"})%>
sub/sub_document.md.eco 2 Sub Meta Data Title for 2 @link(2, {title: "Custom Title 2", text: " Custom Text 2"}) <%- @link(2, {title: "Custom Title 2", text: "Custom Text 2"})%>

License

See License.md
Copyright © 2013+ Ole Ersoy

docpad-plugin-link's People

Contributors

oleersoy avatar

Stargazers

 avatar

Watchers

 avatar

docpad-plugin-link's Issues

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.