Autoría | Ultima modificación | Ver Log |
---layout: docstitle: "Adding pages"date: 2020-03-02T10:13:29+01:00draft: falseweight: 2---## Adding or editing a page in the component libraryIn this step-by-step guide you will create a new page called Breadcrumb navigation and compile it from a markdown text file to a HTML page in the component library.To add a page to the component library on your local machine navigate open your editor or file manager and create a new markdown text file in folder /content/moodle/components/breadcrumbs.md```└── content└── moodle└── components└── breadcrumbs.md```Open the file in your favourite editor and start it with some metadata, we call this syntax [frontmatter](https://gohugo.io/content-management/front-matter/).```---layout: docstitle: "Breadcrumb navigation"date: 2020-03-02T10:13:29+01:00draft: false---```Make sure you add these characters `---` before and after your metadata. You can change the title and date to match your document.## Run the component library Grunt task.In your terminal run the command `npm install` and then `grunt componentlibrary` in your Moodle root folder. This will install all required resources and compile the componentlibrary pages. If you do not have npm installed on your system please visit [npmjs.com](https://www.npmjs.com/get-npm) to learn how to get a working setup.The output should be similar to this:```Running "componentlibrary:docsBuild" taskBuilding sites …| EN+------------------+-----+Pages | 113Paginator pages | 0Non-page files | 18Static files | 18Processed images | 0Aliases | 7Sitemaps | 1Cleaned | 0Total in 913 msRunning "componentlibrary:cssBuild" taskRendering Complete, saving .css file...Wrote CSS to /var/www/repositories/cl_master/moodle/admin/tool/componentlibrary/hugo/dist/css/docs.cssWrote Source Map to /var/www/repositories/cl_master/moodle/admin/tool/componentlibrary/hugo/dist/css/docs.css.mapRunning "componentlibrary:indexBuild" taskDone.```The grunt watch task will pick up changes in the componentlibrary Markdown files and Scss files. So run `grunt watch` if you want to edit the pages.