Skip to content

Setting up README transclusion

Rand McKinney edited this page Nov 8, 2017 · 3 revisions

As explained in Including READMEs from other repositories, the doc site can "transclude" or reuse READMEs from other repos.

Here is a closed PR that was never landed that shows an example for LoopBack 4: https://github.com/strongloop/loopback.io/pull/499/files

To set this up for a new LoopBack release, do the following:

  • Add a new shell script, for example update-readmes-lb4.sh that lists all the READMEs to be used. It doesn't have to be a complete list: You can add more later.
    • Make sure to set the destination appropriately, e.g. for LB4 DEST="pages/en/lb4/readmes/$repo.md"
  • Update jenkinsfile to call the new script; specifically:
    • Add to the "download updates" stage:
      stage('download updates') {
          sh './update-readmes.sh'
          sh './update-community-readmes.sh'
          sh './update-readmes-lb4.sh'
        }
      
    • Add to the "commit updates" stage:
      sh 'git add pages/en/lb4/readmes'
      
  • Create a new folder to hold the READMEs, e.g. /pages/en/lb4/readmes
  • Create a page for each README. For example, suppose you want to use the README from loopback-next-example. The page itself may not have any content, but by using the "readme" layout, it grabs the content from the README file. Here's what the front-matter would look like:
    ---
    title: "LoopBack 4 microservice example"
    lang: en
    layout: readme
    source: loopback-next-example
    keywords: LoopBack4
    tags: example_app
    sidebar: lb4_sidebar
    permalink: /doc/en/lb4/LoopBack4-microservice-example.html
    summary: Microservice example for LoopBack 4  
    ---
    
  • Be sure to add the new pages (e.g. LoopBack4-microservice-example.html) to the sidebar navigation YAML file.