For example, the section h2 title "Know your privacy settings" would be converted to know-your-privacy-settings for the section id. Rule for creating section ids: use the h2 title of the section, converted to lowercase, spaces replaced with dashes, all non-alphanumeric characters removed.If your layout requires several sections for one table of contents entry, nest your sections inside a containing element which has the id attribute. When creating page sections that should be listed in the table of contents, add an id attribute to the section container that matches the subpageitems entry added to pages.json.skip_index: true is used for pages that shouldn't be indexed for search results.published: false will withhold this content from staging and production.For reference on how to create a page, review the sidebar-master-template.md file, which lists all available modules.For example, for /documentation/develop/best-practices-for-collecting-user-data-consents/, you would create a file called best-practices-for-collecting-user-data-consents.md and place it in documentation ▶︎ develop. Create a new page, nested inside a folder struture that matches the URL path.See below: Understanding the pages.json structure. Add a node with appropriate attributes, in the appropriate location, for the new page.Looks like this How to add a "sidebar" layout page You can reference images with the full path from the assets/ directory (e.g, /assets/img/image.png). In your page, link to images using this page structure:.└── README.md # This file Uploading media ├── yarn.lock # Package manager lock file ├── package.json # Node.js package manifest prettierignore # Files ignored by prettier eleventyignore # Files ignored by Eleventy ├── tests # Test files run by jest `yarn test`. │ ├── content # Content (Markdown and JS (generated)) │ ├── assets # Assets (CSS, JavaScript, fonts and images) ├── screenshots # Screenshots used in README.md │ └── templates.js # The liquidjs template instance │ ├── slugify.js # The central slug function │ ├── markdown.js # The markdown renderer instance and plugins ├── dist # Where production builds are built ├── build # Where eleventy builds the site to │ └── build-styles # The CSS build script │ ├── asset-pipeline # The asset build script If you do that, everything else is handled for you ✨ Development Guide: Content Updates Asset pathsįor the asset-pipeline script to do its thing, all you need to do is refer to all assets with a path beginning with /assets/. At that point, this will no longer be required. It's likely that some day, 11ty will have its own mechanism for wrangling assets. Whilst the asset-pipline script is custom, it leverages a lot of existing libs where possible, these include Terser, postHTML, postCSS, and various plugins. When something is updated and the script is re-run, the hash in the filename will change, so the new filename won't be cached and the browser will know to fetch it. To break the cache, the resource's URL needs to change. If the resource is in the browser's cache, the browser won't even make a request for it. The HTML is processed to update the references to the assets new hash-based filenames.Īll of this means that we can serve the site with far-future Expires headers.References to these file in CSS and JS are updated.Binary files are versioned with hashes in the file names.build directory and runs it through various optimizations.ĭuring these optimizations, the following takes place: Then a 3rd asset-pipeline process initiates and takes the the built content from. The Eleventy process and the JS and CSS builds happen in series. Production buildsīuilding for production is slightly different. For automatic reloading of the JS and CSS, each script uses a fetch to the public API to tell browserSync there is new code and it reloads it for you. In development Eleventy knows nothing about the CSS and JavaScript builds. When something changes the site is re-built. Once up and running both eleventy and the JS and CSS build scripts watch for changes. When you run yarn start the CSS and JS is built in parallel with the eleventy build. The site works in slightly different ways depending on whether you're running the site for local development or building the site for production. The site is built with Eleventy, a NodeJS-based static site generator. (You probably won't need to use this manually.) Starts eleventy and includes unpublished content.īuilds the site for production with unpublished content.Ĭlears the output directory. Content with published: false will not be available on staging or production. ℹ️ NOTE: Running locally will show unpublished content that uses the published: false convention in frontmatter.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |