diff options
177 files changed, 1602 insertions, 1535 deletions
diff --git a/docs/.github/SUPPORT.md b/docs/.github/SUPPORT.md index cc9de09ff..96a4400c3 100644 --- a/docs/.github/SUPPORT.md +++ b/docs/.github/SUPPORT.md @@ -1,3 +1,3 @@ -### Asking Support Questions +### Asking support questions We have an active [discussion forum](https://discourse.gohugo.io) where users and developers can ask questions. Please don't use the GitHub issue tracker to ask questions. diff --git a/docs/_vendor/github.com/gohugoio/gohugoioTheme/assets/images/sponsors/bep-consulting.svg b/docs/_vendor/github.com/gohugoio/gohugoioTheme/assets/images/sponsors/bep-consulting.svg index 5b1170f9b..598a1eb71 100644 --- a/docs/_vendor/github.com/gohugoio/gohugoioTheme/assets/images/sponsors/bep-consulting.svg +++ b/docs/_vendor/github.com/gohugoio/gohugoioTheme/assets/images/sponsors/bep-consulting.svg @@ -1,3 +1,4 @@ -<svg width="158" height="160" viewBox="0 0 158 160" fill="none" xmlns="http://www.w3.org/2000/svg"> -<path d="M4.32 103V27.64H17.664V54.616C18.752 54.04 20 53.56 21.408 53.176C22.816 52.728 24.192 52.376 25.536 52.12C26.88 51.864 28.192 51.672 29.472 51.544C30.816 51.352 32.032 51.256 33.12 51.256C35.872 51.256 38.24 51.704 40.224 52.6C42.272 53.432 43.904 54.584 45.12 56.056C46.336 57.464 47.296 59.32 48 61.624C48.704 63.928 49.152 66.328 49.344 68.824C49.6 71.32 49.728 74.296 49.728 77.752C49.728 86.008 48.448 92.376 45.888 96.856C43.328 101.336 39.072 103.576 33.12 103.576C30.368 103.576 27.584 103 24.768 101.848C21.952 100.696 19.616 99.352 17.76 97.816L15.36 103H4.32ZM17.76 88.984C21.024 91.032 24.992 92.056 29.664 92.056C31.136 92.056 32.352 91.64 33.312 90.808C34.272 89.912 35.008 88.376 35.52 86.2C36.032 83.96 36.288 80.984 36.288 77.272C36.288 73.048 36 69.784 35.424 67.48C34.912 65.176 34.208 63.672 33.312 62.968C32.416 62.2 31.2 61.816 29.664 61.816C27.296 61.816 25.152 61.976 23.232 62.296C21.312 62.552 19.488 63.032 17.76 63.736V88.984ZM56.8958 77.272C56.8958 72.856 57.1518 69.176 57.6638 66.232C58.2398 63.224 59.0398 60.76 60.0638 58.84C61.0878 56.856 62.5278 55.352 64.3838 54.328C66.2398 53.304 68.2878 52.6 70.5278 52.216C72.8318 51.832 75.7118 51.64 79.1678 51.64C81.4718 51.64 83.4238 51.704 85.0238 51.832C86.6238 51.896 88.2238 52.088 89.8238 52.408C91.4878 52.664 92.8318 53.08 93.8558 53.656C94.8798 54.168 95.8718 54.904 96.8318 55.864C97.7918 56.76 98.5278 57.88 99.0398 59.224C99.6158 60.504 100.032 62.072 100.288 63.928C100.608 65.72 100.768 67.8 100.768 70.168C100.768 74.648 99.5838 77.912 97.2158 79.96C94.8478 82.008 91.2958 83.032 86.5598 83.032H70.3358C70.3358 85.976 70.7518 88.184 71.5838 89.656C72.4798 91.064 73.5678 91.928 74.8478 92.248C76.1918 92.568 78.2718 92.728 81.0878 92.728C88.9598 92.728 95.1998 92.376 99.8078 91.672V100.792C95.0078 102.584 86.3038 103.48 73.6958 103.48C70.4318 103.48 67.7118 103 65.5358 102.04C63.4238 101.08 61.7278 99.512 60.4478 97.336C59.1678 95.16 58.2398 92.472 57.6638 89.272C57.1518 86.072 56.8958 82.072 56.8958 77.272ZM70.3358 73.336H83.1038C85.9198 73.336 87.3278 72.056 87.3278 69.496C87.3278 66.296 86.8798 64.248 85.9838 63.352C85.1518 62.392 83.1358 61.912 79.9358 61.912C77.8878 61.912 76.3518 62.008 75.3278 62.2C74.3678 62.328 73.4078 62.776 72.4478 63.544C71.5518 64.248 70.9438 65.368 70.6238 66.904C70.3678 68.44 70.2718 70.584 70.3358 73.336ZM108.101 128.92V52.024H119.141L121.445 57.112C123.301 55.64 125.637 54.328 128.453 53.176C131.333 52.024 134.149 51.448 136.901 51.448C139.397 51.448 141.573 51.864 143.429 52.696C145.349 53.528 146.917 54.68 148.133 56.152C149.413 57.624 150.469 59.448 151.301 61.624C152.133 63.8 152.709 66.168 153.029 68.728C153.349 71.288 153.509 74.136 153.509 77.272C153.509 79.896 153.413 82.264 153.221 84.376C153.093 86.488 152.805 88.6 152.357 90.712C151.909 92.76 151.269 94.552 150.437 96.088C149.669 97.624 148.677 99 147.461 100.216C146.309 101.368 144.837 102.264 143.045 102.904C141.253 103.48 139.205 103.768 136.901 103.768C134.597 103.768 132.005 103.48 129.125 102.904C126.245 102.264 123.685 101.464 121.445 100.504V128.92H108.101ZM121.445 91.288C124.773 92.568 128.773 93.208 133.445 93.208C134.981 93.208 136.197 92.856 137.093 92.152C137.989 91.384 138.693 89.848 139.205 87.544C139.781 85.24 140.069 82.008 140.069 77.848C140.069 72.344 139.525 68.504 138.437 66.328C137.349 64.088 135.685 62.968 133.445 62.968C128.709 62.968 124.709 63.992 121.445 66.04V91.288Z" fill="white"/> +<svg viewBox="0 0 255 180" fill="none" xmlns="http://www.w3.org/2000/svg"> +<rect fill="#AD1E1E"/> +<path d="M29.25 60.5C31.1167 60.0667 32.85 59.85 34.45 59.85C36.05 59.85 37.4 59.9 38.5 60V72.5C39.2 72 40.1333 71.5667 41.3 71.2C42.4667 70.8 43.5833 70.6 44.65 70.6C48.2833 70.6 50.8333 71.5333 52.3 73.4C53.7667 75.2667 54.5 78.45 54.5 82.95C54.5 85.45 54.15 87.6167 53.45 89.45C52.7833 91.25 51.8667 92.6333 50.7 93.6C48.5 95.4667 45.9 96.4 42.9 96.4C40.6333 96.4 38.4 95.8333 36.2 94.7C35.5667 95.5667 34.8333 96 34 96H31.5V66.05C30.3333 65.65 29.4167 65.0833 28.75 64.35L29.25 60.5ZM42.5 91.3C45.7 91.3 47.3 88.6167 47.3 83.25C47.3 80.4167 47.0167 78.5 46.45 77.5C45.9167 76.4667 44.9667 75.95 43.6 75.95C41.5333 75.95 39.8333 76.5 38.5 77.6V90.45C39.9333 91.0167 41.2667 91.3 42.5 91.3ZM69.1555 96.4C65.1555 96.4 62.1388 95.3333 60.1055 93.2C58.1055 91.0667 57.1055 87.9667 57.1055 83.9C57.1055 81.4333 57.4555 79.3167 58.1555 77.55C58.8555 75.75 59.8055 74.3667 61.0055 73.4C63.3388 71.5333 66.0555 70.6 69.1555 70.6C72.2555 70.6 74.6221 71.4 76.2555 73C77.9221 74.5667 78.7555 77.4 78.7555 81.5C78.7555 83.9 77.5721 85.1 75.2055 85.1H64.3555C64.4888 87.2 65.0221 88.6833 65.9555 89.55C66.9221 90.4167 68.4388 90.85 70.5055 90.85C71.6388 90.85 72.7221 90.7167 73.7555 90.45C74.7888 90.1833 75.5388 89.9167 76.0055 89.65L76.7055 89.25L78.2055 93.25C78.0055 93.4833 77.7055 93.7833 77.3055 94.15C76.9388 94.4833 75.9721 94.95 74.4055 95.55C72.8721 96.1167 71.1221 96.4 69.1555 96.4ZM72.3055 80.65C72.3721 80.1833 72.4055 79.6167 72.4055 78.95C72.4055 78.2833 72.1388 77.5833 71.6055 76.85C71.0721 76.0833 70.1388 75.7 68.8055 75.7C67.5055 75.7 66.5055 76.1 65.8055 76.9C65.1055 77.7 64.6388 79.05 64.4055 80.95L72.3055 80.65ZM81.2754 71C83.1087 70.6 84.7587 70.4 86.2254 70.4C87.6921 70.4 88.9087 70.4333 89.8754 70.5V72.95C92.1087 71.3833 94.4921 70.6 97.0254 70.6C100.359 70.6 102.775 71.55 104.275 73.45C105.775 75.35 106.525 78.5167 106.525 82.95C106.525 85.3167 106.175 87.4 105.475 89.2C104.775 91 103.825 92.4 102.625 93.4C100.325 95.4 97.5921 96.4 94.4254 96.4C93.0587 96.4 91.7587 96.2667 90.5254 96V100.3C92.4921 100.833 93.7587 101.45 94.3254 102.15L93.8254 106H81.2754L80.7754 102.15C81.2087 101.55 82.1254 100.983 83.5254 100.45V76.55C82.3587 76.15 81.4421 75.5833 80.7754 74.85L81.2754 71ZM93.9254 91.3C95.5921 91.3 96.9087 90.5667 97.8754 89.1C98.8421 87.6 99.3254 85.55 99.3254 82.95C99.3254 80.3167 99.0587 78.5167 98.5254 77.55C97.9921 76.5833 97.0254 76.1 95.6254 76.1C93.4921 76.1 91.7921 76.6 90.5254 77.6V90.9C91.5587 91.1667 92.6921 91.3 93.9254 91.3ZM110.689 96.24C109.361 96.24 108.697 95.64 108.697 94.44C108.697 93.224 109.361 92.616 110.689 92.616C112.033 92.616 112.705 93.224 112.705 94.44C112.705 95.64 112.033 96.24 110.689 96.24ZM119.838 86.256C118.366 86.256 117.63 87.52 117.63 90.048C117.63 91.328 117.83 92.224 118.23 92.736C118.646 93.232 119.238 93.48 120.006 93.48C121.222 93.48 122.294 93.368 123.222 93.144L123.942 94.992C123.43 95.328 122.742 95.616 121.878 95.856C121.014 96.08 120.174 96.192 119.358 96.192C115.902 96.192 114.174 94.192 114.174 90.192C114.174 87.856 114.774 86.176 115.974 85.152C117.046 84.256 118.35 83.808 119.886 83.808C121.422 83.808 122.702 84.096 123.726 84.672C123.742 84.832 123.75 84.984 123.75 85.128C123.75 86.04 123.542 86.904 123.126 87.72H121.014C120.79 87.32 120.654 86.84 120.606 86.28C120.414 86.264 120.158 86.256 119.838 86.256ZM130.453 96.192C128.565 96.192 127.165 95.688 126.253 94.68C125.341 93.672 124.885 92.152 124.885 90.12C124.885 88.072 125.389 86.512 126.397 85.44C127.421 84.352 128.885 83.808 130.789 83.808C132.693 83.808 134.101 84.288 135.013 85.248C135.941 86.208 136.405 87.712 136.405 89.76C136.405 91.792 135.885 93.376 134.845 94.512C133.821 95.632 132.357 96.192 130.453 96.192ZM128.341 89.904C128.341 92.464 129.109 93.744 130.645 93.744C131.429 93.744 132.005 93.456 132.373 92.88C132.757 92.288 132.949 91.328 132.949 90C132.949 87.504 132.165 86.256 130.597 86.256C129.829 86.256 129.261 86.536 128.893 87.096C128.525 87.64 128.341 88.576 128.341 89.904ZM137.876 84C138.756 83.808 139.548 83.712 140.252 83.712C140.956 83.712 141.54 83.728 142.004 83.76V84.96C142.404 84.624 142.932 84.352 143.588 84.144C144.26 83.92 144.9 83.808 145.508 83.808C147.076 83.808 148.172 84.176 148.796 84.912C149.436 85.648 149.756 86.92 149.756 88.728V93.336C150.38 93.576 150.82 93.848 151.076 94.152L150.836 96H145.316L145.076 94.152C145.3 93.848 145.74 93.576 146.396 93.336V88.584C146.396 87.72 146.252 87.144 145.964 86.856C145.692 86.552 145.196 86.4 144.476 86.4C143.756 86.4 143.036 86.656 142.316 87.168V93.336C142.94 93.576 143.38 93.848 143.636 94.152L143.396 96H137.876L137.636 94.152C137.86 93.848 138.3 93.576 138.956 93.336V86.664C138.396 86.472 137.956 86.2 137.636 85.848L137.876 84ZM156.709 85.968C155.653 85.968 155.125 86.28 155.125 86.904C155.125 87.496 155.677 87.936 156.781 88.224L158.677 88.728C160.629 89.24 161.605 90.368 161.605 92.112C161.605 93.312 161.181 94.296 160.333 95.064C159.501 95.816 158.165 96.192 156.325 96.192C154.501 96.192 153.077 95.936 152.053 95.424C152.037 95.248 152.029 95.072 152.029 94.896C152.029 94.016 152.205 93.224 152.557 92.52H154.549C154.757 92.904 154.893 93.304 154.957 93.72C155.277 93.816 155.733 93.864 156.325 93.864C157.733 93.864 158.437 93.464 158.437 92.664C158.437 92.408 158.341 92.2 158.149 92.04C157.957 91.864 157.581 91.696 157.021 91.536L155.125 90.984C154.149 90.712 153.389 90.312 152.845 89.784C152.301 89.24 152.029 88.448 152.029 87.408C152.029 86.352 152.453 85.488 153.301 84.816C154.149 84.144 155.357 83.808 156.925 83.808C158.509 83.808 159.845 84.04 160.933 84.504C160.949 84.664 160.957 84.824 160.957 84.984C160.957 85.816 160.781 86.584 160.429 87.288H158.461C158.253 86.92 158.117 86.536 158.053 86.136C157.605 86.024 157.157 85.968 156.709 85.968ZM171.593 94.992C170.489 95.792 169.185 96.192 167.681 96.192C166.193 96.192 165.153 95.88 164.561 95.256C163.969 94.632 163.673 93.616 163.673 92.208V86.664C163.113 86.472 162.673 86.2 162.353 85.848L162.593 84C163.489 83.792 164.321 83.688 165.089 83.688C165.857 83.688 166.505 83.712 167.033 83.76V91.416C167.033 92.28 167.161 92.856 167.417 93.144C167.689 93.416 168.217 93.552 169.001 93.552C169.785 93.552 170.513 93.296 171.185 92.784V86.664C170.625 86.472 170.185 86.2 169.865 85.848L170.105 84C171.001 83.792 171.833 83.688 172.601 83.688C173.369 83.688 174.017 83.712 174.545 83.76V93.12C175.105 93.232 175.545 93.368 175.865 93.528V95.424C174.905 95.936 173.697 96.192 172.241 96.192C171.841 95.904 171.625 95.504 171.593 94.992ZM176.799 78.96C177.695 78.752 178.527 78.648 179.295 78.648C180.063 78.648 180.711 78.672 181.239 78.72V93.336C181.863 93.576 182.303 93.848 182.559 94.152L182.319 96H176.799L176.559 94.152C176.783 93.848 177.223 93.576 177.879 93.336V81.624C177.319 81.432 176.879 81.16 176.559 80.808L176.799 78.96ZM187.918 80.976V84H191.35V86.016H187.918V92.088C187.918 92.6 187.99 92.976 188.134 93.216C188.278 93.44 188.622 93.552 189.166 93.552C189.71 93.552 190.294 93.432 190.918 93.192L191.638 95.064C190.406 95.688 189.142 96 187.846 96C186.566 96 185.694 95.728 185.23 95.184C184.782 94.624 184.558 93.816 184.558 92.76V86.016H183.478L183.214 84.552C183.47 84.248 183.998 83.944 184.798 83.64C184.99 82.328 185.446 81.44 186.166 80.976H187.918ZM192.767 84C193.663 83.792 194.495 83.688 195.263 83.688C196.031 83.688 196.679 83.712 197.207 83.76V93.336C197.831 93.576 198.271 93.848 198.527 94.152L198.287 96H192.767L192.527 94.152C192.751 93.848 193.191 93.576 193.847 93.336V86.664C193.287 86.472 192.847 86.2 192.527 85.848L192.767 84ZM195.479 82.344C194.151 82.344 193.487 81.744 193.487 80.544C193.487 79.328 194.151 78.72 195.479 78.72C196.823 78.72 197.495 79.328 197.495 80.544C197.495 81.744 196.823 82.344 195.479 82.344ZM199.727 84C200.607 83.808 201.399 83.712 202.103 83.712C202.807 83.712 203.391 83.728 203.855 83.76V84.96C204.255 84.624 204.783 84.352 205.439 84.144C206.111 83.92 206.751 83.808 207.359 83.808C208.927 83.808 210.023 84.176 210.647 84.912C211.287 85.648 211.607 86.92 211.607 88.728V93.336C212.231 93.576 212.671 93.848 212.927 94.152L212.687 96H207.167L206.927 94.152C207.151 93.848 207.591 93.576 208.247 93.336V88.584C208.247 87.72 208.103 87.144 207.815 86.856C207.543 86.552 207.047 86.4 206.327 86.4C205.607 86.4 204.887 86.656 204.167 87.168V93.336C204.791 93.576 205.231 93.848 205.487 94.152L205.247 96H199.727L199.487 94.152C199.711 93.848 200.151 93.576 200.807 93.336V86.664C200.247 86.472 199.807 86.2 199.487 85.848L199.727 84ZM219.281 98.544C220.705 98.544 221.417 97.688 221.417 95.976V94.92C220.633 95.4 219.649 95.64 218.465 95.64C216.961 95.64 215.801 95.2 214.985 94.32C214.185 93.44 213.785 91.976 213.785 89.928C213.785 85.848 215.657 83.808 219.401 83.808C220.361 83.808 221.257 84.016 222.089 84.432C222.249 84.144 222.489 84 222.809 84H224.777V95.808C224.777 97.568 224.337 98.872 223.457 99.72C222.593 100.568 221.249 100.992 219.425 100.992C218.465 100.992 217.473 100.88 216.449 100.656C215.425 100.432 214.649 100.152 214.121 99.816C214.105 99.672 214.097 99.528 214.097 99.384C214.097 98.504 214.305 97.656 214.721 96.84H216.833C217.009 97.176 217.137 97.624 217.217 98.184C217.825 98.424 218.513 98.544 219.281 98.544ZM217.097 89.784C217.097 90.984 217.257 91.824 217.577 92.304C217.913 92.784 218.473 93.024 219.257 93.024C220.057 93.024 220.777 92.8 221.417 92.352V86.664C220.777 86.392 220.081 86.256 219.329 86.256C217.841 86.256 217.097 87.432 217.097 89.784Z" fill="white"/> </svg> diff --git a/docs/_vendor/github.com/gohugoio/gohugoioTheme/assets/images/sponsors/cloudcannon-blue.svg b/docs/_vendor/github.com/gohugoio/gohugoioTheme/assets/images/sponsors/cloudcannon-blue.svg new file mode 100644 index 000000000..79b13f431 --- /dev/null +++ b/docs/_vendor/github.com/gohugoio/gohugoioTheme/assets/images/sponsors/cloudcannon-blue.svg @@ -0,0 +1,6 @@ +<svg viewBox="0 0 363 80" fill="none" xmlns="http://www.w3.org/2000/svg"> +<path fill-rule="evenodd" clip-rule="evenodd" d="M29.0705 42.8838C29.425 43.0864 29.8049 43.289 30.1847 43.4663C33.0209 44.783 34.3376 45.644 34.3376 47.4672C34.3376 49.4171 32.7423 51.0124 30.7925 51.0124C29.2731 51.0124 28.007 50.0502 27.5005 48.7081C25.6519 50.5819 23.1197 51.7468 20.2835 51.7468C14.6872 51.7468 10.1544 47.214 10.1544 41.6177C10.1544 41.0859 10.2304 40.5541 10.3064 40.0224C5.1152 38.503 1.1142 34.1728 0.202582 28.7537C0.0759682 27.9687 0 27.1837 0 26.3734C0 25.5631 0.0759682 24.7781 0.202582 23.9931C1.13952 18.5993 5.1152 14.2438 10.3064 12.7244C10.3032 12.7022 10.3 12.6801 10.2968 12.658C10.2242 12.1503 10.1544 11.6629 10.1544 11.1291C10.1544 5.53277 14.6872 1 20.2835 1C23.0943 1 25.6519 2.16485 27.5005 4.03873C28.007 2.69662 29.2731 1.73436 30.7925 1.73436C32.7423 1.73436 34.3376 3.32969 34.3376 5.27954C34.3376 7.25472 33.0209 8.11569 30.1847 9.43248C29.9037 9.5636 29.6366 9.70858 29.3628 9.85717C29.2665 9.90945 29.1694 9.96218 29.0705 10.0149H29.0704C28.8426 10.1415 28.6147 10.2681 28.4121 10.3947C28.2349 10.496 28.0829 10.5973 27.931 10.6986C27.8803 10.7239 27.836 10.7556 27.7917 10.7872C27.7474 10.8189 27.7031 10.8505 27.6524 10.8759C26.7915 11.433 26.0065 12.0914 25.2468 12.7751C25.2215 12.7877 25.2025 12.8067 25.1835 12.8257C25.1645 12.8447 25.1455 12.8637 25.1202 12.8764C24.8163 13.1802 24.5124 13.4841 24.2339 13.788C24.1959 13.826 24.1579 13.8703 24.1199 13.9146C24.0819 13.9589 24.0439 14.0032 24.006 14.0412C23.8864 14.1907 23.7629 14.3363 23.6401 14.481C23.4508 14.704 23.2633 14.9251 23.0943 15.1554C20.7393 18.2954 19.2959 22.2205 19.2959 26.4494C19.2959 30.6783 20.714 34.6033 23.0943 37.7433C23.3729 38.1231 23.6768 38.503 24.006 38.8575C24.0439 38.8955 24.0819 38.9398 24.1199 38.9841C24.1579 39.0284 24.1959 39.0728 24.2339 39.1107C24.4424 39.3572 24.6652 39.5753 24.8915 39.7969C24.9674 39.8712 25.0438 39.946 25.1202 40.0224C25.1455 40.035 25.1645 40.054 25.1835 40.073C25.2025 40.092 25.2215 40.111 25.2468 40.1236C26.0065 40.8074 26.7915 41.4658 27.6524 42.0229C27.7031 42.0482 27.7474 42.0798 27.7917 42.1115C27.836 42.1431 27.8803 42.1748 27.931 42.2001C28.007 42.2508 28.0893 42.3014 28.1716 42.3521C28.2539 42.4027 28.3362 42.4533 28.4121 42.504C28.5261 42.5673 28.6337 42.6306 28.7414 42.6939C28.849 42.7572 28.9566 42.8205 29.0705 42.8838ZM64.2693 12.826C69.4604 14.3453 73.4614 18.6755 74.3731 24.0946C74.4997 24.8543 74.5756 25.6646 74.5756 26.6269C74.5756 27.4372 74.4997 28.2222 74.3731 29.0072C73.4361 34.4009 69.4604 38.7565 64.2693 40.2758L64.2788 40.3423C64.3515 40.85 64.4212 41.3373 64.4212 41.8712C64.4212 47.4675 59.8884 52.0003 54.2921 52.0003C51.4813 52.0003 48.9237 50.8354 47.0751 48.9615C46.5687 50.3036 45.3025 51.2659 43.7832 51.2659C41.8333 51.2659 40.238 49.6706 40.238 47.7207C40.238 45.7455 41.5548 44.8846 44.3909 43.5678C44.6719 43.4367 44.939 43.2917 45.2128 43.1431C45.3091 43.0908 45.4063 43.0381 45.5051 42.9854C45.733 42.8587 45.9609 42.7321 46.1635 42.6055C46.3407 42.5042 46.4926 42.403 46.6445 42.3017L46.6446 42.3016C46.6953 42.2763 46.7396 42.2447 46.7839 42.213C46.8282 42.1814 46.8725 42.1497 46.9232 42.1244C47.7842 41.5673 48.5692 40.9089 49.3289 40.2252C49.3542 40.2125 49.3732 40.1935 49.3922 40.1745C49.4112 40.1555 49.4301 40.1365 49.4555 40.1239C49.7593 39.82 50.0632 39.5161 50.3418 39.2123C50.3797 39.1743 50.4177 39.13 50.4557 39.0856C50.4937 39.0413 50.5317 38.997 50.5697 38.959C50.6893 38.8096 50.8128 38.664 50.9356 38.5193C51.1248 38.2962 51.3124 38.0752 51.4813 37.8448C53.8363 34.7048 55.2797 30.7798 55.2797 26.5509C55.2797 22.322 53.8616 18.397 51.4813 15.257C51.2027 14.8771 50.8989 14.4973 50.5697 14.1428C50.5317 14.1048 50.4937 14.0605 50.4557 14.0161C50.4177 13.9718 50.3797 13.9275 50.3418 13.8895C50.0632 13.5603 49.7593 13.2565 49.4555 12.9779C49.4301 12.9652 49.4112 12.9463 49.3922 12.9273C49.3732 12.9083 49.3542 12.8893 49.3289 12.8766C48.5692 12.1929 47.7842 11.5598 46.9232 10.9774C46.8726 10.9521 46.8282 10.9204 46.7839 10.8888C46.7396 10.8571 46.6953 10.8255 46.6446 10.8001C46.5687 10.7495 46.4864 10.6988 46.4041 10.6482C46.3218 10.5976 46.2395 10.5469 46.1635 10.4963C46.0496 10.433 45.9419 10.3697 45.8343 10.3064C45.7267 10.243 45.6191 10.1797 45.5051 10.1164C45.1506 9.91385 44.7708 9.71127 44.3909 9.53401C41.5801 8.19191 40.238 7.33093 40.238 5.38108C40.238 3.43123 41.8333 1.8359 43.7832 1.8359C45.3025 1.8359 46.5687 2.79816 47.0751 4.14027C48.9237 2.26638 51.456 1.10154 54.2921 1.10154C59.8884 1.10154 64.4212 5.63431 64.4212 11.2306C64.4212 11.7624 64.3452 12.2942 64.2693 12.826Z" fill="#034AD8"/> +<path d="M48.3405 26.475C48.3405 20.3723 43.4025 15.4343 37.2998 15.4343C31.197 15.4343 26.259 20.3723 26.259 26.475C26.259 32.5778 31.197 37.5158 37.2998 37.5158C43.4025 37.5158 48.3405 32.5778 48.3405 26.475Z" fill="#034AD8"/> +<path fill-rule="evenodd" clip-rule="evenodd" d="M119.934 36.2635V0.832581H113.425V36.2635H119.934ZM98.4922 36.9973C101.494 36.9973 103.973 36.198 105.931 34.5994C107.888 33.0007 109.161 31.0922 109.748 28.8736L104.022 26.9651C103.696 28.0743 103.076 29.0286 102.162 29.8279C101.249 30.6272 100.026 31.0269 98.4922 31.0269C96.763 31.0269 95.303 30.4152 94.1122 29.1917C92.9214 27.9683 92.326 26.3126 92.326 24.2246C92.326 22.1366 92.9133 20.489 94.0878 19.2819C95.2623 18.0747 96.7141 17.4712 98.4432 17.4712C101.216 17.4712 102.994 18.8251 103.777 21.533L109.601 19.5755C109.046 17.3243 107.79 15.4076 105.833 13.8253C103.875 12.243 101.363 11.4518 98.2964 11.4518C94.7729 11.4518 91.8122 12.6589 89.4142 15.0732C87.0163 17.4875 85.8173 20.5379 85.8173 24.2246C85.8173 27.8786 87.0326 30.9209 89.4631 33.3514C91.8937 35.782 94.9034 36.9973 98.4922 36.9973ZM145.097 33.3759C142.699 35.7902 139.689 36.9973 136.068 36.9973C132.446 36.9973 129.437 35.7902 127.039 33.3759C124.641 30.9617 123.442 27.9112 123.442 24.2246C123.442 20.5379 124.633 17.4875 127.014 15.0732C129.429 12.6589 132.446 11.4518 136.068 11.4518C139.689 11.4518 142.699 12.6589 145.097 15.0732C147.495 17.4875 148.694 20.5379 148.694 24.2246C148.694 27.9112 147.495 30.9617 145.097 33.3759ZM136.069 31.0758C134.373 31.0758 132.921 30.4722 131.714 29.2651C130.539 28.058 129.952 26.3778 129.952 24.2245C129.952 22.0713 130.547 20.3911 131.738 19.1839C132.929 17.9768 134.373 17.3732 136.069 17.3732C137.766 17.3732 139.209 17.9768 140.4 19.1839C141.591 20.3911 142.186 22.0713 142.186 24.2245C142.186 26.3778 141.591 28.058 140.4 29.2651C139.209 30.4722 137.766 31.0758 136.069 31.0758ZM164.901 36.0919C163.677 36.6302 162.381 36.8994 161.01 36.8994C158.172 36.8994 155.937 35.9941 154.306 34.1834C152.675 32.3727 151.859 30.1134 151.859 27.4055V12.1859H158.368V26.0842C158.368 27.5197 158.743 28.686 159.493 29.5832C160.244 30.4804 161.337 30.929 162.772 30.929C164.175 30.929 165.284 30.4967 166.1 29.6321C166.915 28.7676 167.323 27.6175 167.323 26.182V12.1859H173.832V31.9078C173.832 33.4411 173.914 34.893 174.077 36.2632H167.862C167.731 35.6107 167.666 34.7461 167.666 33.6695C167.046 34.7461 166.124 35.5536 164.901 36.0919ZM189.5 36.8507C191.066 36.8507 192.444 36.5408 193.635 35.9209C194.826 35.301 195.698 34.4854 196.253 33.474C196.253 34.518 196.335 35.4479 196.498 36.2635H202.713C202.582 34.9585 202.517 33.5067 202.517 31.908V0.832581H196.106V14.5841C195.03 12.5939 192.762 11.5989 189.304 11.5989C185.943 11.5989 183.178 12.806 181.009 15.2203C178.839 17.6345 177.755 20.6197 177.755 24.1759C177.755 27.8299 178.856 30.8559 181.058 33.2538C183.26 35.6518 186.074 36.8507 189.5 36.8507ZM185.977 29.1919C187.086 30.4154 188.522 31.0271 190.283 31.0271C192.013 31.0271 193.432 30.4072 194.541 29.1674C195.65 27.9277 196.205 26.2475 196.205 24.1269C196.205 22.0388 195.65 20.3994 194.541 19.2086C193.432 18.0178 192.013 17.4224 190.283 17.4224C188.554 17.4224 187.127 18.026 186.001 19.2331C184.876 20.4402 184.313 22.0878 184.313 24.1758C184.313 26.2964 184.868 27.9685 185.977 29.1919ZM218.798 36.9973C221.8 36.9973 224.279 36.198 226.237 34.5994C228.194 33.0007 229.466 31.0922 230.054 28.8736L224.328 26.9651C224.002 28.0743 223.382 29.0286 222.468 29.8279C221.555 30.6272 220.331 31.0269 218.798 31.0269C217.069 31.0269 215.609 30.4152 214.418 29.1917C213.227 27.9683 212.632 26.3126 212.632 24.2246C212.632 22.1366 213.219 20.489 214.394 19.2819C215.568 18.0747 217.02 17.4712 218.749 17.4712C221.522 17.4712 223.3 18.8251 224.083 21.533L229.907 19.5755C229.352 17.3243 228.096 15.4076 226.139 13.8253C224.181 12.243 221.669 11.4518 218.602 11.4518C215.079 11.4518 212.118 12.6589 209.72 15.0732C207.322 17.4875 206.123 20.5379 206.123 24.2246C206.123 27.8786 207.338 30.9209 209.769 33.3514C212.2 35.782 215.209 36.9973 218.798 36.9973ZM248.562 33.3759C247.028 35.7575 244.663 36.9483 241.466 36.9483C238.986 36.9483 236.988 36.2306 235.471 34.7951C233.954 33.3595 233.195 31.663 233.195 29.7055C233.195 27.6501 233.864 26.0026 235.202 24.7628C236.539 23.5231 238.268 22.7401 240.389 22.4138L246.311 21.5329C247.518 21.3698 248.121 20.7989 248.121 19.8201C248.121 18.9066 247.77 18.1562 247.069 17.569C246.368 16.9817 245.364 16.6881 244.059 16.6881C242.689 16.6881 241.604 17.0633 240.805 17.8137C240.006 18.564 239.557 19.4939 239.459 20.6031L233.685 19.3797C233.913 17.2917 234.941 15.4483 236.768 13.8497C238.595 12.2511 241.009 11.4518 244.01 11.4518C247.599 11.4518 250.242 12.3082 251.938 14.021C253.635 15.7338 254.483 17.9279 254.483 20.6031V32.446C254.483 33.8815 254.581 35.1539 254.777 36.2632H248.806C248.643 35.5454 248.562 34.583 248.562 33.3759ZM242.836 32.1037C241.857 32.1037 241.09 31.8346 240.536 31.2963C239.981 30.7579 239.704 30.0973 239.704 29.3143C239.704 27.5851 240.699 26.5738 242.689 26.2801L248.121 25.4482V26.5248C248.121 28.515 247.624 29.9423 246.629 30.8069C245.633 31.6714 244.369 32.1037 242.836 32.1037ZM265.918 22.4142V36.2636H259.41V12.1863H265.723V15.1715C266.408 13.9969 267.386 13.0998 268.659 12.4799C269.931 11.86 271.269 11.5501 272.672 11.5501C275.51 11.5501 277.672 12.4391 279.156 14.2172C280.64 15.9952 281.383 18.2872 281.383 21.0929V36.2636H274.874V22.2185C274.874 20.783 274.507 19.6248 273.773 18.7439C273.039 17.863 271.921 17.4226 270.421 17.4226C269.05 17.4226 267.957 17.8957 267.142 18.8418C266.326 19.7879 265.918 20.9787 265.918 22.4142ZM292.866 36.2636V22.4142C292.866 20.9787 293.274 19.7879 294.09 18.8418C294.905 17.8957 295.998 17.4226 297.368 17.4226C298.869 17.4226 299.987 17.863 300.721 18.7439C301.455 19.6248 301.822 20.783 301.822 22.2185V36.2636H308.33V21.0929C308.33 18.2872 307.588 15.9952 306.104 14.2172C304.619 12.4391 302.458 11.5501 299.619 11.5501C298.217 11.5501 296.879 11.86 295.607 12.4799C294.334 13.0998 293.355 13.9969 292.67 15.1715V12.1863H286.357V36.2636H292.866ZM333.149 33.3759C330.751 35.7901 327.742 36.9972 324.12 36.9972C320.499 36.9972 317.489 35.7901 315.091 33.3759C312.693 30.9616 311.494 27.9111 311.494 24.2245C311.494 20.5379 312.685 17.4874 315.067 15.0731C317.481 12.6589 320.499 11.4518 324.12 11.4518C327.742 11.4518 330.751 12.6589 333.149 15.0731C335.547 17.4874 336.746 20.5379 336.746 24.2245C336.746 27.9111 335.547 30.9616 333.149 33.3759ZM324.121 31.0757C322.425 31.0757 320.973 30.4722 319.766 29.265C318.591 28.0579 318.004 26.3777 318.004 24.2245C318.004 22.0712 318.6 20.391 319.79 19.1839C320.981 17.9767 322.425 17.3732 324.121 17.3732C325.818 17.3732 327.262 17.9767 328.452 19.1839C329.643 20.391 330.239 22.0712 330.239 24.2245C330.239 26.3777 329.643 28.0579 328.452 29.265C327.262 30.4722 325.818 31.0757 324.121 31.0757ZM346.762 22.4142V36.2636H340.254V12.1863H346.567V15.1715C347.252 13.9969 348.23 13.0998 349.503 12.4799C350.775 11.86 352.113 11.5501 353.516 11.5501C356.354 11.5501 358.515 12.4391 360 14.2172C361.484 15.9952 362.227 18.2872 362.227 21.0929V36.2636H355.718V22.2185C355.718 20.783 355.351 19.6248 354.617 18.7439C353.883 17.863 352.765 17.4226 351.265 17.4226C349.894 17.4226 348.801 17.8957 347.986 18.8418C347.17 19.7879 346.762 20.9787 346.762 22.4142Z" fill="#034AD8"/> +<path d="M313.211 64.2638C318.224 64.2638 320.862 60.5706 320.862 60.5706L319.015 58.724C319.015 58.724 317.037 61.6258 313.211 61.6258C309.386 61.6258 306.353 58.5921 306.353 54.767C306.353 50.9419 309.386 47.9082 313.211 47.9082C317.037 47.9082 318.883 50.6781 318.883 50.6781L320.73 48.8315C320.73 48.8315 318.224 45.2702 313.211 45.2702C307.672 45.2702 303.451 49.491 303.451 54.767C303.451 60.043 307.672 64.2638 313.211 64.2638ZM324.294 64H327.196V50.4143L333.923 58.9878L340.65 50.4143V64H343.552V45.534H340.914L333.923 54.5032L326.932 45.534H324.294V64ZM353.568 64.2638C357.657 64.2638 360.163 61.7577 360.163 58.8559C360.163 51.9971 350.402 54.5032 350.402 50.4143C350.402 49.0953 351.589 47.9082 353.832 47.9082C356.338 47.9082 357.657 49.6229 357.657 49.6229L359.635 47.6444C359.635 47.6444 357.657 45.2702 353.832 45.2702C349.875 45.2702 347.5 47.6444 347.5 50.4143C347.5 57.2731 357.261 54.767 357.261 58.8559C357.261 60.3068 355.942 61.6258 353.568 61.6258C350.402 61.6258 348.951 59.5154 348.951 59.5154L346.973 61.4939C346.973 61.4939 349.083 64.2638 353.568 64.2638Z" fill="#034AD8"/> +</svg> diff --git a/docs/_vendor/github.com/gohugoio/gohugoioTheme/assets/images/sponsors/cloudcannon-white.svg b/docs/_vendor/github.com/gohugoio/gohugoioTheme/assets/images/sponsors/cloudcannon-white.svg new file mode 100644 index 000000000..83e319a6d --- /dev/null +++ b/docs/_vendor/github.com/gohugoio/gohugoioTheme/assets/images/sponsors/cloudcannon-white.svg @@ -0,0 +1,6 @@ +<svg viewBox="0 0 363 80" fill="none" xmlns="http://www.w3.org/2000/svg"> +<path fill-rule="evenodd" clip-rule="evenodd" d="M29.0705 42.8838C29.425 43.0864 29.8049 43.289 30.1847 43.4663C33.0209 44.783 34.3376 45.644 34.3376 47.4672C34.3376 49.4171 32.7423 51.0124 30.7925 51.0124C29.2731 51.0124 28.007 50.0502 27.5005 48.7081C25.6519 50.5819 23.1197 51.7468 20.2835 51.7468C14.6872 51.7468 10.1544 47.214 10.1544 41.6177C10.1544 41.0859 10.2304 40.5541 10.3064 40.0224C5.1152 38.503 1.1142 34.1728 0.202582 28.7537C0.0759682 27.9687 0 27.1837 0 26.3734C0 25.5631 0.0759682 24.7781 0.202582 23.9931C1.13952 18.5993 5.1152 14.2438 10.3064 12.7244C10.3032 12.7022 10.3 12.6801 10.2968 12.658C10.2242 12.1503 10.1544 11.6629 10.1544 11.1291C10.1544 5.53277 14.6872 1 20.2835 1C23.0943 1 25.6519 2.16485 27.5005 4.03873C28.007 2.69662 29.2731 1.73436 30.7925 1.73436C32.7423 1.73436 34.3376 3.32969 34.3376 5.27954C34.3376 7.25472 33.0209 8.11569 30.1847 9.43248C29.9037 9.5636 29.6366 9.70858 29.3628 9.85717C29.2665 9.90945 29.1694 9.96218 29.0705 10.0149H29.0704C28.8426 10.1415 28.6147 10.2681 28.4121 10.3947C28.2349 10.496 28.0829 10.5973 27.931 10.6986C27.8803 10.7239 27.836 10.7556 27.7917 10.7872C27.7474 10.8189 27.7031 10.8505 27.6524 10.8759C26.7915 11.433 26.0065 12.0914 25.2468 12.7751C25.2215 12.7877 25.2025 12.8067 25.1835 12.8257C25.1645 12.8447 25.1455 12.8637 25.1202 12.8764C24.8163 13.1802 24.5124 13.4841 24.2339 13.788C24.1959 13.826 24.1579 13.8703 24.1199 13.9146C24.0819 13.9589 24.0439 14.0032 24.006 14.0412C23.8864 14.1907 23.7629 14.3363 23.6401 14.481C23.4508 14.704 23.2633 14.9251 23.0943 15.1554C20.7393 18.2954 19.2959 22.2205 19.2959 26.4494C19.2959 30.6783 20.714 34.6033 23.0943 37.7433C23.3729 38.1231 23.6768 38.503 24.006 38.8575C24.0439 38.8955 24.0819 38.9398 24.1199 38.9841C24.1579 39.0284 24.1959 39.0728 24.2339 39.1107C24.4424 39.3572 24.6652 39.5753 24.8915 39.7969C24.9674 39.8712 25.0438 39.946 25.1202 40.0224C25.1455 40.035 25.1645 40.054 25.1835 40.073C25.2025 40.092 25.2215 40.111 25.2468 40.1236C26.0065 40.8074 26.7915 41.4658 27.6524 42.0229C27.7031 42.0482 27.7474 42.0798 27.7917 42.1115C27.836 42.1431 27.8803 42.1748 27.931 42.2001C28.007 42.2508 28.0893 42.3014 28.1716 42.3521C28.2539 42.4027 28.3362 42.4533 28.4121 42.504C28.5261 42.5673 28.6337 42.6306 28.7414 42.6939C28.849 42.7572 28.9566 42.8205 29.0705 42.8838ZM64.2693 12.826C69.4604 14.3453 73.4614 18.6755 74.3731 24.0946C74.4997 24.8543 74.5756 25.6646 74.5756 26.6269C74.5756 27.4372 74.4997 28.2222 74.3731 29.0072C73.4361 34.4009 69.4604 38.7565 64.2693 40.2758L64.2788 40.3423C64.3515 40.85 64.4212 41.3373 64.4212 41.8712C64.4212 47.4675 59.8884 52.0003 54.2921 52.0003C51.4813 52.0003 48.9237 50.8354 47.0751 48.9615C46.5687 50.3036 45.3025 51.2659 43.7832 51.2659C41.8333 51.2659 40.238 49.6706 40.238 47.7207C40.238 45.7455 41.5548 44.8846 44.3909 43.5678C44.6719 43.4367 44.939 43.2917 45.2128 43.1431C45.3091 43.0908 45.4063 43.0381 45.5051 42.9854C45.733 42.8587 45.9609 42.7321 46.1635 42.6055C46.3407 42.5042 46.4926 42.403 46.6445 42.3017L46.6446 42.3016C46.6953 42.2763 46.7396 42.2447 46.7839 42.213C46.8282 42.1814 46.8725 42.1497 46.9232 42.1244C47.7842 41.5673 48.5692 40.9089 49.3289 40.2252C49.3542 40.2125 49.3732 40.1935 49.3922 40.1745C49.4112 40.1555 49.4301 40.1365 49.4555 40.1239C49.7593 39.82 50.0632 39.5161 50.3418 39.2123C50.3797 39.1743 50.4177 39.13 50.4557 39.0856C50.4937 39.0413 50.5317 38.997 50.5697 38.959C50.6893 38.8096 50.8128 38.664 50.9356 38.5193C51.1248 38.2962 51.3124 38.0752 51.4813 37.8448C53.8363 34.7048 55.2797 30.7798 55.2797 26.5509C55.2797 22.322 53.8616 18.397 51.4813 15.257C51.2027 14.8771 50.8989 14.4973 50.5697 14.1428C50.5317 14.1048 50.4937 14.0605 50.4557 14.0161C50.4177 13.9718 50.3797 13.9275 50.3418 13.8895C50.0632 13.5603 49.7593 13.2565 49.4555 12.9779C49.4301 12.9652 49.4112 12.9463 49.3922 12.9273C49.3732 12.9083 49.3542 12.8893 49.3289 12.8766C48.5692 12.1929 47.7842 11.5598 46.9232 10.9774C46.8726 10.9521 46.8282 10.9204 46.7839 10.8888C46.7396 10.8571 46.6953 10.8255 46.6446 10.8001C46.5687 10.7495 46.4864 10.6988 46.4041 10.6482C46.3218 10.5976 46.2395 10.5469 46.1635 10.4963C46.0496 10.433 45.9419 10.3697 45.8343 10.3064C45.7267 10.243 45.6191 10.1797 45.5051 10.1164C45.1506 9.91385 44.7708 9.71127 44.3909 9.53401C41.5801 8.19191 40.238 7.33093 40.238 5.38108C40.238 3.43123 41.8333 1.8359 43.7832 1.8359C45.3025 1.8359 46.5687 2.79816 47.0751 4.14027C48.9237 2.26638 51.456 1.10154 54.2921 1.10154C59.8884 1.10154 64.4212 5.63431 64.4212 11.2306C64.4212 11.7624 64.3452 12.2942 64.2693 12.826Z" fill="white"/> +<path d="M48.3405 26.475C48.3405 20.3723 43.4025 15.4343 37.2998 15.4343C31.197 15.4343 26.259 20.3723 26.259 26.475C26.259 32.5778 31.197 37.5158 37.2998 37.5158C43.4025 37.5158 48.3405 32.5778 48.3405 26.475Z" fill="white"/> +<path fill-rule="evenodd" clip-rule="evenodd" d="M119.934 36.2635V0.832581H113.425V36.2635H119.934ZM98.4922 36.9973C101.494 36.9973 103.973 36.198 105.931 34.5994C107.888 33.0007 109.161 31.0922 109.748 28.8736L104.022 26.9651C103.696 28.0743 103.076 29.0286 102.162 29.8279C101.249 30.6272 100.026 31.0269 98.4922 31.0269C96.763 31.0269 95.303 30.4152 94.1122 29.1917C92.9214 27.9683 92.326 26.3126 92.326 24.2246C92.326 22.1366 92.9133 20.489 94.0878 19.2819C95.2623 18.0747 96.7141 17.4712 98.4432 17.4712C101.216 17.4712 102.994 18.8251 103.777 21.533L109.601 19.5755C109.046 17.3243 107.79 15.4076 105.833 13.8253C103.875 12.243 101.363 11.4518 98.2964 11.4518C94.7729 11.4518 91.8122 12.6589 89.4142 15.0732C87.0163 17.4875 85.8173 20.5379 85.8173 24.2246C85.8173 27.8786 87.0326 30.9209 89.4631 33.3514C91.8937 35.782 94.9034 36.9973 98.4922 36.9973ZM145.097 33.3759C142.699 35.7902 139.689 36.9973 136.068 36.9973C132.446 36.9973 129.437 35.7902 127.039 33.3759C124.641 30.9617 123.442 27.9112 123.442 24.2246C123.442 20.5379 124.633 17.4875 127.014 15.0732C129.429 12.6589 132.446 11.4518 136.068 11.4518C139.689 11.4518 142.699 12.6589 145.097 15.0732C147.495 17.4875 148.694 20.5379 148.694 24.2246C148.694 27.9112 147.495 30.9617 145.097 33.3759ZM136.069 31.0758C134.373 31.0758 132.921 30.4722 131.714 29.2651C130.539 28.058 129.952 26.3778 129.952 24.2245C129.952 22.0713 130.547 20.3911 131.738 19.1839C132.929 17.9768 134.373 17.3732 136.069 17.3732C137.766 17.3732 139.209 17.9768 140.4 19.1839C141.591 20.3911 142.186 22.0713 142.186 24.2245C142.186 26.3778 141.591 28.058 140.4 29.2651C139.209 30.4722 137.766 31.0758 136.069 31.0758ZM164.901 36.0919C163.677 36.6302 162.381 36.8994 161.01 36.8994C158.172 36.8994 155.937 35.9941 154.306 34.1834C152.675 32.3727 151.859 30.1134 151.859 27.4055V12.1859H158.368V26.0842C158.368 27.5197 158.743 28.686 159.493 29.5832C160.244 30.4804 161.337 30.929 162.772 30.929C164.175 30.929 165.284 30.4967 166.1 29.6321C166.915 28.7676 167.323 27.6175 167.323 26.182V12.1859H173.832V31.9078C173.832 33.4411 173.914 34.893 174.077 36.2632H167.862C167.731 35.6107 167.666 34.7461 167.666 33.6695C167.046 34.7461 166.124 35.5536 164.901 36.0919ZM189.5 36.8507C191.066 36.8507 192.444 36.5408 193.635 35.9209C194.826 35.301 195.698 34.4854 196.253 33.474C196.253 34.518 196.335 35.4479 196.498 36.2635H202.713C202.582 34.9585 202.517 33.5067 202.517 31.908V0.832581H196.106V14.5841C195.03 12.5939 192.762 11.5989 189.304 11.5989C185.943 11.5989 183.178 12.806 181.009 15.2203C178.839 17.6345 177.755 20.6197 177.755 24.1759C177.755 27.8299 178.856 30.8559 181.058 33.2538C183.26 35.6518 186.074 36.8507 189.5 36.8507ZM185.977 29.1919C187.086 30.4154 188.522 31.0271 190.283 31.0271C192.013 31.0271 193.432 30.4072 194.541 29.1674C195.65 27.9277 196.205 26.2475 196.205 24.1269C196.205 22.0388 195.65 20.3994 194.541 19.2086C193.432 18.0178 192.013 17.4224 190.283 17.4224C188.554 17.4224 187.127 18.026 186.001 19.2331C184.876 20.4402 184.313 22.0878 184.313 24.1758C184.313 26.2964 184.868 27.9685 185.977 29.1919ZM218.798 36.9973C221.8 36.9973 224.279 36.198 226.237 34.5994C228.194 33.0007 229.466 31.0922 230.054 28.8736L224.328 26.9651C224.002 28.0743 223.382 29.0286 222.468 29.8279C221.555 30.6272 220.331 31.0269 218.798 31.0269C217.069 31.0269 215.609 30.4152 214.418 29.1917C213.227 27.9683 212.632 26.3126 212.632 24.2246C212.632 22.1366 213.219 20.489 214.394 19.2819C215.568 18.0747 217.02 17.4712 218.749 17.4712C221.522 17.4712 223.3 18.8251 224.083 21.533L229.907 19.5755C229.352 17.3243 228.096 15.4076 226.139 13.8253C224.181 12.243 221.669 11.4518 218.602 11.4518C215.079 11.4518 212.118 12.6589 209.72 15.0732C207.322 17.4875 206.123 20.5379 206.123 24.2246C206.123 27.8786 207.338 30.9209 209.769 33.3514C212.2 35.782 215.209 36.9973 218.798 36.9973ZM248.562 33.3759C247.028 35.7575 244.663 36.9483 241.466 36.9483C238.986 36.9483 236.988 36.2306 235.471 34.7951C233.954 33.3595 233.195 31.663 233.195 29.7055C233.195 27.6501 233.864 26.0026 235.202 24.7628C236.539 23.5231 238.268 22.7401 240.389 22.4138L246.311 21.5329C247.518 21.3698 248.121 20.7989 248.121 19.8201C248.121 18.9066 247.77 18.1562 247.069 17.569C246.368 16.9817 245.364 16.6881 244.059 16.6881C242.689 16.6881 241.604 17.0633 240.805 17.8137C240.006 18.564 239.557 19.4939 239.459 20.6031L233.685 19.3797C233.913 17.2917 234.941 15.4483 236.768 13.8497C238.595 12.2511 241.009 11.4518 244.01 11.4518C247.599 11.4518 250.242 12.3082 251.938 14.021C253.635 15.7338 254.483 17.9279 254.483 20.6031V32.446C254.483 33.8815 254.581 35.1539 254.777 36.2632H248.806C248.643 35.5454 248.562 34.583 248.562 33.3759ZM242.836 32.1037C241.857 32.1037 241.09 31.8346 240.536 31.2963C239.981 30.7579 239.704 30.0973 239.704 29.3143C239.704 27.5851 240.699 26.5738 242.689 26.2801L248.121 25.4482V26.5248C248.121 28.515 247.624 29.9423 246.629 30.8069C245.633 31.6714 244.369 32.1037 242.836 32.1037ZM265.918 22.4142V36.2636H259.41V12.1863H265.723V15.1715C266.408 13.9969 267.386 13.0998 268.659 12.4799C269.931 11.86 271.269 11.5501 272.672 11.5501C275.51 11.5501 277.672 12.4391 279.156 14.2172C280.64 15.9952 281.383 18.2872 281.383 21.0929V36.2636H274.874V22.2185C274.874 20.783 274.507 19.6248 273.773 18.7439C273.039 17.863 271.921 17.4226 270.421 17.4226C269.05 17.4226 267.957 17.8957 267.142 18.8418C266.326 19.7879 265.918 20.9787 265.918 22.4142ZM292.866 36.2636V22.4142C292.866 20.9787 293.274 19.7879 294.09 18.8418C294.905 17.8957 295.998 17.4226 297.368 17.4226C298.869 17.4226 299.987 17.863 300.721 18.7439C301.455 19.6248 301.822 20.783 301.822 22.2185V36.2636H308.33V21.0929C308.33 18.2872 307.588 15.9952 306.104 14.2172C304.619 12.4391 302.458 11.5501 299.619 11.5501C298.217 11.5501 296.879 11.86 295.607 12.4799C294.334 13.0998 293.355 13.9969 292.67 15.1715V12.1863H286.357V36.2636H292.866ZM333.149 33.3759C330.751 35.7901 327.742 36.9972 324.12 36.9972C320.499 36.9972 317.489 35.7901 315.091 33.3759C312.693 30.9616 311.494 27.9111 311.494 24.2245C311.494 20.5379 312.685 17.4874 315.067 15.0731C317.481 12.6589 320.499 11.4518 324.12 11.4518C327.742 11.4518 330.751 12.6589 333.149 15.0731C335.547 17.4874 336.746 20.5379 336.746 24.2245C336.746 27.9111 335.547 30.9616 333.149 33.3759ZM324.121 31.0757C322.425 31.0757 320.973 30.4722 319.766 29.265C318.591 28.0579 318.004 26.3777 318.004 24.2245C318.004 22.0712 318.6 20.391 319.79 19.1839C320.981 17.9767 322.425 17.3732 324.121 17.3732C325.818 17.3732 327.262 17.9767 328.452 19.1839C329.643 20.391 330.239 22.0712 330.239 24.2245C330.239 26.3777 329.643 28.0579 328.452 29.265C327.262 30.4722 325.818 31.0757 324.121 31.0757ZM346.762 22.4142V36.2636H340.254V12.1863H346.567V15.1715C347.252 13.9969 348.23 13.0998 349.503 12.4799C350.775 11.86 352.113 11.5501 353.516 11.5501C356.354 11.5501 358.515 12.4391 360 14.2172C361.484 15.9952 362.227 18.2872 362.227 21.0929V36.2636H355.718V22.2185C355.718 20.783 355.351 19.6248 354.617 18.7439C353.883 17.863 352.765 17.4226 351.265 17.4226C349.894 17.4226 348.801 17.8957 347.986 18.8418C347.17 19.7879 346.762 20.9787 346.762 22.4142Z" fill="white"/> +<path d="M313.211 64.2638C318.224 64.2638 320.862 60.5706 320.862 60.5706L319.015 58.724C319.015 58.724 317.037 61.6258 313.211 61.6258C309.386 61.6258 306.353 58.5921 306.353 54.767C306.353 50.9419 309.386 47.9082 313.211 47.9082C317.037 47.9082 318.883 50.6781 318.883 50.6781L320.73 48.8315C320.73 48.8315 318.224 45.2702 313.211 45.2702C307.672 45.2702 303.451 49.491 303.451 54.767C303.451 60.043 307.672 64.2638 313.211 64.2638ZM324.294 64H327.196V50.4143L333.923 58.9878L340.65 50.4143V64H343.552V45.534H340.914L333.923 54.5032L326.932 45.534H324.294V64ZM353.568 64.2638C357.657 64.2638 360.163 61.7577 360.163 58.8559C360.163 51.9971 350.402 54.5032 350.402 50.4143C350.402 49.0953 351.589 47.9082 353.832 47.9082C356.338 47.9082 357.657 49.6229 357.657 49.6229L359.635 47.6444C359.635 47.6444 357.657 45.2702 353.832 45.2702C349.875 45.2702 347.5 47.6444 347.5 50.4143C347.5 57.2731 357.261 54.767 357.261 58.8559C357.261 60.3068 355.942 61.6258 353.568 61.6258C350.402 61.6258 348.951 59.5154 348.951 59.5154L346.973 61.4939C346.973 61.4939 349.083 64.2638 353.568 64.2638Z" fill="#FDFDFD"/> +</svg> diff --git a/docs/_vendor/github.com/gohugoio/gohugoioTheme/data/sponsors.toml b/docs/_vendor/github.com/gohugoio/gohugoioTheme/data/sponsors.toml index 71167bfd4..c8986a8c6 100644 --- a/docs/_vendor/github.com/gohugoio/gohugoioTheme/data/sponsors.toml +++ b/docs/_vendor/github.com/gohugoio/gohugoioTheme/data/sponsors.toml @@ -3,19 +3,20 @@ link = "https://www.linode.com/" logo = "images/sponsors/linode-logo.svg" utm_campaign = "hugosponsor" + bgcolor = "#ffffff" [[banners]] - name = "Your Company?" - link = "https://bep.is/en/hugo-sponsor-2023-01/" - logo = "/images/sponsors/your-company.svg" - utm_campaign = "hugosponsor" - show_on_hover = true - bgcolor = "#004887" + name = "CloudCannon" + link = "https://cloudcannon.com/hugo-cms/" + logo = "/images/sponsors/cloudcannon-white.svg" + utm_campaign = "HugoSponsorship" + utm_source = "sponsor" + utm_content = "gohugo" + bgcolor = "#034AD8" [[banners]] name = "Your Company?" link = "https://bep.is/en/hugo-sponsor-2023-01/" - logo = "/images/sponsors/your-company.svg" utm_campaign = "hugosponsor" show_on_hover = true - bgcolor = "#004887" + bgcolor = "#4e4f4f" diff --git a/docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/home-page-sections/sponsors.html b/docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/home-page-sections/sponsors.html index 32bc44f6a..6838ce36a 100644 --- a/docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/home-page-sections/sponsors.html +++ b/docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/home-page-sections/sponsors.html @@ -23,7 +23,7 @@ class="{{ $classes_box }} o-100" style="background-color: {{ .bgcolor }};"> {{ $query_params := .query_params | default "" }} - {{ $url := printf "%s?%s%s" .link $query_params (querify "utm_source" $utmSource "utm_medium" "banner" "utm_campaign" (.utm_campaign | default "hugosponsor")) | safeURL }} + {{ $url := printf "%s?%s%s" .link $query_params (querify "utm_source" (.utm_source | default $utmSource ) "utm_medium" "banner" "utm_campaign" (.utm_campaign | default "hugosponsor") "utm_content" (.utm_content | default "gohugoio")) | safeURL }} {{ $logo := resources.Get .logo }} {{ if hugo.IsProduction }} {{ $gtagID := printf "Sponsor %s %s" .name $gtag | title }} @@ -34,7 +34,7 @@ show-on-hover {{ end }}" style=""> - {{ $logo.Content | safeHTML }} + {{ with $logo }}{{ .Content | safeHTML }}{{ end }} </a> {{ else }} <a @@ -42,7 +42,7 @@ class="w-100 grow pa3{{ if .show_on_hover }} show-on-hover {{ end }}"> - {{ $logo.Content | safeHTML }} + {{ with $logo }}{{ .Content | safeHTML }}{{ end }} </a> {{ end }} </div> diff --git a/docs/_vendor/modules.txt b/docs/_vendor/modules.txt index 1c7cac307..18258d30d 100644 --- a/docs/_vendor/modules.txt +++ b/docs/_vendor/modules.txt @@ -1 +1 @@ -# github.com/gohugoio/gohugoioTheme v0.0.0-20230527124826-78bc315d7b8a +# github.com/gohugoio/gohugoioTheme v0.0.0-20230630055807-9874cd863bc5 diff --git a/docs/config/_default/menus/menus.en.toml b/docs/config/_default/menus/menus.en.toml index 7a956a47f..327a5777b 100644 --- a/docs/config/_default/menus/menus.en.toml +++ b/docs/config/_default/menus/menus.en.toml @@ -11,7 +11,7 @@ url = "/installation/" [[docs]] - name = "Getting Started" + name = "Getting started" weight = 30 identifier = "getting-started" url = "/getting-started/" @@ -26,7 +26,7 @@ # Core menus [[docs]] - name = "Content Management" + name = "Content management" weight = 50 identifier = "content-management" post = "expanded" @@ -53,7 +53,7 @@ [[docs]] name = "Hugo Pipes" weight = 90 - identifier = "pipes" + identifier = "hugo-pipes" url = "/hugo-pipes/" [[docs]] @@ -72,13 +72,13 @@ url = "/troubleshooting/" [[docs]] - name = "Tools" + name = "Developer tools" weight = 120 - identifier = "tools" + identifier = "developer-tools" url = "/tools/" [[docs]] - name = "Hosting & Deployment" + name = "Hosting and deployment" weight = 130 identifier = "hosting-and-deployment" url = "/hosting-and-deployment/" diff --git a/docs/content/en/_index.md b/docs/content/en/_index.md index b4e602438..69d40ebcf 100644 --- a/docs/content/en/_index.md +++ b/docs/content/en/_index.md @@ -1,5 +1,5 @@ --- -title: "The world’s fastest framework for building websites" +title: The world’s fastest framework for building websites date: 2017-03-02T12:00:00-05:00 features: - heading: Blistering Speed diff --git a/docs/content/en/about/_index.md b/docs/content/en/about/_index.md index 91260a4a6..3a8319029 100644 --- a/docs/content/en/about/_index.md +++ b/docs/content/en/about/_index.md @@ -1,14 +1,15 @@ --- title: About Hugo -linktitle: Overview +linkTitle: Overview description: Hugo's features, roadmap, license, and motivation. categories: [] keywords: [] menu: docs: + identifier: about-hugo-overview parent: about - weight: 1 -weight: 1 + weight: 10 +weight: 10 aliases: [/about-hugo/,/docs/] --- diff --git a/docs/content/en/about/benefits.md b/docs/content/en/about/benefits.md index 91c243413..f1fc0cfb6 100644 --- a/docs/content/en/about/benefits.md +++ b/docs/content/en/about/benefits.md @@ -1,13 +1,13 @@ --- -title: The Benefits of Static Site Generators -linktitle: The Benefits of Static +title: Benefits of static site generators +linkTitle: Static site generators description: Improved performance, security and ease of use are just a few of the reasons static site generators are so appealing. keywords: [ssg,static,performance,security] menu: docs: parent: about - weight: 30 -weight: 30 + weight: 40 +weight: 40 --- The purpose of website generators is to render content into HTML files. Most are "dynamic site generators." That means the HTTP server---i.e., the program that sends files to the browser to be viewed---runs the generator to create a new HTML file every time an end user requests a page. @@ -18,7 +18,7 @@ Hugo takes caching a step further and all HTML files are rendered on your comput This has many benefits. The most noticeable is performance. HTTP servers are *very* good at sending files---so good, in fact, that you can effectively serve the same number of pages with a fraction of the memory and CPU needed for a dynamic site. -## More on Static Site Generators +## More on static site generators * ["An Introduction to Static Site Generators", David Walsh] * ["Hugo vs. WordPress page load speed comparison: Hugo leaves WordPress in its dust", GettingThingsTech][hugovwordpress] diff --git a/docs/content/en/about/features.md b/docs/content/en/about/features.md index 6fac68cdd..dcb85e8b5 100644 --- a/docs/content/en/about/features.md +++ b/docs/content/en/about/features.md @@ -1,11 +1,11 @@ --- -title: Hugo Features +title: Hugo features description: Hugo boasts blistering speed, robust content management, and a powerful templating language making it a great fit for all kinds of static websites. menu: docs: parent: about - weight: 20 -weight: 20 + weight: 30 +weight: 30 toc: true --- @@ -40,7 +40,7 @@ toc: true * ["Minutes to Read"][pagevars] functionality * ["WordCount"][pagevars] functionality -## Additional Features +## Additional features * Integrated [Disqus] comment support * Integrated [Google Analytics] support diff --git a/docs/content/en/about/hugo-and-gdpr.md b/docs/content/en/about/hugo-and-gdpr.md index b028c4543..d82368afc 100644 --- a/docs/content/en/about/hugo-and-gdpr.md +++ b/docs/content/en/about/hugo-and-gdpr.md @@ -1,14 +1,14 @@ --- -title: Hugo and the General Data Protection Regulation (GDPR) -linktitle: Hugo and GDPR +title: Hugo and the General Data Protection Regulation +linkTitle: Hugo and the GDPR description: About how to configure your Hugo site to meet the new regulations. layout: single keywords: ["GDPR", "Privacy", "Data Protection"] menu: docs: parent: about - weight: 5 -weight: 5 + weight: 60 +weight: 60 aliases: [/privacy/,/gdpr/] toc: true --- @@ -17,7 +17,7 @@ toc: true **Hugo is a static site generator. By using Hugo you are already standing on very solid ground. Static HTML files on disk are much easier to reason about compared to server and database driven web sites.** - But even static websites can integrate with external services, so from version `0.41`, Hugo provides a **Privacy Config** that covers the relevant built-in templates. + But even static websites can integrate with external services, so from version `0.41`, Hugo provides a **privacy configuration** that covers the relevant built-in templates. Note that: @@ -25,9 +25,9 @@ toc: true * These settings work with the [internal templates](/templates/internal/). Some theme may contain custom templates for embedding services like Google Analytics. In that case these options have no effect. * We will continue this work and improve this further in future Hugo versions. -## All Privacy Settings +## All privacy settings -Below are all privacy settings and their default value. These settings need to be put in your site config (e.g. `hugo.toml`). +Below are all privacy settings and their default value. These settings need to be put in your site configuration (e.g. `hugo.toml`). {{< code-toggle file="hugo" >}} [privacy] @@ -54,11 +54,11 @@ disable = false privacyEnhanced = false {{< /code-toggle >}} -## Disable All Services +## Disable all services -An example Privacy Config that disables all the relevant services in Hugo. With this configuration, the other settings will not matter. +An example privacy configuration that disables all the relevant services in Hugo. With this configuration, the other settings will not matter. - {{< code-toggle file="hugo" >}} +{{< code-toggle file="hugo" >}} [privacy] [privacy.disqus] disable = true @@ -74,7 +74,7 @@ disable = true disable = true {{< /code-toggle >}} -## The Privacy Settings Explained +## The privacy settings explained ### GoogleAnalytics diff --git a/docs/content/en/about/license.md b/docs/content/en/about/license.md index 267ec95a0..dc560b33f 100644 --- a/docs/content/en/about/license.md +++ b/docs/content/en/about/license.md @@ -1,14 +1,13 @@ --- -title: Apache License -linktitle: License +title: License description: Hugo v0.15 and later are released under the Apache 2.0 license. categories: ["about hugo"] keywords: ["License","apache"] menu: docs: parent: about - weight: 60 -weight: 60 + weight: 70 +weight: 70 aliases: [/meta/license] toc: true --- diff --git a/docs/content/en/about/security-model/index.md b/docs/content/en/about/security-model/index.md index a909a4236..3b93167ab 100644 --- a/docs/content/en/about/security-model/index.md +++ b/docs/content/en/about/security-model/index.md @@ -1,18 +1,18 @@ --- -title: Hugo's Security Model +title: Hugo's security model description: A summary of Hugo's security model. layout: single keywords: ["Security", "Privacy"] menu: docs: parent: about - weight: 4 -weight: 5 + weight: 50 +weight: 50 aliases: [/security/] toc: true --- -## Runtime Security +## Runtime security Hugo produces static output, so once built, the runtime is the browser (assuming the output is HTML) and any server (API) that you integrate with. @@ -25,7 +25,7 @@ But when developing and building your site, the runtime is the `hugo` executable * User-defined components have read-only access to the filesystem. * We shell out to some external binaries to support [Asciidoctor](/content-management/formats/#list-of-content-formats) and similar, but those binaries and their flags are predefined and disabled by default (see [Security Policy](#security-policy)). General functions to run arbitrary external OS commands have been [discussed](https://github.com/gohugoio/hugo/issues/796), but not implemented because of security concerns. -## Security Policy +## Security policy Hugo has a built-in security policy that restricts access to [os/exec](https://pkg.go.dev/os/exec), remote communication and similar. @@ -33,19 +33,19 @@ The default configuration is listed below. Any build using features not in the a {{< code-toggle config="security" />}} -Note that these and other config settings in Hugo can be overridden by the OS environment. If you want to block all remote HTTP fetching of data: +Note that these and other configuration settings in Hugo can be overridden by the OS environment. If you want to block all remote HTTP fetching of data: ```txt HUGO_SECURITY_HTTP_URLS=none hugo ``` -## Dependency Security +## Dependency security Hugo is built as a static binary using [Go Modules](https://github.com/golang/go/wiki/Modules) to manage its dependencies. Go Modules have several safeguards, one of them being the `go.sum` file. This is a database of the expected cryptographic checksums of all of your dependencies, including transitive dependencies. [Hugo Modules](/hugo-modules/) is a feature built on top of the functionality of Go Modules. Like Go Modules, a Hugo project using Hugo Modules will have a `go.sum` file. We recommend that you commit this file to your version control system. The Hugo build will fail if there is a checksum mismatch, which would be an indication of [dependency tampering](https://julienrenaux.fr/2019/12/20/github-actions-security-risk/). -## Web Application Security +## Web application security These are the security threats as defined by [OWASP](https://en.wikipedia.org/wiki/OWASP). diff --git a/docs/content/en/about/what-is-hugo.md b/docs/content/en/about/what-is-hugo.md index 3097de50e..9e28346dd 100644 --- a/docs/content/en/about/what-is-hugo.md +++ b/docs/content/en/about/what-is-hugo.md @@ -5,8 +5,8 @@ layout: single menu: docs: parent: about - weight: 10 -weight: 10 + weight: 20 +weight: 20 aliases: [/overview/introduction/,/about/why-i-built-hugo/] toc: true --- @@ -17,15 +17,15 @@ Websites built with Hugo are extremely fast and secure. Hugo sites can be hosted We think of Hugo as the ideal website creation tool with nearly instant build times, able to rebuild whenever a change is made. -## How Fast is Hugo? +## How fast is Hugo? {{< youtube "CdiDYZ51a2o" >}} -## What Does Hugo Do? +## What does Hugo do? In technical terms, Hugo takes a source directory of files and templates and uses these as input to create a complete website. -## Who Should Use Hugo? +## Who should use Hugo? Hugo is for people that prefer writing in a text editor over a browser. diff --git a/docs/content/en/commands/hugo_completion_bash.md b/docs/content/en/commands/hugo_completion_bash.md index 875ecfc19..231804d09 100644 --- a/docs/content/en/commands/hugo_completion_bash.md +++ b/docs/content/en/commands/hugo_completion_bash.md @@ -62,4 +62,3 @@ hugo completion bash ### SEE ALSO * [hugo completion](/commands/hugo_completion/) - Generate the autocompletion script for the specified shell - diff --git a/docs/content/en/commands/hugo_convert.md b/docs/content/en/commands/hugo_convert.md index a4d0e501b..07f7f9c13 100644 --- a/docs/content/en/commands/hugo_convert.md +++ b/docs/content/en/commands/hugo_convert.md @@ -13,10 +13,6 @@ Convert your content (e.g. front matter) to different formats. See convert's subcommands toJSON, toTOML and toYAML for more information. -``` -hugo convert [command] [flags] -``` - ### Options ``` diff --git a/docs/content/en/commands/hugo_gen.md b/docs/content/en/commands/hugo_gen.md index 620d60676..5c8bd6f2c 100644 --- a/docs/content/en/commands/hugo_gen.md +++ b/docs/content/en/commands/hugo_gen.md @@ -7,10 +7,6 @@ url: /commands/hugo_gen/ A collection of several useful generators. -``` -hugo gen [command] [flags] -``` - ### Options ``` diff --git a/docs/content/en/commands/hugo_import.md b/docs/content/en/commands/hugo_import.md index 570353d34..a6bd40f34 100644 --- a/docs/content/en/commands/hugo_import.md +++ b/docs/content/en/commands/hugo_import.md @@ -13,10 +13,6 @@ Import your site from other web site generators like Jekyll. Import requires a subcommand, e.g. `hugo import jekyll jekyll_root_path target_path`. -``` -hugo import [command] [flags] -``` - ### Options ``` diff --git a/docs/content/en/commands/hugo_list.md b/docs/content/en/commands/hugo_list.md index 7cd2b288d..294a8eaa4 100644 --- a/docs/content/en/commands/hugo_list.md +++ b/docs/content/en/commands/hugo_list.md @@ -13,10 +13,6 @@ Listing out various types of content. List requires a subcommand, e.g. hugo list drafts -``` -hugo list [command] [flags] -``` - ### Options ``` diff --git a/docs/content/en/commands/hugo_new.md b/docs/content/en/commands/hugo_new.md index 267f6a426..ef0ff4cd4 100644 --- a/docs/content/en/commands/hugo_new.md +++ b/docs/content/en/commands/hugo_new.md @@ -18,10 +18,6 @@ If archetypes are provided in your theme or site, they will be used. Ensure you run this within the root directory of your site. -``` -hugo new [command] [flags] -``` - ### Options ``` @@ -50,5 +46,5 @@ hugo new [command] [flags] * [hugo](/commands/hugo/) - hugo builds your site * [hugo new content](/commands/hugo_new_content/) - Create new content for your site * [hugo new site](/commands/hugo_new_site/) - Create a new site (skeleton) -* [hugo new theme](/commands/hugo_new_theme/) - Create a new site (skeleton) +* [hugo new theme](/commands/hugo_new_theme/) - Create a new theme (skeleton) diff --git a/docs/content/en/commands/hugo_new_content.md b/docs/content/en/commands/hugo_new_content.md index 0aa897c64..c7f87631c 100644 --- a/docs/content/en/commands/hugo_new_content.md +++ b/docs/content/en/commands/hugo_new_content.md @@ -10,13 +10,13 @@ Create new content for your site ### Synopsis Create a new content file and automatically set the date and title. - It will guess which kind of file to create based on the path provided. - - You can also specify the kind with `-k KIND`. - - If archetypes are provided in your theme or site, they will be used. - - Ensure you run this within the root directory of your site. +It will guess which kind of file to create based on the path provided. + +You can also specify the kind with `-k KIND`. + +If archetypes are provided in your theme or site, they will be used. + +Ensure you run this within the root directory of your site. ``` hugo new content [path] [flags] diff --git a/docs/content/en/commands/hugo_new_site.md b/docs/content/en/commands/hugo_new_site.md index fb465dc7d..f8a939df5 100644 --- a/docs/content/en/commands/hugo_new_site.md +++ b/docs/content/en/commands/hugo_new_site.md @@ -20,8 +20,9 @@ hugo new site [path] [flags] ### Options ``` - -f, --force init inside non-empty directory - -h, --help help for site + -f, --force init inside non-empty directory + --format string preferred file format (toml, yaml or json) (default "toml") + -h, --help help for site ``` ### Options inherited from parent commands diff --git a/docs/content/en/commands/hugo_new_theme.md b/docs/content/en/commands/hugo_new_theme.md index 027f636f2..301c79e0c 100644 --- a/docs/content/en/commands/hugo_new_theme.md +++ b/docs/content/en/commands/hugo_new_theme.md @@ -5,16 +5,17 @@ url: /commands/hugo_new_theme/ --- ## hugo new theme -Create a new site (skeleton) +Create a new theme (skeleton) ### Synopsis -Create a new site in the provided directory. -The new site will have the correct structure, but no content or theme yet. -Use `hugo new [contentPath]` to create new content. +Create a new theme (skeleton) called [name] in ./themes. +New theme is a skeleton. Please add content to the touched files. Add your +name to the copyright line in the license and adjust the theme.toml file +according to your needs. ``` -hugo new theme [path] [flags] +hugo new theme [name] [flags] ``` ### Options diff --git a/docs/content/en/content-management/_index.md b/docs/content/en/content-management/_index.md index e87749d3a..35f85a641 100644 --- a/docs/content/en/content-management/_index.md +++ b/docs/content/en/content-management/_index.md @@ -1,9 +1,10 @@ --- -title: Content Management -linkTitle: Content Management Overview +title: Content management +linkTitle: Overview description: Hugo makes managing large static sites easy with support for archetypes, content types, menus, cross references, summaries, and more. menu: docs: + identifier: content-management-overview parent: content-management weight: 10 keywords: [source, organization] diff --git a/docs/content/en/content-management/archetypes.md b/docs/content/en/content-management/archetypes.md index f2bc6a441..d8c864536 100644 --- a/docs/content/en/content-management/archetypes.md +++ b/docs/content/en/content-management/archetypes.md @@ -13,7 +13,7 @@ weight: 140 aliases: [/content/archetypes/] --- -## What are Archetypes? +## What are archetypes? **Archetypes** are content template files in the [archetypes directory] of your project that contain preconfigured [front matter] and possibly also a content disposition for your website's [content types]. These will be used when you run `hugo new`. @@ -33,7 +33,7 @@ The above will create a new content file in `content/posts/my-first-post.md` usi The last two list items are only applicable if you use a theme and it uses the `my-theme` theme name as an example. -## Create a New Archetype Template +## Create a new archetype template A fictional example for the section `newsletter` and the archetype file `archetypes/newsletter.md`. Create a new file in `archetypes/newsletter.md` and open it in a text editor. @@ -46,7 +46,7 @@ draft: true **Insert Lead paragraph here.** -## New Cool Posts +## New cool posts {{ range first 10 ( where .Site.RegularPages "Type" "cool" ) }} * {{ .Title }} diff --git a/docs/content/en/content-management/build-options.md b/docs/content/en/content-management/build-options.md index 4798f9b2b..378a31144 100644 --- a/docs/content/en/content-management/build-options.md +++ b/docs/content/en/content-management/build-options.md @@ -1,9 +1,8 @@ --- -title: Build Options -linkTitle: Build Options +title: Build options description: Build options help define how Hugo must treat a given page when building the site. keywords: [build,content,front matter, page resources] -categories: [content management] +categories: [fundamentals,content management] menu: docs: parent: content-management @@ -13,7 +12,7 @@ weight: 70 aliases: [/content/build-options/] --- -They are stored in a reserved Front Matter object named `_build` with the following defaults: +They are stored in a reserved front matter object named `_build` with the following defaults: {{< code-toggle >}} _build: @@ -26,38 +25,30 @@ _build: If `always`, the page will be treated as a published page, holding its dedicated output files (`index.html`, etc...) and permalink. -We extended this property from a boolean to an enum in Hugo 0.76.0. Valid values are: - -never -: The page will not be included in any page collection. - -always (default) -: The page will be rendered to disk and get a `RelPermalink` etc. +Valid values are: -link -: The page will be not be rendered to disk, but will get a `RelPermalink`. + - `never` + : The page will not be included in any page collection. + - `always (default)` + : The page will be rendered to disk and get a `RelPermalink` etc. + - `link` + : The page will be not be rendered to disk, but will get a `RelPermalink`. #### list -Note that we extended this property from a boolean to an enum in Hugo 0.68.0. - Valid values are: - -never -: The page will not be included in any page collection. - -always (default) -: The page will be included in all page collections, e.g. `site.RegularPages`, `$page.Pages`. - -local -: The page will be included in any _local_ page collection, e.g. `$page.RegularPages`, `$page.Pages`. One use case for this would be to create fully navigable, but headless content sections. - -If true, the page will be treated as part of the project's collections and, when appropriate, returned by Hugo's listing methods (`.Pages`, `.RegularPages` etc...). + + - `never` + : The page will not be included in any page collection. + - `always (default)` + : The page will be included in all page collections, e.g. `site.RegularPages`, `.Pages`. + - `local` + : The page will be included in any _local_ page collection, e.g. `.RegularPages`, `.Pages`. One use case for this would be to create fully navigable, but headless content sections. #### publishResources -If set to true the [Bundle's Resources](/content-management/page-bundles) will be published. -Setting this to false will still publish Resources on demand (when a resource's `.Permalink` or `.RelPermalink` is invoked from the templates) but will skip the others. +If set to `true` (default) the [Bundle's Resources](/content-management/page-bundles) will be published. +Setting this to `false` will still publish Resources on demand (when a resource's `.Permalink` or `.RelPermalink` is invoked from the templates) but will skip the others. {{% note %}} Any page, regardless of their build options, will always be available using the [`.GetPage`](/functions/getpage) methods. @@ -67,7 +58,7 @@ Any page, regardless of their build options, will always be available using the #### Not publishing a page -Project needs a "Who We Are" content file for Front Matter and body to be used by the homepage but nowhere else. +Project needs a "Who We Are" content file for front matter and body to be used by the homepage but nowhere else. {{< code-toggle file="content/who-we-are.md" fm=true copy=false >}} title: Who we are diff --git a/docs/content/en/content-management/comments.md b/docs/content/en/content-management/comments.md index 0543f47a7..751fb89bf 100644 --- a/docs/content/en/content-management/comments.md +++ b/docs/content/en/content-management/comments.md @@ -2,7 +2,7 @@ title: Comments description: Hugo ships with an internal Disqus template, but this isn't the only commenting system that will work with your new Hugo website. keywords: [sections,content,organization] -categories: [project organization, fundamentals] +categories: [project organization] menu: docs: parent: content-management @@ -34,9 +34,9 @@ For many websites, this is enough configuration. However, you also have the opti * `disqus_title` * `disqus_url` -### Render Hugo's Built-in Disqus Partial Template +### Render Hugo's built-in Disqus partial template -Disqus has its own [internal template](https://gohugo.io/templates/internal/#disqus) available, to render it add the following code where you want comments to appear: +Disqus has its own [internal template](/templates/internal/#disqus) available, to render it add the following code where you want comments to appear: ```go-html-template {{ template "_internal/disqus.html" . }} diff --git a/docs/content/en/content-management/cross-references.md b/docs/content/en/content-management/cross-references.md index a2b3f8e1c..c989cc560 100644 --- a/docs/content/en/content-management/cross-references.md +++ b/docs/content/en/content-management/cross-references.md @@ -1,6 +1,5 @@ --- -title: Links and Cross References -linkTitle: Links and Cross References +title: Links and cross references description: Shortcodes for creating links to documents. categories: [content management] keywords: ["cross references","references", "anchors", "urls"] @@ -19,7 +18,7 @@ The `ref` and `relref` shortcodes display the absolute and relative permalinks t The `ref` and `relref` shortcodes require a single parameter: the path to a content document, with or without a file extension, with or without an anchor. Paths without a leading `/` are first resolved relative to the current page, then to the remainder of the site. -``` +```text . └── content ├── about @@ -78,7 +77,7 @@ To link to another language version of a document, use this syntax: {{</* relref path="document.md" lang="ja" */>}} ``` -### Get another Output Format +### Get another output format To link to another Output Format of a document, use this syntax: diff --git a/docs/content/en/content-management/diagrams.md b/docs/content/en/content-management/diagrams.md index e664dd501..c0b2349b0 100644 --- a/docs/content/en/content-management/diagrams.md +++ b/docs/content/en/content-management/diagrams.md @@ -12,7 +12,7 @@ weight: 50 --- {{< new-in "0.93.0" >}} -## GoAT Diagrams (Ascii) +## GoAT diagrams (Ascii) Hugo supports [GoAT](https://github.com/bep/goat) natively. This means that this code block: @@ -42,14 +42,14 @@ Will be rendered as: 1 2 3 4 1 2 3 4 1 2 3 4 '--- 4 '-- 4 \ 4 ``` -## Mermaid Diagrams +## Mermaid diagrams Hugo currently does not provide default templates for Mermaid diagrams. But you can easily add your own. One way to do it would be to create `layouts/_default/_markup/render-codeblock-mermaid.html`: ```go-html-template -<div class="mermaid"> +<pre class="mermaid"> {{- .Inner | safeHTML }} -</div> +</pre> {{ .Page.Store.Set "hasMermaid" true }} ``` @@ -66,7 +66,7 @@ And then include this snippet at the bottom of the content template (**Note**: b With that you can use the `mermaid` language in Markdown code blocks: -```` +````text ```mermaid sequenceDiagram participant Alice @@ -82,7 +82,7 @@ sequenceDiagram ``` ```` -## Goat Ascii Diagram Examples +## Goat ASCII diagram examples ### Graphics @@ -166,7 +166,7 @@ Created from <https://arthursonzogni.com/Diagon/#Tree> ``` -### Sequence Diagram +### Sequence diagram <https://arthursonzogni.com/Diagon/#Sequence> diff --git a/docs/content/en/content-management/formats.md b/docs/content/en/content-management/formats.md index ba988c29b..a974d41d3 100644 --- a/docs/content/en/content-management/formats.md +++ b/docs/content/en/content-management/formats.md @@ -1,6 +1,5 @@ --- -title: Content Formats -linkTitle: Content Formats +title: Content formats description: Both HTML and Markdown are supported content formats. categories: [content management] keywords: [markdown,asciidoc,pandoc,content format] @@ -34,7 +33,7 @@ The current list of content formats in Hugo: The `markup identifier` is fetched from either the `markup` variable in front matter or from the file extension. For markup-related configuration, see [Configure Markup](/getting-started/configuration-markup/). -## External Helpers +## External helpers Some of the formats in the table above need external helpers installed on your PC. For example, for AsciiDoc files, Hugo will try to call the `asciidoctor` command. This means that you will have to install the associated @@ -50,13 +49,7 @@ Hugo passes reasonable default arguments to these external helpers by default: Because additional formats are external commands, generation performance will rely heavily on the performance of the external tool you are using. As this feature is still in its infancy, feedback is welcome. {{% /note %}} -### External Helper AsciiDoc - -[AsciiDoc](https://github.com/asciidoc/asciidoc) implementation EOLs in Jan 2020 and is no longer supported. -AsciiDoc development is being continued under [Asciidoctor](https://github.com/asciidoctor). The format AsciiDoc -remains of course. Please continue with the implementation Asciidoctor. - -### External Helper Asciidoctor +### External helper Asciidoctor The Asciidoctor community offers a wide set of tools for the AsciiDoc format that can be installed additionally to Hugo. [See the Asciidoctor docs for installation instructions](https://asciidoctor.org/docs/install-toolchain/). Make sure that also all @@ -113,7 +106,7 @@ parameters. Run Hugo with `-v`. You will get an output like INFO 2019/12/22 09:08:48 Rendering book-as-pdf.adoc with C:\Ruby26-x64\bin\asciidoctor.bat using asciidoc args [--no-header-footer -r asciidoctor-html5s -b html5s -r asciidoctor-diagram --base-dir D:\prototypes\hugo_asciidoc_ddd\docs -a outdir=D:\prototypes\hugo_asciidoc_ddd\build -] ... ``` -## Learn Markdown +## Learn markdown Markdown syntax is simple enough to learn in a single sitting. The following are excellent resources to get you up and running: diff --git a/docs/content/en/content-management/front-matter.md b/docs/content/en/content-management/front-matter.md index fb02f99f5..10317e805 100644 --- a/docs/content/en/content-management/front-matter.md +++ b/docs/content/en/content-management/front-matter.md @@ -1,5 +1,5 @@ --- -title: Front Matter +title: Front matter description: Hugo allows you to add front matter in yaml, toml, or json to your content files. categories: [content management] keywords: ["front matter", "yaml", "toml", "json", "metadata", "archetypes"] @@ -16,7 +16,7 @@ aliases: [/content/front-matter/] {{< youtube Yh2xKRJGff4 >}} -## Front Matter Formats +## Front matter formats Hugo supports four formats for front matter, each with their own identifying tokens. @@ -47,7 +47,7 @@ categories = [ slug = "spf13-vim-3-0-release-and-new-website" {{< /code-toggle >}} -## Front Matter Variables +## Front matter variables ### Predefined @@ -93,7 +93,7 @@ lastmod : The datetime at which the content was last modified. linkTitle -: Used for creating links to content; if set, Hugo defaults to using the `linktitle` before the `title`. Hugo can also [order lists of content by `linktitle`][bylinktitle]. +: Used for creating links to content; if set, Hugo defaults to using the `linkTitle` before the `title`. Hugo can also [order lists of content by `linkTitle`][bylinktitle]. markup : **experimental**; specify `"rst"` for reStructuredText (requires`rst2html`) or `"md"` (default) for Markdown. @@ -135,10 +135,10 @@ weight : Field name of the *plural* form of the index. See `tags` and `categories` in the above front matter examples. *Note that the plural form of user-defined taxonomies cannot be the same as any of the predefined front matter variables.* {{% note %}} -If neither `slug` nor `url` is present and [permalinks are not configured otherwise in your site configuration file](/content-management/urls/#permalinks), Hugo will use the filename of your content to create the output URL. See [Content Organization](/content-management/organization) for an explanation of paths in Hugo and [URL Management](/content-management/urls/) for ways to customize Hugo's default behaviors. +If neither `slug` nor `url` is present and [permalinks are not configured otherwise in your site configuration file](/content-management/urls/#permalinks), Hugo will use the file name of your content to create the output URL. See [Content Organization](/content-management/organization) for an explanation of paths in Hugo and [URL Management](/content-management/urls/) for ways to customize Hugo's default behaviors. {{% /note %}} -### User-Defined +### User-defined You can add fields to your front matter arbitrarily to meet your needs. These user-defined key-values are placed into a single `.Params` variable for use in your templates. @@ -149,11 +149,11 @@ include_toc: true show_comments: false {{</ code-toggle >}} -## Front Matter Cascade +## Front matter cascade -Any node or section can pass down to descendants a set of Front Matter values as long as defined underneath the reserved `cascade` Front Matter key. +Any node or section can pass down to descendants a set of front matter values as long as defined underneath the reserved `cascade` front matter key. -### Target Specific Pages +### Target specific pages The `cascade` block can be a slice with a optional `_target` keyword, allowing for multiple `cascade` values targeting different page sets. @@ -202,15 +202,15 @@ With the above example the Blog section page and its descendants will return `im - Said descendant has its own `banner` value set - Or a closer ancestor node has its own `cascade.banner` value set. -## Order Content Through Front Matter +## Order content through front matter You can assign content-specific `weight` in the front matter of your content. These values are especially useful for [ordering][ordering] in list views. You can use `weight` for ordering of content and the convention of [`<TAXONOMY>_weight`][taxweight] for ordering content within a taxonomy. See [Ordering and Grouping Hugo Lists][lists] to see how `weight` can be used to organize your content in list views. -## Override Global Markdown Configuration +## Override global markdown configuration -It's possible to set some options for Markdown rendering in a content's front matter as an override to the [Rendering options set in your project configuration][config]. +It's possible to set some options for Markdown rendering in a content's front matter as an override to the [rendering options set in your project configuration][config]. -## Front Matter Format Specs +## Front matter format specs - [TOML Spec][toml] - [YAML Spec][yaml] @@ -220,15 +220,15 @@ It's possible to set some options for Markdown rendering in a content's front ma [aliases]: /content-management/urls/#aliases [archetype]: /content-management/archetypes/ [bylinktitle]: /templates/lists/#by-link-title -[config]: /getting-started/configuration/ "Hugo documentation for site configuration" +[config]: /getting-started/configuration/ [content type]: /content-management/types/ [contentorg]: /content-management/organization/ [headless-bundle]: /content-management/page-bundles/#headless-bundle -[json]: https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf "Specification for JSON, JavaScript Object Notation" -[lists]: /templates/lists/#order-content "See how to order content in list pages; for example, templates that look to specific _index.md for content and front matter." -[lookup]: /templates/lookup-order/ "Hugo traverses your templates in a specific order when rendering content to allow for DRYer templating." -[ordering]: /templates/lists/ "Hugo provides multiple ways to sort and order your content in list templates" -[outputs]: /templates/output-formats/ "With the release of v22, you can output your content to any text format using Hugo's familiar templating" +[json]: https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf +[lists]: /templates/lists/#order-content +[lookup]: /templates/lookup-order/ +[ordering]: /templates/lists/ +[outputs]: /templates/output-formats/ [page-resources]: /content-management/page-resources/ [pagevars]: /variables/page/ [section]: /content-management/sections/ @@ -236,4 +236,4 @@ It's possible to set some options for Markdown rendering in a content's front ma [toml]: https://toml.io/ [urls]: /content-management/urls/ [variables]: /variables/ -[yaml]: https://yaml.org/spec/ "Specification for YAML, YAML Ain't Markup Language" +[yaml]: https://yaml.org/spec/ diff --git a/docs/content/en/content-management/image-processing/index.md b/docs/content/en/content-management/image-processing/index.md index 3d70951b3..273b68ab8 100644 --- a/docs/content/en/content-management/image-processing/index.md +++ b/docs/content/en/content-management/image-processing/index.md @@ -1,7 +1,7 @@ --- -title: Image Processing +title: Image processing description: Resize, crop, rotate, filter, and convert images. -categories: [content management] +categories: [fundamentals,content management] keywords: [resources, images] menu: docs: @@ -10,11 +10,11 @@ menu: toc: true weight: 90 --- -## Image Resources +## Image resources To process an image, you must access the image as either a page resource or a global resource. -### Page Resources +### Page resources A page resource is a file within a [page bundle]. A page bundle is a directory with an `index.md` or `_index.md` file at its root. @@ -26,7 +26,7 @@ content/ └── sunset.jpg <-- page resource ``` -### Global Resources +### Global resources A global resource is a file: @@ -52,7 +52,7 @@ To access a remote image as a global resource: {{ $image := resources.GetRemote "https://gohugo.io/img/hugo-logo.png" }} ``` -## Image Rendering +## Image rendering Once you have accessed an image as either a page resource or a global resource, render it in your templates using the `Permalink`, `RelPermalink`, `Width`, and `Height` properties. @@ -80,12 +80,12 @@ Example 3: A more concise way to skip image rendering if the resource is not fou {{ end }} ``` -## Image Processing Methods +## Image processing methods The `image` resource implements the [`Resize`], [`Fit`], [`Fill`], [`Crop`], [`Filter`], [`Colors`] and [`Exif`] methods. {{% note %}} -Metadata (Exif, IPTC, XMP, etc.) is not preserved during image transformation. Use the [`Exif`] method with the _original_ image to extract Exif metadata from JPEG or TIFF images. +Metadata (EXIF, IPTC, XMP, etc.) is not preserved during image transformation. Use the [`Exif`] method with the _original_ image to extract EXIF metadata from JPEG or TIFF images. {{% /note %}} ### Resize @@ -164,11 +164,11 @@ Sometimes it can be useful to create the filter chain once and then reuse it. This method is fast, but if you also scale down your images, it would be good for performance to extract the colors from the scaled down image. -### Exif +### EXIF -Provides an [Exif] object containing image metadata. +Provides an [EXIF] object containing image metadata. -You may access Exif data in JPEG and TIFF images. To prevent errors when processing images without Exif data, wrap the access in a [`with`] statement. +You may access EXIF data in JPEG and TIFF images. To prevent errors when processing images without EXIF data, wrap the access in a [`with`] statement. ```go-html-template {{ with $image.Exif }} @@ -181,7 +181,7 @@ You may access Exif data in JPEG and TIFF images. To prevent errors when process {{ end }} ``` -You may also access Exif fields individually, using the [`lang.FormatNumber`] function to format the fields as needed. +You may also access EXIF fields individually, using the [`lang.FormatNumber`] function to format the fields as needed. ```go-html-template {{ with $image.Exif }} @@ -198,7 +198,7 @@ You may also access Exif fields individually, using the [`lang.FormatNumber`] fu {{ end }} ``` -#### Exif Variables +#### EXIF variables .Date : Image creation date/time. Format with the [time.Format] function. @@ -210,9 +210,9 @@ You may also access Exif fields individually, using the [`lang.FormatNumber`] fu : GPS longitude in degrees. .Tags -: A collection of the available Exif tags for this image. You may include or exclude specific tags from this collection in the [site configuration](#exif-data). +: A collection of the available EXIF tags for this image. You may include or exclude specific tags from this collection in the [site configuration](#exif-data). -## Image Processing Options +## Image processing options The [`Resize`], [`Fit`], [`Fill`], and [`Crop`] methods accept a space-separated, case-insensitive list of options. The order of the options within the list is irrelevant. @@ -265,7 +265,7 @@ For example, if you have a 400x200 image with a bird in the upper left quadrant, If you apply [rotation](#rotation) when using the [`Crop`] or [`Fill`] method, specify the anchor relative to the rotated image. -### Target Format +### Target format By default, Hugo encodes the image in the source format. You may convert the image to another format by specifying `bmp`, `gif`, `jpeg`, `jpg`, `png`, `tif`, `tiff`, or `webp`. @@ -313,7 +313,7 @@ The default value is `photo`. You may override the default value in the [site co {{ $image.Resize "600x webp picture" }} ``` -### Background Color +### Background color When converting an image from a format that supports transparency (e.g., PNG) to a format that does _not_ support transparency (e.g., JPEG), you may specify the background color of the resulting image. @@ -325,7 +325,7 @@ The default value is `#ffffff` (white). You may override the default value in th {{ $image.Resize "600x jpg #b31280" }} ``` -### Resampling Filter +### Resampling filter You may specify the resampling filter used when resizing an image. Commonly used resampling filters include: @@ -346,7 +346,7 @@ The default value is `Box`. You may override the default value in the [site conf See [github.com/disintegration/imaging] for the complete list of resampling filters. If you wish to improve image quality at the expense of performance, you may wish to experiment with the alternative filters. -## Image Processing Examples +## Image processing examples _The photo of the sunset used in the examples below is Copyright [Bjørn Erik Pedersen](https://commons.wikimedia.org/wiki/User:Bep) (Creative Commons Attribution-Share Alike 4.0 International license)_ @@ -378,9 +378,9 @@ Call the shortcode from your Markdown like this: Note the self-closing shortcode syntax above. You may call the `imgproc` shortcode with or without **inner content**. {{% /note %}} -## Imaging Configuration +## Imaging configuration -### Processing Options +### Processing options Define an `imaging` section in your site configuration to set the default [image processing options](#image-processing-options). @@ -408,9 +408,9 @@ quality resampleFilter : See image processing options: [resampling filter](#resampling-filter). -### Exif Data +### EXIF data -Define an `imaging.exif` section in your site configuration to control the availability of Exif data. +Define an `imaging.exif` section in your site configuration to control the availability of EXIF data. {{< code-toggle file="hugo" copy=true >}} [imaging.exif] @@ -427,16 +427,16 @@ disableLatLong : Hugo extracts the GPS latitude and longitude into `.Lat` and `.Long`. Set this to `true` to disable. Default is `false`. excludeFields -: Regular expression matching the Exif tags to exclude from the `.Tags` collection. Default is `""`. +: Regular expression matching the EXIF tags to exclude from the `.Tags` collection. Default is `""`. includeFields -: Regular expression matching the Exif tags to include in the `.Tags` collection. Default is `""`. To include all available tags, set this value to `".*"`. +: Regular expression matching the EXIF tags to include in the `.Tags` collection. Default is `""`. To include all available tags, set this value to `".*"`. {{% note %}} To improve performance and decrease cache size, if you set neither `excludeFields` nor `includeFields`, Hugo excludes the following tags: `ColorSpace`, `Contrast`, `Exif`, `Exposure[M|P|B]`, `Flash`, `GPS`, `JPEG`, `Metering`, `Resolution`, `Saturation`, `Sensing`, `Sharp`, and `WhiteBalance`. {{% /note %}} -## Smart Cropping of Images +## Smart cropping of images By default, Hugo uses the [Smartcrop] library when cropping images with the `Crop` or`Fill` methods. You can set the anchor point manually, but in most cases the `Smart` option will make a good choice. @@ -446,7 +446,7 @@ Examples using the sunset image from above: {{< imgproc sunset Crop "200x200 smart" />}} -## Image Processing Performance Consideration +## Image processing performance consideration Hugo caches processed images in the `resources` directory. If you include this directory in source control, Hugo will not have to regenerate the images in a CI/CD workflow (e.g., GitHub Pages, GitLab Pages, Netlify, etc.). This results in faster builds. @@ -458,7 +458,7 @@ hugo --gc [time.Format]: /functions/dateformat [`anchor`]: /content-management/image-processing#anchor -[mounted]: /hugo-modules/configuration#module-config-mounts +[mounted]: /hugo-modules/configuration#module-configuration-mounts [page bundle]: /content-management/page-bundles [`lang.FormatNumber`]: /functions/lang [filters]: /functions/images diff --git a/docs/content/en/content-management/multilingual.md b/docs/content/en/content-management/multilingual.md index 71adc214d..4c1f6446e 100644 --- a/docs/content/en/content-management/multilingual.md +++ b/docs/content/en/content-management/multilingual.md @@ -1,5 +1,5 @@ --- -title: Multilingual Mode +title: Multilingual mode linkTitle: Multilingual description: Hugo supports the creation of websites with multiple languages side by side. categories: [content management] @@ -17,57 +17,79 @@ You should define the available languages in a `languages` section in your site Also See [Hugo Multilingual Part 1: Content translation]. -## Configure Languages +## Configure languages -The following is an example of a site configuration for a multilingual Hugo project: +This is an example of a site configuration for a multilingual project. Any key not defined in a `languages` object will fall back to the global value in the root of your site configuration. {{< code-toggle file="hugo" >}} -defaultContentLanguage = "en" -copyright = "Everything is mine" +defaultContentLanguage = 'de' +defaultContentLanguageInSubdir = true -[params] -[params.navigation] -help = "Help" - -[languages] -[languages.en] -title = "My blog" +[languages.de] +contentDir = 'content/de' +disabled = false +languageCode = 'de-DE' +languageDirection = 'ltr' +languageName = 'Deutsch' +title = 'Projekt Dokumentation' weight = 1 -[languages.en.params] -linkedin = "https://linkedin.com/whoever" -[languages.fr] -title = "Mon blogue" -weight = 2 -[languages.fr.params] -linkedin = "https://linkedin.com/fr/whoever" -[languages.fr.params.navigation] -help = "Aide" +[languages.de.params] +subtitle = 'Referenz, Tutorials und Erklärungen' -[languages.ar] -title = "مدونتي" +[languages.en] +contentDir = 'content/en' +disabled = false +languageCode = 'en-US' +languageDirection = 'ltr' +languageName = 'English' +title = 'Project Documentation' weight = 2 -languagedirection = "rtl" -[languages.pt-pt] -title = "O meu blog" -weight = 3 +[languages.en.params] +subtitle = 'Reference, Tutorials, and Explanations' {{< /code-toggle >}} -Anything not defined in a `languages` block will fall back to the global value for that key (e.g., `copyright` for the English `en` language). This also works for `params`, as demonstrated with `help` above: You will get the value `Aide` in French and `Help` in all the languages without this parameter set. +`defaultContentLanguage` +: (`string`) The project's default language tag as defined by [RFC 5646]. Must be lower case, and must match one of the defined language keys. Default is `en`. Examples: + +- `en` +- `en-gb` +- `pt-br` -With the configuration above, all content, sitemap, RSS feeds, pagination, -and taxonomy pages will be rendered below `/` in English (your default content language) and then below `/fr` in French. +`defaultContentLanguageInSubdir` +: (`bool`) If `true`, Hugo renders the default language site in a subdirectory matching the `defaultContentLanguage`. Default is `false`. -When working with front matter `Params` in [single page templates], omit the `params` in the key for the translation. +`contentDir` +: (`string`) The content directory for this language. Omit if [translating by file name]. -`defaultContentLanguage` sets the project's default language. If not set, the default language will be `en`. +`disabled` +: (`bool`) If `true`, Hugo will not render content for this language. Default is `false`. -If the default language needs to be rendered below its own language code (`/en`) like the others, set `defaultContentLanguageInSubdir: true`. +`languageCode` +: (`string`) The language tag as defined by [RFC 5646]. This value may include upper and lower case characters, hyphens or underscores, and does not affect localization or URLs. Hugo uses this value to populate the `language` element in the [built-in RSS template], and the `lang` attribute of the `html` element in the [built-in alias template]. Examples: -Only the obvious non-global options can be overridden per language. Examples of global options are `baseURL`, `buildDrafts`, etc. +- `en` +- `en-GB` +- `pt-BR` -**Please note:** use lowercase language codes, even when using regional languages (ie. use pt-pt instead of pt-PT). Currently Hugo language internals lowercase language codes, which can cause conflicts with settings like `defaultContentLanguage` which are not lowercased. Please track the evolution of this issue in [Hugo repository issue tracker](https://github.com/gohugoio/hugo/issues/7344) +`languageDirection` +: (`string`) The language direction, either left-to-right (`ltr`) or right-to-left (`rtl`). Use this value in your templates with the global [`dir`] HTML attribute. + +`languageName` +: (`string`) The language name, typically used when rendering a language switcher. + +`title` +: (`string`) The language title. When set, this overrides the site title for this language. + +`weight` +: (`int`) The language weight. When set to a non-zero value, this is the primary sort criteria for this language. + +[`dir`]: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir +[built-in RSS template]: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/rss.xml +[built-in alias template]: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/alias.html +[RFC 5646]: https://datatracker.ietf.org/doc/html/rfc5646 +[translating by file name]: #translation-by-file-name ### Changes in Hugo 0.112.0 @@ -76,7 +98,7 @@ Only the obvious non-global options can be overridden per language. Examples of In Hugo `v0.112.0` we consolidated all configuration options, and improved how the languages and their parameters are merged with the main configuration. But while testing this on Hugo sites out there, we received some error reports and reverted some of the changes in favor of deprecation warnings: 1. `site.Language.Params` is deprecated. Use `site.Params` directly. -1. Adding custom params to the top level language config is deprecated, add all of these below `[params]`, see `color` in the example below. +1. Adding custom parameters to the top level language configuration is deprecated, add all of these below `[params]`, see `color` in the example below. ```toml title = "My blog" @@ -92,35 +114,36 @@ color = "blue" In the example above, all settings except `color` below `params` map to predefined configuration options in Hugo for the site and its language, and should be accessed via the documented accessors: -``` +```go-html-template {{ site.Title }} {{ site.LanguageCode }} {{ site.Params.color }} ``` -### Disable a Language +### Disable a language -You can disable one or more languages. This can be useful when working on a new translation. +To disable a language within a `languages` object in your site configuration: -{{< code-toggle file="hugo" >}} -disableLanguages = ["fr", "ja"] +{{< code-toggle file="hugo" copy=false >}} +[languages.es] +disabled = true {{< /code-toggle >}} -Note that you cannot disable the default content language. +To disable one or more languages in the root of your site configuration: -We kept this as a standalone setting to make it easier to set via [OS environment]: - -```bash -HUGO_DISABLELANGUAGES="fr ja" hugo -``` +{{< code-toggle file="hugo" copy=false >}} +disableLanguages = ["es", "fr"] +{{< /code-toggle >}} -If you have already a list of disabled languages in `hugo.toml`, you can enable them in development like this: +To disable one or more languages using an environment variable: ```bash -HUGO_DISABLELANGUAGES=" " hugo server +HUGO_DISABLELANGUAGES="es fr" hugo ``` -### Configure Multilingual Multihost +Note that you cannot disable the default content language. + +### Configure multilingual multihost From **Hugo 0.31** we support multiple languages in a multihost configuration. See [this issue](https://github.com/gohugoio/hugo/issues/4027) for details. @@ -167,12 +190,11 @@ Press Ctrl+C to stop Live reload and `--navigateToChanged` between the servers work as expected. - -## Translate Your Content +## Translate your content There are two ways to manage your content translations. Both ensure each page is assigned a language and is linked to its counterpart translations. -### Translation by filename +### Translation by file name Considering the following example: @@ -182,9 +204,9 @@ Considering the following example: The first file is assigned the English language and is linked to the second. The second file is assigned the French language and is linked to the first. -Their language is __assigned__ according to the language code added as a __suffix to the filename__. +Their language is __assigned__ according to the language code added as a __suffix to the file name__. -By having the same **path and base filename**, the content pieces are __linked__ together as translated pages. +By having the same **path and base file name**, the content pieces are __linked__ together as translated pages. {{% note %}} If a file has no language code, it will be assigned the default language. @@ -192,7 +214,7 @@ If a file has no language code, it will be assigned the default language. ### Translation by content directory -This system uses different content directories for each of the languages. Each language's content directory is set using the `contentDir` param. +This system uses different content directories for each of the languages. Each language's content directory is set using the `contentDir` parameter. {{< code-toggle file="hugo" >}} languages: @@ -234,11 +256,11 @@ Considering the following example: translationKey: "about" {{< /code-toggle >}} -By setting the `translationKey` front matter param to `about` in all three pages, they will be __linked__ as translated pages. +By setting the `translationKey` front matter parameter to `about` in all three pages, they will be __linked__ as translated pages. ### Localizing permalinks -Because paths and filenames are used to handle linking, all translated pages will share the same URL (apart from the language subdirectory). +Because paths and file names are used to handle linking, all translated pages will share the same URL (apart from the language subdirectory). To localize URLs: @@ -257,7 +279,7 @@ slug: "a-propos" At render, Hugo will build both `/about/` and `/fr/a-propos/` without affecting the translation link. -### Page Bundles +### Page bundles To avoid the burden of having to duplicate files, each Page Bundle inherits the resources of its linked translated pages' bundles except for the content files (Markdown files, HTML files etc...). @@ -269,10 +291,10 @@ If, across the linked bundles, two or more files share the same basename, only o * First file found across bundles by order of language `Weight`. {{% note %}} -Page Bundle resources follow the same language assignment logic as content files, both by filename (`image.jpg`, `image.fr.jpg`) and by directory (`english/about/header.jpg`, `french/about/header.jpg`). +Page Bundle resources follow the same language assignment logic as content files, both by file name (`image.jpg`, `image.fr.jpg`) and by directory (`english/about/header.jpg`, `french/about/header.jpg`). {{%/ note %}} -## Reference the Translated Content +## Reference translated content To create a list of links to translated content, use a template similar to the following: @@ -293,7 +315,7 @@ The above can be put in a `partial` (i.e., inside `layouts/partials/`) and inclu The above also uses the [`i18n` function][i18func] described in the next section. -### List All Available Languages +### List all available languages `.AllTranslations` on a `Page` can be used to list all translations, including the page itself. On the home page it can be used to build a language navigator: @@ -305,7 +327,7 @@ The above also uses the [`i18n` function][i18func] described in the next section </ul> {{< /code >}} -## Translation of Strings +## Translation of strings Hugo uses [go-i18n] to support string translations. [See the project's source repository][go-i18n-source] to find tools that will help you manage your translation workflows. @@ -585,7 +607,7 @@ weight = 20 For a simple menu with two languages, these menu entries are easy to create and maintain. For a larger menu, or with more than two languages, using translation tables as described above is preferable. -## Missing Translations +## Missing translations If a string does not have a translation for the current language, Hugo will use the value from the default language. If no default value is set, an empty string will be shown. @@ -604,7 +626,7 @@ hugo --printI18nWarnings | grep i18n i18n|MISSING_TRANSLATION|en|wordCount ``` -## Multilingual Themes support +## Multilingual themes support To support Multilingual mode in your themes, some considerations must be taken for the URLs in the templates. If there is more than one language, URLs must meet the following criteria: diff --git a/docs/content/en/content-management/organization/index.md b/docs/content/en/content-management/organization/index.md index efa355ddc..2c0d2e604 100644 --- a/docs/content/en/content-management/organization/index.md +++ b/docs/content/en/content-management/organization/index.md @@ -1,8 +1,8 @@ --- -title: Content Organization +title: Content organization linkTitle: Organization description: Hugo assumes that the same structure that works to organize your source content is used to organize the rendered site. -categories: [content management,fundamentals] +categories: [fundamentals,content management] keywords: [sections,content,organization,bundle,resources] menu: docs: @@ -13,7 +13,7 @@ weight: 20 aliases: [/content/sections/] --- -## Page Bundles +## Page bundles Hugo `0.32` announced page-relative images and other resources packaged into `Page Bundles`. @@ -29,7 +29,7 @@ The bundle documentation is a **work in progress**. We will publish more compreh {{% /note %}} -## Organization of Content Source +## Organization of content source In Hugo, your content should be organized in a manner that reflects the rendered website. @@ -52,12 +52,12 @@ Without any additional configuration, the following will automatically work: └── second.md // <- https://example.com/quote/second/ ``` -## Path Breakdown in Hugo +## Path breakdown in Hugo The following demonstrates the relationships between your content organization and the output URL structure for your Hugo website when it renders. These examples assume you are [using pretty URLs][pretty], which is the default behavior for Hugo. The examples also assume a key-value of `baseURL = "https://example.com"` in your [site's configuration file][config]. -### Index Pages: `_index.md` +### Index pages: `_index.md` `_index.md` has a special role in Hugo. It allows you to add front matter and content to your [list templates][lists]. These templates include those for [section templates], [taxonomy templates], [taxonomy terms templates], and your [homepage template]. @@ -94,7 +94,7 @@ https://example.com/posts/index.html The [sections] can be nested as deeply as you want. The important thing to understand is that to make the section tree fully navigational, at least the lower-most section must include a content file. (i.e. `_index.md`). -### Single Pages in Sections +### Single pages in sections Single content files in each of your sections will be rendered as [single page templates][singles]. Here is an example of a single `post` within `posts`: @@ -121,7 +121,7 @@ https://example.com/posts/my-first-hugo-post/index.html ``` -## Paths Explained +## Paths explained The following concepts provide more insight into the relationship between your project's organization and the default Hugo behavior when building output for the website. diff --git a/docs/content/en/content-management/page-bundles.md b/docs/content/en/content-management/page-bundles.md index 2a5147c21..c4ce69f5f 100644 --- a/docs/content/en/content-management/page-bundles.md +++ b/docs/content/en/content-management/page-bundles.md @@ -1,5 +1,5 @@ --- -title: Page Bundles +title: Page bundles description: Content organization using Page Bundles keywords: [page, bundle, leaf, branch] categories: [content management] @@ -19,23 +19,22 @@ A Page Bundle can be one of: - Branch Bundle (home page, section, taxonomy terms, taxonomy list) | | Leaf Bundle | Branch Bundle | -|-------------------------------------|----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +|-------------------------------------|----------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Usage | Collection of content and attachments for single pages | Collection of attachments for section pages (home page, section, taxonomy terms, taxonomy list) | -| Index filename | `index.md` [^fn:1] | `_index.md` [^fn:1] | +| Index file name | `index.md` [^fn:1] | `_index.md` [^fn:1] | | Allowed Resources | Page and non-page (like images, PDF, etc.) types | Only non-page (like images, PDF, etc.) types | | Where can the Resources live? | At any directory level within the leaf bundle directory. | Only in the directory level **of** the branch bundle directory i.e. the directory containing the `_index.md` ([ref](https://discourse.gohugo.io/t/question-about-content-folder-structure/11822/4?u=kaushalmodi)). | -| Layout type | `single` | `list` | +| Layout type | [`single`](/templates/single-page-templates/) | [`list`](/templates/lists) | | Nesting | Does not allow nesting of more bundles under it | Allows nesting of leaf or branch bundles under it | | Example | `content/posts/my-post/index.md` | `content/posts/_index.md` | -| Content from non-index page files... | Accessed only as page resources | Accessed only as regular pages | +| Content from non-index page files...| Accessed only as page resources | Accessed only as regular pages | - -## Leaf Bundles {#leaf-bundles} +## Leaf bundles A _Leaf Bundle_ is a directory at any hierarchy within the `content/` directory, that contains an **`index.md`** file. -### Examples of Leaf Bundle organization {#examples-of-leaf-bundle-organization} +### Examples of leaf bundle organization {#examples-of-leaf-bundle-organization} ```text content/ @@ -92,7 +91,7 @@ as long as it is not inside another **leaf** bundle. {{% /note %}} -### Headless Bundle {#headless-bundle} +### Headless bundle A headless bundle is a bundle that is configured to not get published anywhere: @@ -126,7 +125,7 @@ Explanation of the above example: --- -A leaf bundle can be made headless by adding below in the Front Matter +A leaf bundle can be made headless by adding below in the front matter (in the `index.md`): {{< code-toggle file="content/headless/index.md" fm=true copy=false >}} @@ -138,7 +137,7 @@ There are many use cases of such headless page bundles: - Shared media galleries - Reusable page content "snippets" -## Branch Bundles {#branch-bundles} +## Branch bundles A _Branch Bundle_ is any directory at any hierarchy within the `content/` directory, that contains at least an **`_index.md`** file. @@ -151,7 +150,7 @@ type as a content resource as long as it is a content type recognized by Hugo. {{% /note %}} -### Examples of Branch Bundle organization {#examples-of-branch-bundle-organization} +### Examples of branch bundle organization ```text content/ diff --git a/docs/content/en/content-management/page-resources.md b/docs/content/en/content-management/page-resources.md index 54494c2e1..bbf288459 100644 --- a/docs/content/en/content-management/page-resources.md +++ b/docs/content/en/content-management/page-resources.md @@ -1,5 +1,5 @@ --- -title: Page Resources +title: Page resources description: Page resources -- images, other pages, documents, etc. -- have page-relative URLs and their own metadata. categories: [content management] keywords: [bundle,content,resources] @@ -42,7 +42,7 @@ ResourceType : The main type of the resource's [Media Type](/templates/output-formats/#media-types). For example, a file of MIME type `image/jpeg` has the ResourceType `image`. A `Page` will have `ResourceType` with value `page`. Name -: Default value is the filename (relative to the owning page). Can be set in front matter. +: Default value is the file name (relative to the owning page). Can be set in front matter. Title : Default value is the same as `.Name`. Can be set in front matter. @@ -67,21 +67,21 @@ with the contents of the file. Use this to create inline resources. {{ end }} {{ with .Resources.GetMatch "img.png" }} - <img src="data:{{ .MediaType }};base64,{{ .Content | base64Encode }}"> + <img src="data:{{ .MediaType.Type }};base64,{{ .Content | base64Encode }}"> {{ end }} ``` -MediaType -: The MIME type of the resource, such as `image/jpeg`. +MediaType.Type +: The media type (formerly known as a MIME type) of the resource (e.g., `image/jpeg`). MediaType.MainType -: The main type of the resource's MIME type. For example, a file of MIME type `application/pdf` has for MainType `application`. +: The main type of the resource's media type (e.g., `image`). MediaType.SubType -: The subtype of the resource's MIME type. For example, a file of MIME type `application/pdf` has for SubType `pdf`. Note that this is not the same as the file extension. For example, Microsoft PowerPoint files (`.ppt`) have a subtype of `vnd.ms-powerpoint`. +: The subtype of the resource's type (e.g., `jpeg`). This may or may not correspond to the file suffix. MediaType.Suffixes -: A slice of possible suffixes for the resource's MIME type. +: A slice of possible file suffixes for the resource's media type (e.g., `[jpg jpeg jpe jif jfif]`). ## Methods @@ -101,7 +101,7 @@ Match GetMatch : Same as `Match` but will return the first match. -### Pattern Matching +### Pattern matching ```go // Using Match/GetMatch to find this images/sunset.jpg ? @@ -115,7 +115,7 @@ GetMatch ``` -## Page Resources Metadata +## Page resources metadata The page resources' metadata is managed from the corresponding page's front matter with an array/table parameter named `resources`. You can batch assign values using [wildcards](https://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm). diff --git a/docs/content/en/content-management/related.md b/docs/content/en/content-management/related.md index e80c0f06b..d897bf47f 100644 --- a/docs/content/en/content-management/related.md +++ b/docs/content/en/content-management/related.md @@ -1,5 +1,5 @@ --- -title: Related Content +title: Related content description: List related content in "See Also" sections. categories: [content management] keywords: [content] @@ -12,9 +12,9 @@ weight: 110 aliases: [/content/related/,/related/] --- -Hugo uses a set of factors to identify a page's related content based on Front Matter parameters. This can be tuned to the desired set of indices and parameters or left to Hugo's default [Related Content configuration](#configure-related-content). +Hugo uses a set of factors to identify a page's related content based on front matter parameters. This can be tuned to the desired set of indices and parameters or left to Hugo's default [Related Content configuration](#configure-related-content). -## List Related Content +## List related content To list up to 5 related pages (which share the same _date_ or _keyword_ parameters) is as simple as including something similar to this partial in your single page template: @@ -60,7 +60,7 @@ A fictional example using all of the above options: We improved and simplified this feature in Hugo 0.111.0. Before this we had 3 different methods: `Related`, `RelatedTo` and `RelatedIndicies`. Now we have only one method: `Related`. The old methods are still available but deprecated. Also see [this blog article](https://regisphilibert.com/blog/2018/04/hugo-optmized-relashionships-with-related-content/) for a great explanation of more advanced usage of this feature. {{% /note %}} -## Index Content Headings in Related Content +## Index content headings in related content {{< new-in "0.111.0" >}} @@ -105,7 +105,7 @@ weight = 80 {{ end }} ``` -## Configure Related Content +## Configure related content Hugo provides a sensible default configuration of Related Content, but you can fine-tune this in your configuration, on the global or language level if needed. @@ -130,10 +130,10 @@ Note that if you have configured `tags` as a taxonomy, `tags` will also be added Custom configuration should be set using the same syntax. {{% note %}} -If you add a `related` config section, you need to add a complete configuration. It is not possible to just set, say, `includeNewer` and use the rest from the Hugo defaults. +If you add a `related` configuration section, you need to add a complete configuration. It is not possible to just set, say, `includeNewer` and use the rest from the Hugo defaults. {{% /note %}} -### Top Level Config Options +### Top level configuration options threshold : A value between 0-100. Lower value will give more, but maybe not so relevant, matches. @@ -144,10 +144,10 @@ includeNewer toLower : Set to true to lower case keywords in both the indexes and the queries. This may give more accurate results at a slight performance penalty. Note that this can also be set per index. -### Config Options per Index +### Configuration options per index name -: The index name. This value maps directly to a page param. Hugo supports string values (`author` in the example) and lists (`tags`, `keywords` etc.) and time and date objects. +: The index name. This value maps directly to a page parameter. Hugo supports string values (`author` in the example) and lists (`tags`, `keywords` etc.) and time and date objects. type : {{< new-in "0.111.0" >}}. One of `basic`(default) or `fragments`. @@ -168,7 +168,7 @@ pattern toLower : See above. -## Performance Considerations +## Performance considerations **Fast is Hugo's middle name** and we would not have released this feature had it not been blistering fast. diff --git a/docs/content/en/content-management/sections.md b/docs/content/en/content-management/sections.md index 10c87e6cb..9ee0f617f 100644 --- a/docs/content/en/content-management/sections.md +++ b/docs/content/en/content-management/sections.md @@ -1,6 +1,5 @@ --- -title: Content Sections -linkTitle: Sections +title: Sections description: Hugo generates a **section tree** that matches your content. categories: [content management] keywords: [lists,sections,content types,organization] @@ -31,7 +30,7 @@ A **section** cannot be defined or overridden by a front matter parameter -- it is strictly derived from the content organization structure. {{% /note %}} -## Nested Sections +## Nested sections The sections can be nested as deeply as you need. @@ -55,7 +54,7 @@ currently always the *root section* only (`/blog/funny-cats/mypost/ => blog`). If you need a specific template for a sub-section, you need to adjust either the `type` or `layout` in front matter. {{% /note %}} -## Example: Breadcrumb Navigation +## Example: breadcrumb navigation With the available [section variables and methods](#section-page-variables-and-methods) you can build powerful navigation. One common example would be a partial to show Breadcrumb navigation: @@ -74,17 +73,17 @@ With the available [section variables and methods](#section-page-variables-and-m </nav> {{< /code >}} -## Section Page Variables and Methods +## Section page variables and methods Also see [Page Variables](/variables/page/). {{< readfile file="/content/en/readfiles/sectionvars.md" markdown="true" >}} -## Content Section Lists +## Content section lists Hugo will automatically create a page for each *root section* that lists all the content in that section. See the documentation on [section templates] for details on customizing the way these pages are rendered. -## Content *Section* vs Content *Type* +## Content *section* vs. content *type* By default, everything created within a section will use the [content `type`][content type] that matches the *root section* name. For example, Hugo will assume that `posts/post-1.md` has a `posts` content `type`. If you are using an [archetype] for your `posts` section, Hugo will generate front matter according to what it finds in `archetypes/posts.md`. diff --git a/docs/content/en/content-management/shortcodes.md b/docs/content/en/content-management/shortcodes.md index b2c98fc65..72ddc6a8c 100644 --- a/docs/content/en/content-management/shortcodes.md +++ b/docs/content/en/content-management/shortcodes.md @@ -13,7 +13,7 @@ aliases: [/extras/shortcodes/] testparam: "Hugo Rocks!" --- -## What a Shortcode is +## What a shortcode is Hugo loves Markdown because of its simple content format, but there are times when Markdown falls short. Often, content authors are forced to add raw HTML (e.g., video `<iframe>`'s) to Markdown content. We think this contradicts the beautiful simplicity of Markdown's syntax. @@ -23,7 +23,7 @@ A shortcode is a simple snippet inside a content file that Hugo will render usin In addition to cleaner Markdown, shortcodes can be updated any time to reflect new classes, techniques, or standards. At the point of site generation, Hugo shortcodes will easily merge in your changes. You avoid a possibly complicated search and replace operation. -## Use Shortcodes +## Use shortcodes {{< youtube 2xkNJL4gJ9E >}} @@ -54,7 +54,7 @@ You can pass multiple lines as parameters to a shortcode by using raw string lit and a new line with a "quoted string".` */>}} ``` -### Shortcodes with Markdown +### Shortcodes with markdown In Hugo `0.55` we changed how the `%` delimiter works. Shortcodes using the `%` as the outer-most delimiter will now be fully rendered when sent to the content renderer. They can be part of the generated table of contents, footnotes, etc. @@ -64,7 +64,7 @@ If you want the old behavior, you can put the following line in the start of you {{ $_hugo_config := `{ "version": 1 }` }} ``` -### Shortcodes Without Markdown +### Shortcodes without markdown The `<` character indicates that the shortcode's inner content does *not* need further rendering. Often shortcodes without Markdown include internal HTML: @@ -72,11 +72,11 @@ The `<` character indicates that the shortcode's inner content does *not* need f {{</* myshortcode */>}}<p>Hello <strong>World!</strong></p>{{</* /myshortcode */>}} ``` -### Nested Shortcodes +### Nested shortcodes You can call shortcodes within other shortcodes by creating your own templates that leverage the `.Parent` variable. `.Parent` allows you to check the context in which the shortcode is being called. See [Shortcode templates][sctemps]. -## Use Hugo's Built-in Shortcodes +## Use Hugo's built-in shortcodes Hugo ships with a set of predefined shortcodes that represent very common usage. These shortcodes are provided for author convenience and to keep your Markdown content clean. @@ -125,13 +125,13 @@ attr attrlink : If the attribution text needs to be hyperlinked, URL of the destination. -#### Example `figure` Input +#### Example `figure` input {{< code file="figure-input-example.md" >}} -{{</* figure src="elephant.jpg" title=">An elephant at sunset" */>}} +{{</* figure src="elephant.jpg" title="An elephant at sunset" */>}} {{< /code >}} -#### Example `figure` Output +#### Example `figure` output ```html <figure> @@ -254,17 +254,17 @@ Include this in your markdown: ### `param` -Gets a value from the current `Page's` params set in front matter, with a fallback to the site param value. It will log an `ERROR` if the param with the given key could not be found in either. +Gets a value from the current `Page's` parameters set in front matter, with a fallback to the site parameter value. It will log an `ERROR` if the parameter with the given key could not be found in either. ```bash {{</* param testparam */>}} ``` -Since `testparam` is a param defined in front matter of this page with the value `Hugo Rocks!`, the above will print: +Since `testparam` is a parameter defined in front matter of this page with the value `Hugo Rocks!`, the above will print: {{< param testparam >}} -To access deeply nested params, use "dot syntax", e.g: +To access deeply nested parameters, use "dot syntax", e.g: ```bash {{</* param "my.nested.param" */>}} @@ -282,14 +282,14 @@ Read a more extensive description of `ref` and `relref` in the [cross references `ref` and `relref` take exactly one required parameter of _reference_, quoted and in position `0`. -#### Example `ref` and `relref` Input +#### Example `ref` and `relref` input ```go-html-template [Neat]({{</* ref "blog/neat.md" */>}}) [Who]({{</* relref "about.md#who" */>}}) ``` -#### Example `ref` and `relref` Output +#### Example `ref` and `relref` output Assuming that standard Hugo pretty URLs are turned on. @@ -350,7 +350,7 @@ The `youtube` shortcode embeds a responsive video player for [YouTube videos]. O https://www.youtube.com/watch?v=w7Ft2ymGmfc ``` -#### Example `youtube` Input +#### Example `youtube` input Copy the YouTube video ID that follows `v=` in the video's URL and pass it to the `youtube` shortcode: @@ -371,7 +371,7 @@ For [accessibility reasons](https://dequeuniversity.com/tips/provide-iframe-titl {{</* youtube id="w7Ft2ymGmfc" title="A New Hugo Site in Under Two Minutes" */>}} {{< /code >}} -#### Example `youtube` Output +#### Example `youtube` output Using the preceding `youtube` example, the following HTML will be added to your rendered website's markup: @@ -379,17 +379,17 @@ Using the preceding `youtube` example, the following HTML will be added to your {{< youtube id="w7Ft2ymGmfc" autoplay="true" >}} {{< /code >}} -#### Example `youtube` Display +#### Example `youtube` display Using the preceding `youtube` example (without `autoplay="true"`), the following simulates the displayed experience for visitors to your website. Naturally, the final display will be contingent on your style sheets and surrounding markup. The video is also include in the [Quick Start of the Hugo documentation][quickstart]. {{< youtube w7Ft2ymGmfc >}} -## Privacy Config +## Privacy configuration To learn how to configure your Hugo site to meet the new EU privacy regulation, see [Hugo and the GDPR]. -## Create Custom Shortcodes +## Create custom shortcodes To learn more about creating custom shortcodes, see the [shortcode template documentation]. diff --git a/docs/content/en/content-management/static-files.md b/docs/content/en/content-management/static-files.md index ddc35da36..78772af99 100644 --- a/docs/content/en/content-management/static-files.md +++ b/docs/content/en/content-management/static-files.md @@ -1,6 +1,5 @@ --- -title: Static Files -linkTitle: Static Files +title: Static files description: Files that get served **statically** (as-is, no modification) on the site root. categories: [content management] keywords: [source, directories] @@ -18,7 +17,7 @@ all **static files** (e.g. stylesheets, JavaScript, images). The static files ar Hugo can be configured to look into a different directory, or even **multiple directories** for such static files by configuring the -`staticDir` parameter in the [site config]. All the files in all the +`staticDir` parameter in the [site configuration]. All the files in all the static directories will form a union filesystem. This union filesystem will be served from your site root. So a file @@ -65,5 +64,5 @@ Note 2 : The example above is a [multihost setup]. In a regular setup, all the static directories will be available to all sites. -[site config]: /getting-started/configuration/#all-configuration-settings +[site configuration]: /getting-started/configuration/#all-configuration-settings [multihost setup]: /content-management/multilingual/#configure-multilingual-multihost diff --git a/docs/content/en/content-management/summaries.md b/docs/content/en/content-management/summaries.md index 3156afa20..4f94f95f2 100644 --- a/docs/content/en/content-management/summaries.md +++ b/docs/content/en/content-management/summaries.md @@ -1,5 +1,5 @@ --- -title: Content Summaries +title: Content summaries linkTitle: Summaries description: Hugo generates summaries of your content. categories: [content management] @@ -15,7 +15,7 @@ aliases: [/content/summaries/,/content-management/content-summaries/] With the use of the `.Summary` [page variable][pagevariables], Hugo generates summaries of content to use as a short version in summary views. -## Summary Splitting Options +## Summary splitting options * Automatic Summary Split * Manual Summary Split @@ -23,7 +23,7 @@ With the use of the `.Summary` [page variable][pagevariables], Hugo generates su It is natural to accompany the summary with links to the original content, and a common design pattern is to see this link in the form of a "Read More ..." button. See the `.RelPermalink`, `.Permalink`, and `.Truncated` [page variables][pagevariables]. -### Automatic Summary Splitting +### Automatic summary splitting By default, Hugo automatically takes the first 70 words of your content as its summary and stores it into the `.Summary` page variable for use in your templates. You may customize the summary length by setting `summaryLength` in your [site configuration](/getting-started/configuration/). @@ -35,7 +35,7 @@ You can customize how HTML tags in the summary are loaded using functions such a The Hugo-defined summaries are set to use word count calculated by splitting the text by one or more consecutive whitespace characters. If you are creating content in a `CJK` language and want to use Hugo's automatic summary splitting, set `hasCJKLanguage` to `true` in your [site configuration](/getting-started/configuration/). {{% /note %}} -### Manual Summary Splitting +### Manual summary splitting Alternatively, you may add the <code><!--more--></code> summary divider where you want to split the article. @@ -57,7 +57,7 @@ Cons Be careful to enter <code><!--more--></code> exactly; i.e., all lowercase and with no whitespace. {{% /note %}} -### Front Matter Summary +### Front matter summary You might want your summary to be something other than the text that starts the article. In this case you can provide a separate summary in the `summary` variable of the article front matter. @@ -67,7 +67,7 @@ Pros Cons : Extra work for content authors as they need to write an entirely separate piece of text as the summary of the article. -## Summary Selection Order +## Summary selection order Because there are multiple ways in which a summary can be specified it is useful to understand the order of selection Hugo follows when deciding on the text to be returned by `.Summary`. It is as follows: @@ -79,7 +79,7 @@ Because there are multiple ways in which a summary can be specified it is useful Hugo uses the _first_ of the above steps that returns text. So if, for example, your article has both `summary` variable in its front matter and a <code><!--more--></code> summary divider Hugo will use the manual summary split method. {{% /note %}} -## Example: First 10 Articles with Summaries +## Example: first 10 articles with summaries You can show content summaries with the following code. You could use the following snippet, for example, in a [section template]. diff --git a/docs/content/en/content-management/syntax-highlighting.md b/docs/content/en/content-management/syntax-highlighting.md index 1f3045aed..44dece2df 100644 --- a/docs/content/en/content-management/syntax-highlighting.md +++ b/docs/content/en/content-management/syntax-highlighting.md @@ -1,5 +1,5 @@ --- -title: Syntax Highlighting +title: Syntax highlighting description: Hugo comes with really fast syntax highlighting from Chroma. keywords: [highlighting,chroma,code blocks,syntax] categories: [content management] @@ -14,13 +14,13 @@ aliases: [/extras/highlighting/,/extras/highlight/,/tools/syntax-highlighting/] Hugo uses [Chroma](https://github.com/alecthomas/chroma) as its code highlighter; it is built in Go and is really, really fast. -## Configure Syntax Highlighter +## Configure syntax highlighter See [Configure Highlight](/getting-started/configuration-markup#highlight). -## Generate Syntax Highlighter CSS +## Generate syntax highlighter CSS -If you run with `markup.highlight.noClasses=false` in your site config, you need a style sheet. +If you run with `markup.highlight.noClasses=false` in your site configuration, you need a style sheet. You can generate one with Hugo: @@ -30,20 +30,20 @@ hugo gen chromastyles --style=monokai > syntax.css Run `hugo gen chromastyles -h` for more options. See https://xyproto.github.io/splash/docs/ for a gallery of available styles. -## Highlight Shortcode +## Highlight shortcode -Highlighting is carried out via the built-in [`highlight` shortcode](https://gohugo.io/content-management/shortcodes/#highlight). It takes exactly one required parameter for the programming language to be highlighted and requires a closing shortcode. +Highlighting is carried out via the built-in [`highlight` shortcode](/content-management/shortcodes/#highlight). It takes exactly one required parameter for the programming language to be highlighted and requires a closing shortcode. Options: -* `linenos`: configure line numbers. Valid values are `true`, `false`, `table`, or `inline`. `false` will turn off line numbers if it's configured to be on in site config. `table` will give copy-and-paste friendly code blocks. +* `linenos`: configure line numbers. Valid values are `true`, `false`, `table`, or `inline`. `false` will turn off line numbers if it's configured to be on in site configuration. `table` will give copy-and-paste friendly code blocks. * `hl_lines`: lists a set of line numbers or line number ranges to be highlighted. * `linenostart=199`: starts the line number count from 199. * `anchorlinenos`: Configure anchors on line numbers. Valid values are `true` or `false`; * `lineanchors`: Configure a prefix for the anchors on line numbers. Will be suffixed with `-`, so linking to the line number 1 with the option `lineanchors=prefix` adds the anchor `prefix-1` to the page. * `hl_inline` Highlight inside a `<code>` (inline HTML element) tag. Valid values are `true` or `false`. The `code` tag will get a class with name `code-inline`. {{< new-in "0.101.0" >}} -### Example: Highlight Shortcode +### Example: highlight shortcode ```go-html-template {{</* highlight go "linenos=table,hl_lines=8 15-17,linenostart=199" */>}} @@ -76,9 +76,9 @@ func GetTitleFunc(style string) func(s string) string { } {{< / highlight >}} -## Highlight Hugo/GO Template Code +## Highlight Hugo/Go template code -For highlighting Hugo/GO template code on your page, add `/*` after the opening double curly braces and `*/` before closing curly braces. +For highlighting Hugo/Go template code on your page, add `/*` after the opening double curly braces and `*/` before closing curly braces. ``` go {{</*/* myshortcode */*/>}} @@ -90,11 +90,11 @@ Gives this: {{</* myshortcode */>}} ``` -## Highlight Template Func +## Highlight template function See [Highlight](/functions/highlight/). -## Highlighting in Code Fences +## Highlighting in code fences Highlighting in code fences is enabled by default. @@ -132,7 +132,7 @@ func GetTitleFunc(style string) func(s string) string { The options are the same as in the [highlighting shortcode](/content-management/syntax-highlighting/#highlight-shortcode), including `linenos=false`, but note the slightly different Markdown attribute syntax. -## List of Chroma Highlighting Languages +## List of Chroma highlighting languages The full list of Chroma lexers and their aliases (which is the identifier used in the `highlight` template func or when doing highlighting in code fences): diff --git a/docs/content/en/content-management/taxonomies.md b/docs/content/en/content-management/taxonomies.md index a532e1873..45b368c7f 100644 --- a/docs/content/en/content-management/taxonomies.md +++ b/docs/content/en/content-management/taxonomies.md @@ -12,7 +12,7 @@ weight: 150 aliases: [/taxonomies/overview/,/taxonomies/usage/,/indexes/overview/,/doc/indexes/,/extras/indexes] --- -## What is a Taxonomy? +## What is a taxonomy? Hugo includes support for user-defined groupings of content called **taxonomies**. Taxonomies are classifications of logical relationships between content. @@ -28,7 +28,7 @@ Value : a piece of content assigned to a term -## Example Taxonomy: Movie Website +## Example taxonomy: movie website Let's assume you are making a website about movies. You may want to include the following taxonomies: @@ -41,7 +41,7 @@ Let's assume you are making a website about movies. You may want to include the Then, in each of the movies, you would specify terms for each of these taxonomies (i.e., in the [front matter] of each of your movie content files). From these terms, Hugo would automatically create pages for each Actor, Director, Studio, Genre, Year, and Award, with each listing all of the Movies that matched that specific Actor, Director, Studio, Genre, Year, and Award. -### Movie Taxonomy Organization +### Movie taxonomy organization To continue with the example of a movie site, the following demonstrates content relationships from the perspective of the taxonomy: @@ -76,11 +76,11 @@ Moonrise Kingdom <- Value ... ``` -## Hugo Taxonomy Defaults {#default-taxonomies} +## Default taxonomies Hugo natively supports taxonomies. -Without adding a single line to your [site config][config] file, Hugo will automatically create taxonomies for `tags` and `categories`. That would be the same as manually [configuring your taxonomies](#configure-taxonomies) as below: +Without adding a single line to your [site configuration] file, Hugo will automatically create taxonomies for `tags` and `categories`. That would be the same as manually [configuring your taxonomies](#configure-taxonomies) as below: {{< code-toggle file="hugo" copy=false >}} [taxonomies] @@ -88,7 +88,7 @@ Without adding a single line to your [site config][config] file, Hugo will autom category = "categories" {{</ code-toggle >}} -If you do not want Hugo to create any taxonomies, set `disableKinds` in your [site config][config] to the following: +If you do not want Hugo to create any taxonomies, set `disableKinds` in your [site configuration] to the following: {{< code-toggle file="hugo" copy=false >}} disableKinds = ["taxonomy","term"] @@ -96,18 +96,18 @@ disableKinds = ["taxonomy","term"] {{% page-kinds %}} -### Default Destinations +### Default destinations When taxonomies are used---and [taxonomy templates] are provided---Hugo will automatically create both a page listing all the taxonomy's terms and individual pages with lists of content associated with each term. For example, a `categories` taxonomy declared in your configuration and used in your content front matter will create the following pages: * A single page at `example.com/categories/` that lists all the [terms within the taxonomy] * [Individual taxonomy list pages][taxonomy templates] (e.g., `/categories/development/`) for each of the terms that shows a listing of all pages marked as part of that taxonomy within any content file's [front matter] -## Configure Taxonomies +## Configure taxonomies -Custom taxonomies other than the [defaults](#default-taxonomies) must be defined in your [site config][config] before they can be used throughout the site. You need to provide both the plural and singular labels for each taxonomy. For example, `singular key = "plural value"` for TOML and `singular key: "plural value"` for YAML. +Custom taxonomies other than the [defaults](#default-taxonomies) must be defined in your [site configuration] before they can be used throughout the site. You need to provide both the plural and singular labels for each taxonomy. For example, `singular key = "plural value"` for TOML and `singular key: "plural value"` for YAML. -### Example: Adding a custom taxonomy named "series" +### Example: adding a custom taxonomy named "series" {{% note %}} While adding custom taxonomies, you need to put in the default taxonomies too, _if you want to keep them_. @@ -120,9 +120,9 @@ While adding custom taxonomies, you need to put in the default taxonomies too, _ series = "series" {{</ code-toggle >}} -### Example: Removing default taxonomies +### Example: removing default taxonomies -If you want to have just the default `tags` taxonomy, and remove the `categories` taxonomy for your site, you can do so by modifying the `taxonomies` value in your [site config][config]. +If you want to have just the default `tags` taxonomy, and remove the `categories` taxonomy for your site, you can do so by modifying the `taxonomies` value in your [site configuration]. {{< code-toggle file="hugo" copy=false >}} [taxonomies] @@ -143,7 +143,7 @@ The configuration option `preserveTaxonomyNames` was removed in Hugo 0.55. You can now use `.Page.Title` on the relevant taxonomy node to get the original value. {{% /note %}} -## Add Taxonomies to Content +## Add taxonomies to content Once a taxonomy is defined at the site level, any piece of content can be assigned to it, regardless of [content type] or [content section]. @@ -153,7 +153,7 @@ Assigning content to a taxonomy is done in the [front matter]. Simply create a v If you would like the ability to quickly generate content files with preconfigured taxonomies or terms, read the docs on [Hugo archetypes](/content-management/archetypes/). {{% /note %}} -### Example: Front Matter with Taxonomies +### Example: front matter with taxonomies {{< code-toggle file="content/example.md" fm=true copy=false >}} title = "Hugo: A fast and flexible static site generator" @@ -164,13 +164,13 @@ slug = "hugo" project_url = "https://github.com/gohugoio/hugo" {{</ code-toggle >}} -## Order Taxonomies +## Order taxonomies A content file can assign weight for each of its associate taxonomies. Taxonomic weight can be used for sorting or ordering content in [taxonomy list templates] and is declared in a content file's [front matter]. The convention for declaring taxonomic weight is `taxonomyname_weight`. The following show a piece of content that has a weight of 22, which can be used for ordering purposes when rendering the pages assigned to the "a", "b" and "c" values of the `tags` taxonomy. It has also been assigned the weight of 44 when rendering the "d" category page. -### Example: Taxonomic `weight` +### Example: taxonomic `weight` {{< code-toggle copy=false >}} title = "foo" @@ -186,7 +186,7 @@ By using taxonomic weight, the same piece of content can appear in different pos Currently taxonomies only support the [default `weight => date` ordering of list content](/templates/lists/#default-weight--date--linktitle--filepath). For more information, see the documentation on [taxonomy templates](/templates/taxonomy-templates/). {{% /note %}} -## Add custom metadata to a Taxonomy or Term +## Add custom metadata to a taxonomy or term If you need to add custom metadata to your taxonomy terms, you will need to create a page for that term at `/content/<TAXONOMY>/<TERM>/_index.md` and add your metadata in its front matter. Continuing with our 'Actors' example, let's say you want to add a Wikipedia page link to each actor. Your terms pages would be something like this: @@ -203,4 +203,4 @@ wikipedia: "https://en.wikipedia.org/wiki/Bruce_Willis" [taxonomy list templates]: /templates/taxonomy-templates/#taxonomy-list-templates [taxonomy templates]: /templates/taxonomy-templates/ [terms within the taxonomy]: /templates/taxonomy-templates/#taxonomy-terms-templates "See how to order terms associated with a taxonomy" -[config]: /getting-started/configuration/ +[configuration]: /getting-started/configuration/ diff --git a/docs/content/en/content-management/toc.md b/docs/content/en/content-management/toc.md index 4215107fb..e1f24378e 100644 --- a/docs/content/en/content-management/toc.md +++ b/docs/content/en/content-management/toc.md @@ -1,5 +1,5 @@ --- -title: Table of Contents +title: Table of contents description: Hugo can automatically parse Markdown content and create a Table of Contents you can use in your templates. categories: [content management] keywords: [table of contents, toc] @@ -44,7 +44,7 @@ Hugo will take this Markdown and create a table of contents from `## Introductio The built-in `.TableOfContents` variables outputs a `<nav id="TableOfContents">` element with a child `<ul>`, whose child `<li>` elements begin with appropriate HTML headings. See [the available settings](/getting-started/configuration-markup/#table-of-contents) to configure what heading levels you want to include in TOC. -## Template Example: Basic TOC +## Template example: basic TOC The following is an example of a very basic [single page template]: @@ -64,7 +64,7 @@ The following is an example of a very basic [single page template]: {{ end }} {{< /code >}} -## Template Example: TOC Partial +## Template example: TOC partial The following is a [partial template][partials] that adds slightly more logic for page-level control over your table of contents. It assumes you are using a `toc` field in your content's [front matter] that, unless specifically set to `false`, will add a TOC to any page with a `.WordCount` (see [Page Variables][pagevars]) greater than 400. This example also demonstrates how to use [conditionals] in your templating: @@ -92,7 +92,7 @@ In the header of your content file, specify the AsciiDoc TOC directives necessar ```asciidoc // <!-- Your front matter up here --> :toc: -// Set toclevels to be at least your hugo [markup.tableOfContents.endLevel] config key +// Set toclevels to be at least your hugo [markup.tableOfContents.endLevel] configuration key :toclevels: 4 == Introduction diff --git a/docs/content/en/content-management/types.md b/docs/content/en/content-management/types.md index fc79ca58c..e72361f1c 100644 --- a/docs/content/en/content-management/types.md +++ b/docs/content/en/content-management/types.md @@ -1,5 +1,5 @@ --- -title: Content Types +title: Content types description: Hugo is built around content organized in sections. categories: [content management] keywords: [lists, sections, content types, types, organization] @@ -16,5 +16,5 @@ A **content type** is a way to organize your content. Hugo resolves the content A content type is used to -- Determine how the content is rendered. See [Template Lookup Order](/templates/lookup-order/) and [Content Views](https://gohugo.io/templates/views) for more. +- Determine how the content is rendered. See [Template Lookup Order](/templates/lookup-order/) and [Content Views](/templates/views) for more. - Determine which [archetype](/content-management/archetypes/) template to use for new content. diff --git a/docs/content/en/content-management/urls.md b/docs/content/en/content-management/urls.md index 25f6f19ed..5b8218f64 100644 --- a/docs/content/en/content-management/urls.md +++ b/docs/content/en/content-management/urls.md @@ -1,5 +1,5 @@ --- -title: URL Management +title: URL management description: Control the structure and appearance of URLs through front matter entries and settings in your site configuration. categories: [content management] keywords: [aliases,redirects,permalinks,urls] @@ -93,7 +93,7 @@ In your site configuration, define a URL pattern for each top-level section. Eac Front matter `url` values override the URL patterns defined in the `permalinks` section of your site configuration. -[page kind]: https://gohugo.io/templates/section-templates/#page-kinds +[page kind]: /templates/section-templates/#page-kinds #### Monolingual examples {#permalinks-monolingual-examples} @@ -271,10 +271,10 @@ Use these tokens when defining the URL pattern. The `date` field in front matter : the content's slug (or title if no slug is provided in the front matter) `:slugorfilename` -: the content's slug (or filename if no slug is provided in the front matter) +: the content's slug (or file name if no slug is provided in the front matter) `:filename` -: the content's filename (without extension) +: the content's file name (without extension) For time-related values, you can also use the layout string components defined in Go's [time package]. For example: @@ -383,7 +383,7 @@ In a multilingual site, use a directory-relative alias, or include the language aliases = ['/de/posts/previous-file-name'] {{< /code-toggle >}} -### How Aliases Work +### How aliases work Using the first example above, Hugo generates the following site structure: diff --git a/docs/content/en/contribute/_index.md b/docs/content/en/contribute/_index.md index cb6ca2966..77a5cdb4d 100644 --- a/docs/content/en/contribute/_index.md +++ b/docs/content/en/contribute/_index.md @@ -1,14 +1,15 @@ --- -title: Contribute to the Hugo Project -linktitle: Contribute to Hugo +title: Contribute to the Hugo project +linkTitle: Overview description: Contribute to Hugo development and documentation. categories: [contribute] keywords: [] menu: docs: + identifier: contribute-overview parent: contribute - weight: 01 -weight: 01 + weight: 10 +weight: 10 aliases: [/tutorials/how-to-contribute-to-hugo/,/community/contributing/] --- diff --git a/docs/content/en/contribute/development.md b/docs/content/en/contribute/development.md index c40b334ba..7bc201288 100644 --- a/docs/content/en/contribute/development.md +++ b/docs/content/en/contribute/development.md @@ -1,14 +1,14 @@ --- -title: Contribute to Hugo Development -linktitle: Development +title: Contribute to development +linkTitle: Development description: Hugo relies heavily on contributions from the open source community. categories: [contribute] keywords: [dev,open source] menu: docs: parent: contribute - weight: 10 -weight: 10 + weight: 20 +weight: 20 toc: true --- @@ -33,7 +33,7 @@ The installation of Go should take only a few minutes. You have more than one op If you are having trouble following the installation guides for Go, check out [Go Bootcamp, which contains setups for every platform][gobootcamp] or reach out to the Hugo community in the [Hugo Discussion Forums][forums]. -### Install Go From Source +### Install Go from source [Download the latest stable version of Go][godl] and follow the official [Go installation guide][goinstall]. @@ -71,11 +71,11 @@ More experienced users can use the [Go Version Manager][gvm] (GVM). GVM allows y GVM comes in especially handy if you follow the development of Hugo over a longer period of time. Future versions of Hugo will usually be compiled with the latest version of Go. Sooner or later, you will have to upgrade if you want to keep up. -## Create a GitHub Account +## Create a GitHub account If you're going to contribute code, you'll need to have an account on GitHub. Go to [www.github.com/join](https://github.com/join) and set up a personal account. -## Install Git on Your System +## Install Git on your system You will need to have Git installed on your computer to contribute to Hugo development. Teaching Git is outside the scope of the Hugo docs, but if you're looking for an excellent reference to learn the basics of Git, we recommend the [Git book][gitbook] if you are not sure where to begin. We will include short explanations of the Git commands in this document. @@ -87,11 +87,11 @@ Move back to the terminal and check if Git is already installed. Type in `git ve Finally, check again with `git version` if Git was installed successfully. -### Git Graphical Front Ends +### Git graphical front ends There are several [GUI clients](https://git-scm.com/downloads/guis) that help you to operate Git. Not all are available for all operating systems and maybe differ in their usage. Because of this we will document how to use the command-line, since the commands are the same everywhere. -### Install Hub on Your System (Optional) +### Install Hub on your system (optional) Hub is a great tool for working with GitHub. The main site for it is [hub.github.com](https://hub.github.com/). Feel free to install this little Git wrapper. @@ -208,7 +208,7 @@ origin https://github.com/gohugoio/hugo (fetch) origin https://github.com/gohugoio/hugo (push) ``` -## The Hugo Git Contribution Workflow +## The Hugo Git contribution workflow ### Create a new branch @@ -229,7 +229,7 @@ git checkout -b <BRANCH-NAME> You can check on which branch you are with `git branch`. You should see a list of all local branches. The current branch is indicated with a little asterisk. -### Contribute to Documentation +### Contribute to documentation Perhaps you want to start contributing to the Hugo docs. If so, you can ignore most of the following steps and focus on the `/docs` directory within your newly cloned repository. You can change directories into the Hugo docs using `cd docs`. @@ -408,7 +408,7 @@ Thank you for reading through this contribution guide. Hopefully, we will see yo Feel free to [open an issue][newissue] if you think you found a bug or you have a new idea to improve Hugo. We are happy to hear from you. -## Additional References for Learning Git and Go +## Additional references for learning Git and Go * [Codecademy's Free "Learn Git" Course][codecademy] (Free) * [Code School and GitHub's "Try Git" Tutorial][trygit] (Free) diff --git a/docs/content/en/contribute/documentation.md b/docs/content/en/contribute/documentation.md index 4583f7cf4..03939f837 100644 --- a/docs/content/en/contribute/documentation.md +++ b/docs/content/en/contribute/documentation.md @@ -1,15 +1,15 @@ --- -title: Contribute to the Hugo Docs -linktitle: Documentation +title: Contribute to documentation +linkTitle: Documentation description: Documentation is an integral part of any open source project. The Hugo documentation is as much a work in progress as the source it attempts to cover. categories: [contribute] keywords: [docs,documentation,community, contribute] menu: docs: parent: contribute - weight: 20 + weight: 30 toc: true -weight: 20 +weight: 30 aliases: [/contribute/docs/] --- diff --git a/docs/content/en/contribute/themes.md b/docs/content/en/contribute/themes.md index adfc38cc2..0371f7f8c 100644 --- a/docs/content/en/contribute/themes.md +++ b/docs/content/en/contribute/themes.md @@ -1,14 +1,14 @@ --- -title: Add Your Hugo Theme to the Showcase -linktitle: Themes +title: Add your hugo theme to the showcase +linkTitle: Themes description: If you've built a Hugo theme and want to contribute back to the Hugo Community, share it with us. categories: [contribute] keywords: [contribute,themes,design] menu: docs: parent: contribute - weight: 30 -weight: 30 + weight: 40 +weight: 40 aliases: [/contribute/theme/] toc: true --- @@ -17,7 +17,7 @@ A collection of all themes created by the Hugo community, including screenshots Another great site for Hugo themes is [jamstackthemes.dev/](https://jamstackthemes.dev/ssg/hugo/). -### Add Your Theme to the Repo +### Add your theme to the repository In order to add your Hugo theme to [themes.gohugo.io] please [open a pull request in the theme repository](https://github.com/gohugoio/hugoThemesSiteBuilder). **Please make sure that you've read the theme submission guidelines in the [README](https://github.com/gohugoio/hugoThemesSiteBuilder/blob/main/README.md#hugo-themes) of the hugoThemesSiteBuilder repository.** diff --git a/docs/content/en/documentation.md b/docs/content/en/documentation.md index 221d7c392..cf864e819 100644 --- a/docs/content/en/documentation.md +++ b/docs/content/en/documentation.md @@ -1,11 +1,11 @@ --- title: Hugo Documentation -linktitle: Hugo +linkTitle: Hugo description: Hugo is the world's fastest static website engine. It's written in Go (aka Golang) and developed by bep, spf13 and friends. menu: main: - weight: 01 -weight: 01 + weight: 1 +weight: 1 layout: documentation-home --- diff --git a/docs/content/en/functions/GetPage.md b/docs/content/en/functions/GetPage.md index f4f4405c6..17d2bd972 100644 --- a/docs/content/en/functions/GetPage.md +++ b/docs/content/en/functions/GetPage.md @@ -37,15 +37,15 @@ And since `Page` also provides a `.GetPage` method, the above is the same as: {{ end }} ``` -## .GetPage and Multilingual Sites +## .GetPage and multilingual sites -The previous examples have used the full content filename to look up the post. Depending on how you have organized your content (whether you have the language code in the file name or not, e.g. `my-post.en.md`), you may want to do the lookup without extension. This will get you the current language's version of the page: +The previous examples have used the full content file name to look up the post. Depending on how you have organized your content (whether you have the language code in the file name or not, e.g. `my-post.en.md`), you may want to do the lookup without extension. This will get you the current language's version of the page: ```go-html-template {{ with .Site.GetPage "/blog/my-post" }}{{ .Title }}{{ end }} ``` -## .GetPage Example +## .GetPage example This code snippet---in the form of a [partial template][partials]---allows you to do the following: @@ -63,7 +63,7 @@ This code snippet---in the form of a [partial template][partials]---allows you t </ul> {{< /code >}} -## `.GetPage` on Page Bundles +## `.GetPage` on page bundles If the page retrieved by `.GetPage` is a [Leaf Bundle][leaf_bundle], and you need to get the nested _**page** resources_ in that, you will need to use the diff --git a/docs/content/en/functions/_index.md b/docs/content/en/functions/_index.md index fd45fb6dd..4f8aa47ca 100644 --- a/docs/content/en/functions/_index.md +++ b/docs/content/en/functions/_index.md @@ -1,11 +1,14 @@ --- -title: Functions Quick Reference +title: Functions +linkTitle: Overview description: Comprehensive list of Hugo templating functions, including basic and advanced usage examples. keywords: [] menu: docs: + identifier: functions-overview parent: functions -weight: 01 + weight: 10 +weight: 10 aliases: [/layout/functions/,/templates/functions] --- diff --git a/docs/content/en/functions/after.md b/docs/content/en/functions/after.md index b608784e3..5318d3b0c 100644 --- a/docs/content/en/functions/after.md +++ b/docs/content/en/functions/after.md @@ -20,7 +20,7 @@ The following shows `after` being used in conjunction with the [`slice` function → ["three", "four"] ``` -## Example of `after` with `first`: 2nd–4th Most Recent Articles +## Example of `after` with `first`: 2nd–4th most recent articles You can use `after` in combination with the [`first` function] and Hugo's [powerful sorting methods][lists]. Let's assume you have a list page at `example.com/articles`. You have 10 articles, but you want your templating for the [list/section page] to show only two rows: diff --git a/docs/content/en/functions/anchorize.md b/docs/content/en/functions/anchorize.md index cf04a9640..bdf322a6e 100644 --- a/docs/content/en/functions/anchorize.md +++ b/docs/content/en/functions/anchorize.md @@ -1,6 +1,6 @@ --- title: anchorize -description: Takes a string and sanitizes it the same way as the [`defaultMarkdownHandler`](https://gohugo.io/getting-started/configuration-markup#configure-markup) does for markdown headers. +description: Takes a string and sanitizes it the same way as the [`defaultMarkdownHandler`](/getting-started/configuration-markup#configure-markup) does for markdown headers. categories: [functions] menu: docs: @@ -10,7 +10,7 @@ signature: ["anchorize INPUT"] relatedfuncs: [humanize] --- -If [Goldmark](https://gohugo.io/getting-started/configuration-markup#goldmark) is set as `defaultMarkdownHandler`, the sanitizing logic adheres to the setting [`markup.goldmark.parser.autoHeadingIDType`](https://gohugo.io/getting-started/configuration-markup#goldmark). +If [Goldmark](/getting-started/configuration-markup#goldmark) is set as `defaultMarkdownHandler`, the sanitizing logic adheres to the setting [`markup.goldmark.parser.autoHeadingIDType`](/getting-started/configuration-markup#goldmark). Since the `defaultMarkdownHandler` and this template function use the same sanitizing logic, you can use the latter to determine the ID of a header for linking with anchor tags. diff --git a/docs/content/en/functions/apply.md b/docs/content/en/functions/apply.md index 0bc071e7b..b9dbd81e7 100644 --- a/docs/content/en/functions/apply.md +++ b/docs/content/en/functions/apply.md @@ -1,6 +1,6 @@ --- title: apply -description: Given a map, array, or slice, `apply` returns a new slice with a function applied over it. +description: Given an array or slice, `apply` returns a new slice with a function applied over it. categories: [functions] menu: docs: diff --git a/docs/content/en/functions/dict.md b/docs/content/en/functions/dict.md index 27a786bec..d4fbc1bea 100644 --- a/docs/content/en/functions/dict.md +++ b/docs/content/en/functions/dict.md @@ -18,7 +18,7 @@ Note that the `key` can be either a `string` or a `string slice`. The latter is {{ $m := dict (slice "a" "b" "c") "value" }} ``` -## Example: Using `dict` to pass multiple values to a `partial` +## Example: using `dict` to pass multiple values to a `partial` The partial below creates an SVG and expects `fill`, `height` and `width` from the caller: diff --git a/docs/content/en/functions/emojify.md b/docs/content/en/functions/emojify.md index 45753af13..beded710a 100644 --- a/docs/content/en/functions/emojify.md +++ b/docs/content/en/functions/emojify.md @@ -14,12 +14,12 @@ relatedfuncs: [] See the [Emoji cheat sheet][emojis] for available emoticons. -The `emojify` function can be called in your templates but not directly in your content files by default. For emojis in content files, set `enableEmoji` to `true` in your site's [configuration][config]. Then you can write emoji shorthand directly into your content files; e.g. <code>I :</code><code>heart</code><code>: Hugo!</code>: +The `emojify` function can be called in your templates but not directly in your content files by default. For emojis in content files, set `enableEmoji` to `true` in your site's [configuration]. Then you can write emoji shorthand directly into your content files; e.g. <code>I :</code><code>heart</code><code>: Hugo!</code>: I :heart: Hugo! -[config]: /getting-started/configuration/ +[configuration]: /getting-started/configuration/ [emojis]: https://www.webfx.com/tools/emoji-cheat-sheet/ [sc]: /templates/shortcode-templates/ [scsource]: https://github.com/gohugoio/hugo/tree/master/docs/layouts/shortcodes diff --git a/docs/content/en/functions/errorf.md b/docs/content/en/functions/errorf.md index b3e0fd280..8caaf0554 100644 --- a/docs/content/en/functions/errorf.md +++ b/docs/content/en/functions/errorf.md @@ -40,6 +40,6 @@ This will produce: ``` ERROR 2021/06/07 17:47:38 You should consider fixing this. -If you feel that this should not be logged as an ERROR, you can ignore it by adding this to your site config: +If you feel that this should not be logged as an ERROR, you can ignore it by adding this to your site configuration: ignoreErrors = ["my-custom-error"] ``` diff --git a/docs/content/en/functions/format.md b/docs/content/en/functions/format.md index af34cbf7e..d30f0bdf2 100644 --- a/docs/content/en/functions/format.md +++ b/docs/content/en/functions/format.md @@ -25,7 +25,7 @@ Assuming a key-value of `date: 2017-03-03` in a content file's front matter, you For formatting *any* string representations of dates defined in your front matter, see the [`dateFormat` function][dateFormat], which will still leverage the Go layout string explained below but uses a slightly different syntax. -## Go's Layout String +## Go's layout string Hugo templates [format your dates][time] via layout strings that point to a specific reference time: @@ -42,7 +42,7 @@ Here is a visual explanation [taken directly from the Go docs][gdex]: => 1 2 3 4 5 6 -7 ``` -### Hugo Date and Time Templating Reference +### Hugo date and time templating reference The following examples show the layout string followed by the rendered output. @@ -84,7 +84,7 @@ date: 2017-03-03T14:15:59-06:00 More examples can be found in Go's [documentation for the time package][timeconst]. -### Cardinal Numbers and Ordinal Abbreviations +### Cardinal s Spelled-out cardinal numbers (e.g. "one", "two", and "three") are not currently supported. diff --git a/docs/content/en/functions/hasPrefix.md b/docs/content/en/functions/hasPrefix.md index cf29315e2..264044577 100644 --- a/docs/content/en/functions/hasPrefix.md +++ b/docs/content/en/functions/hasPrefix.md @@ -1,6 +1,5 @@ --- title: hasprefix -linktitle: hasPrefix description: Tests whether a string begins with prefix. date: 2017-02-01 publishdate: 2017-02-01 diff --git a/docs/content/en/functions/hasSuffix.md b/docs/content/en/functions/hasSuffix.md index 9906cc2c3..5ab38866d 100644 --- a/docs/content/en/functions/hasSuffix.md +++ b/docs/content/en/functions/hasSuffix.md @@ -1,6 +1,6 @@ --- title: hassuffix -linktitle: hasSuffix +linkTitle: hasSuffix description: Tests whether a string ends with suffix. date: 2023-03-01 publishdate: 2023-03-01 @@ -18,4 +18,4 @@ deprecated: false aliases: [] --- -* `{{ hasSuffix "Hugo" "go" }}` → true
\ No newline at end of file +* `{{ hasSuffix "Hugo" "go" }}` → true diff --git a/docs/content/en/functions/highlight.md b/docs/content/en/functions/highlight.md index 2ca125467..1a47fe37f 100644 --- a/docs/content/en/functions/highlight.md +++ b/docs/content/en/functions/highlight.md @@ -91,8 +91,8 @@ Instead of specifying both `lineNos` and `lineNumbersInTable`, you can use the f {{ $input := `echo "Hello World!"` }} {{ $lang := "bash" }} -{{ $options := slice "lineNos=table" "style=dracula" }} -{{ transform.Highlight $input $lang (delimit $options ",") }} +{{ $options := dict "lineNos" "table" "style" "dracula" }} +{{ transform.Highlight $input $lang $options }} ``` [Chroma]: https://github.com/alecthomas/chroma diff --git a/docs/content/en/functions/images/index.md b/docs/content/en/functions/images/index.md index 9cd772e5b..4a04ce0ac 100644 --- a/docs/content/en/functions/images/index.md +++ b/docs/content/en/functions/images/index.md @@ -1,5 +1,5 @@ --- -title: Image Filters +title: Image filters description: The images namespace provides a list of filters and other image related functions. categories: [functions] aliases: [/functions/imageconfig/] diff --git a/docs/content/en/functions/index-function.md b/docs/content/en/functions/index-function.md index 6fb9f0fec..e5ba47262 100644 --- a/docs/content/en/functions/index-function.md +++ b/docs/content/en/functions/index-function.md @@ -37,7 +37,7 @@ You may write multiple indices as a slice: {{ index $map $slice }} => 20 ``` -## Example: Load Data from a Path Based on Front Matter Params +## Example: load data from a path based on front matter parameters Assume you want to add a `location = ""` field to your front matter for every article written in `content/vacations/`. You want to use this field to populate information about the location at the bottom of the article in your `single.html` template. You also have a directory in `data/locations/` that looks like the following: diff --git a/docs/content/en/functions/intersect.md b/docs/content/en/functions/intersect.md index 99ab0943e..9c3ed6292 100644 --- a/docs/content/en/functions/intersect.md +++ b/docs/content/en/functions/intersect.md @@ -19,7 +19,7 @@ A useful example is to use it as `AND` filters when combined with where: {{ $pages := $pages | intersect (where .Site.RegularPages "Params.images" "!=" nil) }} ``` -The above fetches regular pages not of `page` or `about` type unless they are pinned. And finally, we exclude all pages with no `images` set in Page params. +The above fetches regular pages not of `page` or `about` type unless they are pinned. And finally, we exclude all pages with no `images` set in Page parameters. See [union](/functions/union) for `OR`. diff --git a/docs/content/en/functions/isset.md b/docs/content/en/functions/isset.md index 9c00c15fc..0a8de7367 100644 --- a/docs/content/en/functions/isset.md +++ b/docs/content/en/functions/isset.md @@ -17,6 +17,6 @@ Takes either a slice, array, or channel and an index or a map and a key as input ``` {{% note %}} -All site-level configuration keys are stored as lower case. Therefore, a `myParam` key-value set in your [site configuration file](/getting-started/configuration/) needs to be accessed with `{{ if isset .Site.Params "myparam" }}` and *not* with `{{ if isset .Site.Params "myParam" }}`. Note that you can still access the same config key with `.Site.Params.myParam` *or* `.Site.Params.myparam`, for example, when using [`with`](/functions/with). +All site-level configuration keys are stored as lower case. Therefore, a `myParam` key-value set in your [site configuration file](/getting-started/configuration/) needs to be accessed with `{{ if isset .Site.Params "myparam" }}` and *not* with `{{ if isset .Site.Params "myParam" }}`. Note that you can still access the same configuration key with `.Site.Params.myParam` *or* `.Site.Params.myparam`, for example, when using [`with`](/functions/with). This restriction also applies when accessing page-level front matter keys from within [shortcodes](/content-management/shortcodes/). {{% /note %}} diff --git a/docs/content/en/functions/math.md b/docs/content/en/functions/math.md index c36b8ea0b..708921f68 100644 --- a/docs/content/en/functions/math.md +++ b/docs/content/en/functions/math.md @@ -11,24 +11,26 @@ signature: [] relatedfuncs: [] --- -| Function | Description | Example | -|--------------|-----------------------------------------------------------------------------|-------------------------------------| -| `add` | Adds two or more numbers. | `{{ add 12 3 2 }}` → `17` | -| | *If one of the numbers is a float, the result is a float.* | `{{ add 1.1 2 }}` → `3.1` | -| `sub` | Subtracts one or more numbers from the first number. | `{{ sub 12 3 2 }}` → `7` | -| | *If one of the numbers is a float, the result is a float.* | `{{ sub 3 2.5 }}` → `0.5` | -| `mul` | Multiplies two or more numbers. | `{{ mul 12 3 2 }}` → `72` | -| | *If one of the numbers is a float, the result is a float.* | `{{ mul 2 3.1 }}` → `6.2` | -| `div` | Divides the first number by one or more numbers. | `{{ div 12 3 2 }}` → `2` | -| | *If one of the numbers is a float, the result is a float.* | `{{ div 6 4.0 }}` → `1.5` | -| `mod` | Modulus of two integers. | `{{ mod 15 3 }}` → `0` | -| `modBool` | Boolean of modulus of two integers. Evaluates to `true` if result equals 0. | `{{ modBool 15 3 }}` → `true` | -| `math.Abs` | Returns the absolute value of the given number. | `{{ math.Abs -2.1 }}` → `2.1` | -| `math.Ceil` | Returns the least integer value greater than or equal to the given number. | `{{ math.Ceil 2.1 }}` → `3` | -| `math.Floor` | Returns the greatest integer value less than or equal to the given number. | `{{ math.Floor 1.9 }}` → `1` | -| `math.Log` | Returns the natural logarithm of the given number. | `{{ math.Log 42 }}` → `3.737` | -| `math.Max` | Returns the greater of two or more numbers. | `{{ math.Max 12 3 2 }}` → `12` | -| `math.Min` | Returns the smaller of two or more numbers. | `{{ math.Min 12 3 2 }}` → `2` | -| `math.Pow` | Returns the first number raised to the power of the second number. | `{{ math.Pow 2 3 }}` → `8` | -| `math.Round` | Returns the nearest integer, rounding half away from zero. | `{{ math.Round 1.5 }}` → `2` | -| `math.Sqrt` | Returns the square root of the given number. | `{{ math.Sqrt 81 }}` → `9` | +| Function | Description | Example | +|-----------------|-----------------------------------------------------------------------------|---------------------------------------------------| +| `add` | Adds two or more numbers. | `{{ add 12 3 2 }}` → `17` | +| | *If one of the numbers is a float, the result is a float.* | `{{ add 1.1 2 }}` → `3.1` | +| `sub` | Subtracts one or more numbers from the first number. | `{{ sub 12 3 2 }}` → `7` | +| | *If one of the numbers is a float, the result is a float.* | `{{ sub 3 2.5 }}` → `0.5` | +| `mul` | Multiplies two or more numbers. | `{{ mul 12 3 2 }}` → `72` | +| | *If one of the numbers is a float, the result is a float.* | `{{ mul 2 3.1 }}` → `6.2` | +| `div` | Divides the first number by one or more numbers. | `{{ div 12 3 2 }}` → `2` | +| | *If one of the numbers is a float, the result is a float.* | `{{ div 6 4.0 }}` → `1.5` | +| `mod` | Modulus of two integers. | `{{ mod 15 3 }}` → `0` | +| `modBool` | Boolean of modulus of two integers. Evaluates to `true` if result equals 0. | `{{ modBool 15 3 }}` → `true` | +| `math.Abs` | Returns the absolute value of the given number. | `{{ math.Abs -2.1 }}` → `2.1` | +| `math.Ceil` | Returns the least integer value greater than or equal to the given number. | `{{ math.Ceil 2.1 }}` → `3` | +| `math.Floor` | Returns the greatest integer value less than or equal to the given number. | `{{ math.Floor 1.9 }}` → `1` | +| `math.Log` | Returns the natural logarithm of the given number. | `{{ math.Log 42 }}` → `3.737` | +| `math.Max` | Returns the greater of all numbers. Accepts scalars, slices, or both. | `{{ math.Max 1 (slice 2 3) 4 }}` → `4` | +| `math.Min` | Returns the smaller of all numbers. Accepts scalars, slices, or both. | `{{ math.Min 1 (slice 2 3) 4 }}` → `1` | +| `math.Product` | Returns the product of all numbers. Accepts scalars, slices, or both. | `{{ math.Product 1 (slice 2 3) 4 }}` → `24` | +| `math.Pow` | Returns the first number raised to the power of the second number. | `{{ math.Pow 2 3 }}` → `8` | +| `math.Round` | Returns the nearest integer, rounding half away from zero. | `{{ math.Round 1.5 }}` → `2` | +| `math.Sqrt` | Returns the square root of the given number. | `{{ math.Sqrt 81 }}` → `9` | +| `math.Sum` | Returns the sum of all numbers. Accepts scalars, slices, or both. | `{{ math.Sum 1 (slice 2 3) 4 }}` → `10` | diff --git a/docs/content/en/functions/readdir.md b/docs/content/en/functions/readdir.md index 3ad43126a..9fc4d3013 100644 --- a/docs/content/en/functions/readdir.md +++ b/docs/content/en/functions/readdir.md @@ -1,6 +1,6 @@ --- title: readDir -description: Returns an array of FileInfo structures sorted by filename, one element for each directory entry. +description: Returns an array of FileInfo structures sorted by file name, one element for each directory entry. categories: [functions] menu: docs: diff --git a/docs/content/en/functions/safeHTMLAttr.md b/docs/content/en/functions/safeHTMLAttr.md index ac7f32d7a..bced1ba10 100644 --- a/docs/content/en/functions/safeHTMLAttr.md +++ b/docs/content/en/functions/safeHTMLAttr.md @@ -34,12 +34,16 @@ Will produce: `ZgotmplZ` is a special value, inserted by Go's [template/html] package, that indicates that unsafe content reached a CSS or URL context. -To override the safety check, use the `safeHTMLAttr` function: +To indicate that the HTML attribute is safe: ```go-html-template {{ range site.Menus.main }} <a {{ printf "href=%q" .URL | safeHTMLAttr }}>{{ .Name }}</a> {{ end }} -``` +``` + +{{% note %}} +As demonstrated above, you must pass the HTML attribute name _and_ value through the function. Applying `safeHTMLAttr` to the attribute value has no effect. +{{% /note %}} [template/html]: https://pkg.go.dev/html/template diff --git a/docs/content/en/functions/time.md b/docs/content/en/functions/time.md index 7cb55f6f1..1fb6cc350 100644 --- a/docs/content/en/functions/time.md +++ b/docs/content/en/functions/time.md @@ -19,7 +19,7 @@ relatedfuncs: [] {{ mul 1000 (time "2016-05-28T10:30:00.00+10:00").Unix }} → 1464395400000, or Unix time in milliseconds ``` -## Using Locations +## Using locations The optional `TIMEZONE` parameter is a string that sets a default time zone (or more specific, the location, which represents the collection of time offsets in a geographical area) that is associated with the specified time value. If the time value has an explicit timezone or offset specified, it will take precedence over the `TIMEZONE` parameter. @@ -33,7 +33,7 @@ If no `TIMEZONE` is set, the `timeZone` from site configuration will be used. {{ time "2020-01-20" "America/Los_Angeles" }} → 2020-01-20 00:00:00 -0800 PST ``` -## Example: Using `time` to get Month Index +## Example: Using `time` to get month index The following example takes a UNIX timestamp---set as `utimestamp: "1489276800"` in a content's front matter---converts the timestamp (string) to an integer using the [`int` function][int], and then uses [`printf`] to convert the `Month` property of `time` into an index. diff --git a/docs/content/en/functions/transform.Unmarshal.md b/docs/content/en/functions/transform.Unmarshal.md index d238565e2..ca5433761 100644 --- a/docs/content/en/functions/transform.Unmarshal.md +++ b/docs/content/en/functions/transform.Unmarshal.md @@ -27,7 +27,7 @@ In both the above examples, you get a map you can work with: The above prints `Hello Hugo`. -## CSV Options +## CSV options Unmarshal with CSV as input has some options you can set: @@ -61,7 +61,7 @@ To get the contents of `<title>` in the document below, you use `{{ .message.tit The following example lists the items of an RSS feed: ```go-html-template -{{ with resources.Get "https://example.com/rss.xml" | transform.Unmarshal }} +{{ with resources.GetRemote "https://example.com/rss.xml" | transform.Unmarshal }} {{ range .channel.item }} <strong>{{ .title | plainify | htmlUnescape }}</strong><br /> <p>{{ .description | plainify | htmlUnescape }}</p> diff --git a/docs/content/en/functions/union.md b/docs/content/en/functions/union.md index b73e06d38..86a874c91 100644 --- a/docs/content/en/functions/union.md +++ b/docs/content/en/functions/union.md @@ -36,6 +36,6 @@ This is also very useful to use as `OR` filters when combined with where: {{ $pages = $pages | intersect (where .Site.RegularPages "Params.images" "!=" nil) }} ``` -The above fetches regular pages not of `page` or `about` type unless they are pinned. And finally, we exclude all pages with no `images` set in Page params. +The above fetches regular pages not of `page` or `about` type unless they are pinned. And finally, we exclude all pages with no `images` set in Page parameters. See [intersect](/functions/intersect) for `AND`. diff --git a/docs/content/en/functions/where.md b/docs/content/en/functions/where.md index 871d04e9b..af92619dc 100644 --- a/docs/content/en/functions/where.md +++ b/docs/content/en/functions/where.md @@ -73,7 +73,7 @@ The following logical operators are available with `where`: `intersect` : `true` if a given field value that is a slice/array of strings or integers contains elements in common with the matching value; it follows the same rules as the [`intersect` function][intersect]. -## Use `where` with `Booleans` +## Use `where` with boolean values When using booleans you should not put quotation marks. ```go-html-template {{ range where .Pages "Draft" true }} @@ -116,7 +116,7 @@ then ranges through only the first 5 posts in that list: {{ end }} {{< /code >}} -## Nest `where` Clauses +## Nest `where` clauses You can also nest `where` clauses to drill down on lists of content by more than one parameter. The following first grabs all pages in the "blog" section and then ranges through the result of the first `where` clause and finds all pages that are *not* featured: @@ -124,7 +124,7 @@ You can also nest `where` clauses to drill down on lists of content by more than {{ range where (where .Pages "Section" "blog" ) "Params.featured" "!=" true }} ``` -## Unset Fields +## Unset fields Filtering only works for set fields. To check whether a field is set or exists, you can use the operand `nil`. @@ -153,8 +153,7 @@ section names to hard-coded values like `"posts"` or `"post"`. {{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} ``` -If the user has not set this config parameter in their site config, it -will default to the *section with the most pages*. +If the user has not set this configuration parameter in their site configuration, it will default to the *section with the most pages*. The user can override the default: diff --git a/docs/content/en/getting-started/_index.md b/docs/content/en/getting-started/_index.md index b08a949fb..3265e1782 100644 --- a/docs/content/en/getting-started/_index.md +++ b/docs/content/en/getting-started/_index.md @@ -1,14 +1,15 @@ --- -title: Get Started -linktitle: Get Started Overview +title: Getting started +linkTitle: Overview description: Quick start and guides for installing Hugo on your preferred operating system. categories: [getting started] keywords: [usage,docs] menu: docs: + identifier: getting-started-overview parent: getting-started - weight: 1 -weight: 0001 + weight: 10 +weight: 10 aliases: [/overview/introduction/] --- diff --git a/docs/content/en/getting-started/configuration-markup.md b/docs/content/en/getting-started/configuration-markup.md index 4ab6b84a0..6e384ebdc 100644 --- a/docs/content/en/getting-started/configuration-markup.md +++ b/docs/content/en/getting-started/configuration-markup.md @@ -1,14 +1,18 @@ --- -title: Configure Markup +title: Configure markup description: How to handle Markdown and other markup related configuration. -categories: [getting started,fundamentals] +categories: [fundamentals, getting started] keywords: [configuration,highlighting] -weight: 65 +menu: + docs: + parent: getting-started + weight: 50 +weight: 50 slug: configuration-markup toc: true --- -## Configure Markup +## Configure markup See [Goldmark](#goldmark) for settings related to the default Markdown handler in Hugo. @@ -91,7 +95,7 @@ For `style`, see these galleries: For CSS, see [Generate Syntax Highlighter CSS](/content-management/syntax-highlighting/#generate-syntax-highlighter-css). -### Table Of Contents +### Table of contents {{< code-toggle config="markup.tableOfContents" />}} @@ -106,6 +110,6 @@ endLevel ordered : Whether or not to generate an ordered list instead of an unordered list. -## Markdown Render Hooks +## Markdown render hooks See [Markdown Render Hooks](/templates/render-hooks/). diff --git a/docs/content/en/getting-started/configuration.md b/docs/content/en/getting-started/configuration.md index 477edc1c4..91cdebd5b 100644 --- a/docs/content/en/getting-started/configuration.md +++ b/docs/content/en/getting-started/configuration.md @@ -1,25 +1,24 @@ --- title: Configure Hugo -linktitle: Configuration +linkTitle: Configuration description: How to configure your Hugo site. -categories: [getting started,fundamentals] +categories: [fundamentals,getting started] keywords: [configuration,toml,yaml,json] menu: docs: parent: getting-started - weight: 60 -weight: 60 + weight: 40 +weight: 40 aliases: [/overview/source-directory/,/overview/configuration/] toc: true --- -## Configuration File +## Configuration file Hugo uses the `hugo.toml`, `hugo.yaml`, or `hugo.json` (if found in the site root) as the default site configuration file. -The user can choose to override that default with one or more site config files -using the command-line `--config` switch. +The user can choose to override that default with one or more site configuration files using the command-line `--config` switch. Examples: @@ -29,18 +28,18 @@ hugo --config a.toml,b.toml,c.toml ``` {{% note %}} -Multiple site config files can be specified as a comma-separated string to the `--config` switch. +Multiple site configuration files can be specified as a comma-separated string to the `--config` switch. {{% /note %}} ## hugo.toml vs config.toml -In Hugo 0.110.0 we changed the default config base filename to `hugo`, e.g. `hugo.toml`. We will still look for `config.toml` etc., but we recommend you eventually rename it (but you need to wait if you want to support older Hugo versions). The main reason we're doing this is to make it easier for code editors and build tools to identify this as a Hugo configuration file and project. +In Hugo 0.110.0 we changed the default configuration base file name to `hugo`, e.g. `hugo.toml`. We will still look for `config.toml` etc., but we recommend you eventually rename it (but you need to wait if you want to support older Hugo versions). The main reason we're doing this is to make it easier for code editors and build tools to identify this as a Hugo configuration file and project. {{< new-in "0.110.0" >}} -## Configuration Directory +## Configuration directory -In addition to using a single site config file, one can use the `configDir` directory (default to `config/`) to maintain easier organization and environment specific settings. +In addition to using a single site configuration file, one can use the `configDir` directory (default to `config/`) to maintain easier organization and environment specific settings. - Each file represents a configuration root object, such as `params.toml` for `[Params]`, `menu(s).toml` for `[Menu]`, `languages.toml` for `[Languages]` etc... - Each file's content must be top-level, for example: @@ -57,7 +56,6 @@ foo = "bar" - Each directory holds a group of files containing settings unique to an environment. - Files can be localized to become language specific. - ```txt ├── config │ ├── _default @@ -83,23 +81,23 @@ Let's take an example to understand this better. Let's say you are using Google - `G-SSSSSSSS` for staging This is how you need to configure your `hugo.toml` files considering the above scenario: -1. In `_default/hugo.toml` you don't need to mention `googleAnalytics` parameter at all. This ensures that no Google Analytics code is loaded in your development server i.e. when you run `hugo server`. This works since, by default Hugo sets `Environment=development` when you run `hugo server` which uses the config files from `_default` folder +1. In `_default/hugo.toml` you don't need to mention `googleAnalytics` parameter at all. This ensures that no Google Analytics code is loaded in your development server i.e. when you run `hugo server`. This works since, by default Hugo sets `Environment=development` when you run `hugo server` which uses the configuration files from `_default` folder 2. In `production/hugo.toml` you just need to have one line: - ```googleAnalytics = "G-PPPPPPPP"``` + ```googleAnalytics = "G-PPPPPPPP"``` - You don't need to mention all other parameters like `title`, `baseURL`, `theme` etc. again in this config file. You need to mention only those parameters which are different or new for the production environment. This is due to the fact that Hugo is going to __merge__ this on top of `_default/hugo.toml`. Now when you run `hugo` (build command), by default hugo sets `Environment=production`, so the `G-PPPPPPPP` analytics code will be there in your production website + You don't need to mention all other parameters like `title`, `baseURL`, `theme` etc. again in this configuration file. You need to mention only those parameters which are different or new for the production environment. This is due to the fact that Hugo is going to __merge__ this on top of `_default/hugo.toml`. Now when you run `hugo` (build command), by default hugo sets `Environment=production`, so the `G-PPPPPPPP` analytics code will be there in your production website 3. Similarly in `staging/hugo.toml` you just need to have one line: - ```googleAnalytics = "G-SSSSSSSS"``` + ```googleAnalytics = "G-SSSSSSSS"``` - Now you need to tell Hugo that you are using the staging environment. So your build command should be `hugo --environment staging` which will load the `G-SSSSSSSS` analytics code in your staging website + Now you need to tell Hugo that you are using the staging environment. So your build command should be `hugo --environment staging` which will load the `G-SSSSSSSS` analytics code in your staging website {{% note %}} Default environments are __development__ with `hugo server` and __production__ with `hugo`. {{%/ note %}} -## Merge Configuration from Themes +## Merge configuration from themes The configuration value for `_merge` can be one of: @@ -116,10 +114,9 @@ Note that you don't need to be so verbose as in the default setup below; a `_mer {{< code-toggle config="mergeStrategy" skipHeader=true />}} -## All Configuration Settings +## All configuration settings -The following is the full list of Hugo-defined variables. Users may choose to override those values in their site -config file(s). +The following is the full list of Hugo-defined variables. Users may choose to override those values in their site configuration file(s). ### archetypeDir @@ -165,7 +162,7 @@ See [Configure File Caches](#configure-file-caches) ### cascade -Pass down default configuration values (front matter) to pages in the content tree. The options in site config is the same as in page front matter, see [Front Matter Cascade](/content-management/front-matter#front-matter-cascade). +Pass down default configuration values (front matter) to pages in the content tree. The options in site configuration is the same as in page front matter, see [Front Matter Cascade](/content-management/front-matter#front-matter-cascade). ### canonifyURLs @@ -205,25 +202,25 @@ Content without language indicator will default to this language. ### defaultContentLanguageInSubdir -**Default value:** false +**Default value:** false Render the default content language in subdir, e.g. `content/en/`. The site root `/` will then redirect to `/en/`. ### disableAliases -**Default value:** false +**Default value:** false Will disable generation of alias redirects. Note that even if `disableAliases` is set, the aliases themselves are preserved on the page. The motivation with this is to be able to generate 301 redirects in an `.htaccess`, a Netlify `_redirects` file or similar using a custom output format. ### disableHugoGeneratorInject -**Default value:** false +**Default value:** false Hugo will, by default, inject a generator meta tag in the HTML head on the _home page only_. You can turn it off, but we would really appreciate if you don't, as this is a good way to watch Hugo's popularity on the rise. ### disableKinds -**Default value:** [] +**Default value:** [] Enable disabling of all pages of the specified *Kinds*. Allowed values in this list: `"page"`, `"home"`, `"section"`, `"taxonomy"`, `"term"`, `"RSS"`, `"sitemap"`, `"robotsTXT"`, `"404"`. @@ -235,37 +232,37 @@ Disable automatic live reloading of browser window. ### disablePathToLower -**Default value:** false +**Default value:** false Do not convert the url/path to lowercase. ### enableEmoji -**Default value:** false +**Default value:** false Enable Emoji emoticons support for page content; see the [Emoji Cheat Sheet](https://www.webpagefx.com/tools/emoji-cheat-sheet/). ### enableGitInfo -**Default value:** false +**Default value:** false Enable `.GitInfo` object for each page (if the Hugo site is versioned by Git). This will then update the `Lastmod` parameter for each page using the last git commit date for that content file. ### enableInlineShortcodes -**Default value:** false +**Default value:** false Enable inline shortcode support. See [Inline Shortcodes](/templates/shortcode-templates/#inline-shortcodes). ### enableMissingTranslationPlaceholders -**Default value:** false +**Default value:** false Show a placeholder instead of the default value or an empty string if a translation is missing. ### enableRobotsTXT -**Default value:** false +**Default value:** false Enable generation of `robots.txt` file. @@ -275,7 +272,7 @@ See [Front matter Configuration](#configure-front-matter). ### googleAnalytics -**Default value:** "" +**Default value:** "" Google Analytics tracking ID. @@ -287,11 +284,11 @@ If true, auto-detect Chinese/Japanese/Korean Languages in the content. This will ### imaging -See [Image Processing Config](/content-management/image-processing/#imaging-configuration). +See [image processing configuration](/content-management/image-processing/#imaging-configuration). ### languageCode -**Default value:** "" +**Default value:** "" A language tag as defined by [RFC 5646](https://datatracker.ietf.org/doc/html/rfc5646). This value is used to populate: @@ -324,7 +321,7 @@ See [Configure Minify](#configure-minify) ### module -Module config see [Module Config](/hugo-modules/configuration/). +Module configuration see [module configuration](/hugo-modules/configuration/). ### newContentEditor @@ -436,11 +433,11 @@ See [Configure Taxonomies](/content-management/taxonomies#configure-taxonomies). ### theme -: See [Module Config](/hugo-modules/configuration/#module-config-imports) for how to import a theme. +: See [module configuration](/hugo-modules/configuration/#module-configuration-imports) for how to import a theme. ### themesDir -**Default value:** "themes" +**Default value:** "themes" The directory where Hugo reads the themes from. @@ -448,11 +445,11 @@ The directory where Hugo reads the themes from. **Default value:** "30s" -Timeout for generating page contents, specified as a [duration](https://pkg.go.dev/time#Duration) or in milliseconds. *Note:* this is used to bail out of recursive content generation. You might need to raise this limit if your pages are slow to generate (e.g., because they require large image processing or depend on remote contents). +Timeout for generating page contents, specified as a [duration](https://pkg.go.dev/time#Duration) or in seconds. *Note:* this is used to bail out of recursive content generation. You might need to raise this limit if your pages are slow to generate (e.g., because they require large image processing or depend on remote contents). ### timeZone -The time zone (or location), e.g. `Europe/Oslo`, used to parse front matter dates without such information and in the [`time` function](/functions/time/). The list of valid values may be system dependent, but should include `UTC`, `Local`, and any location in the [IANA Time Zone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). +The time zone (or location), e.g. `Europe/Oslo`, used to parse front matter dates without such information and in the [`time` function](/functions/time/). The list of valid values may be system dependent, but should include `UTC`, `Local`, and any location in the [IANA Time Zone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). ### title @@ -460,7 +457,7 @@ Site title. ### titleCaseStyle -**Default value:** "AP" +**Default value:** "ap" See [Configure Title Case](#configure-title-case) @@ -490,53 +487,73 @@ enableemoji: true ``` {{% /note %}} -## Configure Build +## Configure build The `build` configuration section contains global build-related configuration options. {{< code-toggle file="hugo" >}} [build] -useResourceCacheWhen="fallback" -writeStats = false -noJSConfigInAssets = false - [[build.cachebusters]] - source = "assets/watching/hugo_stats\\.json" - target = "styles\\.css" - [[build.cachebusters]] - source = "(postcss|tailwind)\\.config\\.js" - target = "css" - [[build.cachebusters]] - source = "assets/.*\\.(js|ts|jsx|tsx)" - target = "js" - [[build.cachebusters]] - source = "assets/.*\\.(.*)$" - target = "$1" + noJSConfigInAssets = false + useResourceCacheWhen = 'fallback' + [build.buildStats] + disableClasses = false + disableIDs = false + disableTags = false + enable = false +[[build.cachebusters]] + source = 'assets/.*\.(js|ts|jsx|tsx)' + target = '(js|scripts|javascript)' +[[build.cachebusters]] + source = 'assets/.*\.(css|sass|scss)$' + target = '(css|styles|scss|sass)' +[[build.cachebusters]] + source = '(postcss|tailwind)\.config\.js' + target = '(css|styles|scss|sass)' +[[build.cachebusters]] + source = 'assets/.*\.(.*)$' + target = '$1' {{< /code-toggle >}} +buildStats {{< new-in "0.115.1" >}} +: When enabled, creates a `hugo_stats.json` file in the root of your project. This file contains arrays of the `class` attributes, `id` attributes, and tags of every HTML element within your published site. Use this file as data source when [removing unused CSS] from your site. This process is also known as pruning, purging, or tree shaking. -useResourceCacheWhen -: When to use the cached resources in `/resources/_gen` for PostCSS and ToCSS. Valid values are `never`, `always` and `fallback`. The last value means that the cache will be tried if PostCSS/extended version is not available. +[removing unused CSS]: http://localhost:1313/hugo-pipes/postprocess/#css-purging-with-postcss -writeStats -: When enabled, a file named `hugo_stats.json` will be written to your project root with some aggregated data about the build, e.g. list of HTML entities published to be used to do [CSS pruning](/hugo-pipes/postprocess/#css-purging-with-postcss). If you're only using this for the production build, you should consider placing it below [config/production](/getting-started/configuration/#configuration-directory). It's also worth mentioning that, due to the nature of the partial server builds, new HTML entities will be added when you add or change them while the server is running, but the old values will not be removed until you restart the server or run a regular `hugo` build. +Exclude `class` attributes, `id` attributes, or tags from `hugo_stats.json` with the `disableClasses`, `disableIDs`, and `disableTags` keys. -**Note** that the prime use case for this is purging of unused CSS; it is built for speed and there may be false positives (e.g., detection of HTML elements that are not HTML elements). +{{% note %}} +With v0.115.0 and earlier this feature was enabled by setting `writeStats` to `true`. Although still functional, the `writeStats` key will be deprecated in a future release. -noJSConfigInAssets -: Turn off writing a `jsconfig.json` into your `/assets` folder with mapping of imports from running [js.Build](https://gohugo.io/hugo-pipes/js). This file is intended to help with intellisense/navigation inside code editors such as [VS Code](https://code.visualstudio.com/). Note that if you do not use `js.Build`, no file will be written. +Given that CSS purging is typically limited to production builds, place the `buildStats` object below [config/production]. + +[config/production]: /getting-started/configuration/#configuration-directory + +Built for speed, there may be "false positive" detections (e.g., HTML elements that are not HTML elements) while parsing the published site. These "false positives" are infrequent and inconsequential. +{{% /note %}} + +Due to the nature of partial server builds, new HTML entities are added while the server is running, but old values will not be removed until you restart the server or run a regular `hugo` build. cachebusters : See [Configure Cache Busters](#configure-cache-busters) -## Configure Cache Busters +noJSConfigInAssets +: Turn off writing a `jsconfig.json` into your `/assets` folder with mapping of imports from running [js.Build](/hugo-pipes/js). This file is intended to help with intellisense/navigation inside code editors such as [VS Code](https://code.visualstudio.com/). Note that if you do not use `js.Build`, no file will be written. + +useResourceCacheWhen +: When to use the cached resources in `/resources/_gen` for PostCSS and ToCSS. Valid values are `never`, `always` and `fallback`. The last value means that the cache will be tried if PostCSS/extended version is not available. + +## Configure cache busters {{< new-in "0.112.0" >}} -The `build.cachebusters` configuration option was added to support development using Tailwind 3.x's JIT compiler where a `build` config may look like this: +The `build.cachebusters` configuration option was added to support development using Tailwind 3.x's JIT compiler where a `build` configuration may look like this: + +<!-- TODO (jmm) writeStats => build.buildStats --> {{< code-toggle file="hugo" >}} [build] -writeStats = true + [build.buildStats] + enable = true [[build.cachebusters]] source = "assets/watching/hugo_stats\\.json" target = "styles\\.css" @@ -559,7 +576,7 @@ source target : A regexp matching the keys in the resource cache that should be expired when `source` changes. You can use the matching regexp groups from `source` in the expression, e.g. `$1`. -## Configure Server +## Configure server This is only relevant when running `hugo server`, and it allows to set HTTP headers during development, which allows you to test out your Content Security Policy and similar. The configuration format matches [Netlify's](https://docs.netlify.com/routing/headers/#syntax-for-the-netlify-configuration-file) with slightly more powerful [Glob matching](https://github.com/gobwas/glob): @@ -579,7 +596,6 @@ Content-Security-Policy = "script-src localhost:1313" Since this is "development only", it may make sense to put it below the `development` environment: - {{< code-toggle file="config/development/server">}} [[headers]] for = "/**" @@ -604,13 +620,13 @@ status = 200 force = false {{< /code-toggle >}} -Setting `force=true` will make a redirect even if there is existing content in the path. Note that before Hugo 0.76 `force` was the default behavior, but this is inline with how Netlify does it. +Setting `force=true` will make a redirect even if there is existing content in the path. Note that before Hugo 0.76 `force` was the default behavior, but this is inline with how Netlify does it. -## 404 Server Error Page {#_404-server-error-page} +## 404 server error page {#_404-server-error-page} {{< new-in "0.103.0" >}} -Hugo will, by default, render all 404 errors when running `hugo server` with the `404.html` template. Note that if you have already added one or more redirects to your [Server Config](#configure-server), you need to add the 404 redirect explicitly, e.g: +Hugo will, by default, render all 404 errors when running `hugo server` with the `404.html` template. Note that if you have already added one or more redirects to your [server configuration](#configure-server), you need to add the 404 redirect explicitly, e.g: {{< code-toggle file="config/development/server" copy=false >}} [[redirects]] @@ -619,13 +635,13 @@ to = "/404.html" status = 404 {{< /code-toggle >}} -## Configure Title Case +## Configure title case -Set `titleCaseStyle` to specify the title style used by the [title](/functions/title/) template function and the automatic section titles in Hugo. +Set `titleCaseStyle` to specify the title style used by the [title](/functions/title/) template function and the automatic section titles in Hugo. Can be one of: -* `ap` (default), the capitalization rules in the [Associated Press (AP) Stylebook] +* `ap` (default), the capitalization rules in the [Associated Press (AP) Stylebook] * `chicago`, the [Chicago Manual of Style] * `go`, Go's convention of capitalizing every word. * `firstupper`, capitalize the first letter of the first word. @@ -635,12 +651,12 @@ Can be one of: [Chicago Manual of Style]: https://www.chicagomanualofstyle.org/home.html [site configuration]: /getting-started/configuration/#configure-title-case -## Configuration Environment Variables +## Configuration environment variables HUGO_NUMWORKERMULTIPLIER : Can be set to increase or reduce the number of workers used in parallel processing in Hugo. If not set, the number of logical CPUs will be used. -## Configuration Lookup Order +## Configuration lookup order Similar to the template [lookup order], Hugo has a default set of rules for searching for a configuration file in the root of your website's source directory as a default behavior: @@ -650,8 +666,7 @@ Similar to the template [lookup order], Hugo has a default set of rules for sear In your configuration file, you can direct Hugo as to how you want your website rendered, control your website's menus, and arbitrarily define site-wide parameters specific to your project. - -## Example Configuration +## Example configuration The following is a typical example of a configuration file. The values nested under `params:` will populate the [`.Site.Params`] variable for use in [templates]: @@ -670,9 +685,9 @@ params: SidebarRecentLimit: 5 {{< /code-toggle >}} -## Configure with Environment Variables +## Configure with environment variables -In addition to the 3 config options already mentioned, configuration key-values can be defined through operating system environment variables. +In addition to the 3 configuration options already mentioned, configuration key-values can be defined through operating system environment variables. For example, the following command will effectively set a website's title on Unix-like systems: @@ -685,18 +700,18 @@ This is really useful if you use a service such as Netlify to deploy your site. {{% note %}} Names must be prefixed with `HUGO_` and the configuration key must be set in uppercase when setting operating system environment variables. -To set config params, prefix the name with `HUGO_PARAMS_` +To set configuration parameters, prefix the name with `HUGO_PARAMS_` {{% /note %}} If you are using snake_cased variable names, the above will not work. Hugo determines the delimiter to use by the first character after `HUGO`. This allows you to define environment variables on the form `HUGOxPARAMSxAPI_KEY=abcdefgh`, using any [allowed](https://stackoverflow.com/questions/2821043/allowed-characters-in-linux-environment-variable-names#:~:text=So%20names%20may%20contain%20any,not%20begin%20with%20a%20digit.) delimiter. {{< todo >}} -Test and document setting params via JSON env var. +Test and document setting parameters via JSON env var. {{< /todo >}} -## Ignore Content and Data Files when Rendering +## Ignore content and data files when rendering -**Note:** This works, but we recommend you use the newer and more powerful [includeFiles and excludeFiles](https://gohugo.io/hugo-modules/configuration/#module-config-mounts) mount options. +**Note:** This works, but we recommend you use the newer and more powerful [includeFiles and excludeFiles](/hugo-modules/configuration/#module-configuration-mounts) mount options. To exclude specific files from the `content`, `data`, and `i18n` directories when rendering your site, set `ignoreFiles` to one or more regular expressions to match against the absolute file path. @@ -712,9 +727,9 @@ To ignore a file using the absolute file path: ignoreFiles = ['^/home/user/project/content/test\.md$'] {{< /code-toggle >}} -## Configure Front Matter +## Configure front matter -### Configure Dates +### Configure dates Dates are important in Hugo, and you can configure how Hugo assigns dates to your content pages. You do this by adding a `frontmatter` section to your `hugo.toml`. @@ -737,11 +752,10 @@ date = ["myDate", ":default"] The `:default` is a shortcut to the default settings. The above will set `.Date` to the date value in `myDate` if present, if not we will look in `date`,`publishDate`, `lastmod` and pick the first valid date. -In the list to the right, values starting with ":" are date handlers with a special meaning (see below). The others are just names of date parameters (case insensitive) in your front matter configuration. Also note that Hugo have some built-in aliases to the above: `lastmod` => `modified`, `publishDate` => `pubdate`, `published` and `expiryDate` => `unpublishdate`. With that, as an example, using `pubDate` as a date in front matter, will, by default, be assigned to `.PublishDate`. +In the list to the right, values starting with ":" are date handlers with a special meaning (see below). The others are just names of date parameters (case insensitive) in your front matter configuration. Also note that Hugo have some built-in aliases to the above: `lastmod` => `modified`, `publishDate` => `pubdate`, `published` and `expiryDate` => `unpublishdate`. With that, as an example, using `pubDate` as a date in front matter, will, by default, be assigned to `.PublishDate`. The special date handlers are: - `:fileModTime` : Fetches the date from the content file's last modification timestamp. @@ -752,12 +766,10 @@ An example: lastmod = ["lastmod", ":fileModTime", ":default"] {{< /code-toggle >}} - The above will try first to extract the value for `.Lastmod` starting with the `lastmod` front matter parameter, then the content file's modification timestamp. The last, `:default` should not be needed here, but Hugo will finally look for a valid date in `:git`, `date` and then `publishDate`. - `:filename` -: Fetches the date from the content file's filename. For example, `2018-02-22-mypage.md` will extract the date `2018-02-22`. Also, if `slug` is not set, `mypage` will be used as the value for `.Slug`. +: Fetches the date from the content file's file name. For example, `2018-02-22-mypage.md` will extract the date `2018-02-22`. Also, if `slug` is not set, `mypage` will be used as the value for `.Slug`. An example: @@ -766,23 +778,22 @@ An example: date = [":filename", ":default"] {{< /code-toggle >}} -The above will try first to extract the value for `.Date` from the filename, then it will look in front matter parameters `date`, `publishDate` and lastly `lastmod`. - +The above will try first to extract the value for `.Date` from the file name, then it will look in front matter parameters `date`, `publishDate` and lastly `lastmod`. `:git` -: This is the Git author date for the last revision of this content file. This will only be set if `--enableGitInfo` is set or `enableGitInfo = true` is set in site config. +: This is the Git author date for the last revision of this content file. This will only be set if `--enableGitInfo` is set or `enableGitInfo = true` is set in site configuration. -## Configure Additional Output Formats +## Configure additional output formats Hugo v0.20 introduced the ability to render your content to multiple output formats (e.g., to JSON, AMP html, or CSV). See [Output Formats] for information on how to add these values to your Hugo project's configuration file. -## Configure Minify +## Configure minify Default configuration: {{< code-toggle config="minify" />}} -## Configure File Caches +## Configure file caches Since Hugo 0.52 you can configure more than just the `cacheDir`. This is the default configuration: @@ -813,13 +824,13 @@ You can override any of these cache settings in your own `hugo.toml`. ### The keywords explained `:cacheDir` -: This is the value of the `cacheDir` config option if set (can also be set via OS env variable `HUGO_CACHEDIR`). It will fall back to `/opt/build/cache/hugo_cache/` on Netlify, or a `hugo_cache_$USER` directory below the OS temp dir for the others. This means that if you run your builds on Netlify, all caches configured with `:cacheDir` will be saved and restored on the next build. For other CI vendors, please read their documentation. For an CircleCI example, see [this configuration](https://github.com/bep/hugo-sass-test/blob/6c3960a8f4b90e8938228688bc49bdcdd6b2d99e/.circleci/config.yml). +: This is the value of the `cacheDir` configuration option if set (can also be set via OS env variable `HUGO_CACHEDIR`). It will fall back to `/opt/build/cache/hugo_cache/` on Netlify, or a `hugo_cache_$USER` directory below the OS temp dir for the others. This means that if you run your builds on Netlify, all caches configured with `:cacheDir` will be saved and restored on the next build. For other CI vendors, please read their documentation. For an CircleCI example, see [this configuration](https://github.com/bep/hugo-sass-test/blob/6c3960a8f4b90e8938228688bc49bdcdd6b2d99e/.circleci/config.yml). `:project` : The base directory name of the current Hugo project. This means that, in its default setting, every project will have separated file caches, which means that when you do `hugo --gc` you will not touch files related to other Hugo projects running on the same PC. `:resourceDir` -: This is the value of the `resourceDir` config option. +: This is the value of the `resourceDir` configuration option. maxAge : This is the duration before a cache entry will be evicted, -1 means forever and 0 effectively turns that particular cache off. Uses Go's `time.Duration`, so valid values are `"10s"` (10 seconds), `"10m"` (10 minutes) and `"10h"` (10 hours). @@ -827,7 +838,7 @@ maxAge dir : The absolute path to where the files for this cache will be stored. Allowed starting placeholders are `:cacheDir` and `:resourceDir` (see above). -## Configuration Format Specs +## Configuration format specs - [TOML Spec][toml] - [YAML Spec][yaml] diff --git a/docs/content/en/getting-started/directory-structure.md b/docs/content/en/getting-started/directory-structure.md index 7618570b0..fa4babe6a 100644 --- a/docs/content/en/getting-started/directory-structure.md +++ b/docs/content/en/getting-started/directory-structure.md @@ -1,18 +1,18 @@ --- -title: Directory Structure +title: Directory structure description: Hugo's CLI scaffolds a project directory structure and then takes that single directory and uses it as the input to create a complete website. -categories: [getting started,fundamentals] +categories: [fundamentals,getting started] keywords: [source, organization, directories] menu: docs: parent: getting-started - weight: 50 -weight: 50 + weight: 30 +weight: 30 aliases: [/overview/source-directory/] toc: true --- -## New Site Scaffolding +## New site scaffolding {{< youtube sB0HLHjgQ7E >}} @@ -32,23 +32,23 @@ example/ └── hugo.toml ``` -## Directory Structure Explained +## Directory structure explained The following is a high-level overview of each of the directories with links to each of their respective sections within the Hugo docs. [`archetypes`](/content-management/archetypes/) : You can create new content files in Hugo using the `hugo new` command. -By default, Hugo will create new content files with at least `date`, `title` (inferred from the filename), and `draft = true`. This saves time and promotes consistency for sites using multiple content types. You can create your own [archetypes] with custom preconfigured front matter fields as well. +By default, Hugo will create new content files with at least `date`, `title` (inferred from the file name), and `draft = true`. This saves time and promotes consistency for sites using multiple content types. You can create your own [archetypes] with custom preconfigured front matter fields as well. [`assets`] : Stores all the files which need be processed by [Hugo Pipes](/hugo-pipes/). Only the files whose `.Permalink` or `.RelPermalink` are used will be published to the `public` directory. [`config`](/getting-started/configuration/) : Hugo ships with a large number of [configuration directives]. -The [config directory](/getting-started/configuration/#configuration-directory) is where those directives are stored as JSON, YAML, or TOML files. Every root setting object can stand as its own file and structured by environments. +The [configuration directory](/getting-started/configuration/#configuration-directory) is where those directives are stored as JSON, YAML, or TOML files. Every root setting object can stand as its own file and structured by environments. Projects with minimal settings and no need for environment awareness can use a single `hugo.toml` file at its root. -Many sites may need little to no configuration, but Hugo ships with a large number of [configuration directives] for more granular directions on how you want Hugo to build your website. Note: config directory is not created by default. +Many sites may need little to no configuration, but Hugo ships with a large number of [configuration directives] for more granular directions on how you want Hugo to build your website. Note: the `config` directory is not created by default. [`content`] : All content for your website will live inside this directory. Each top-level folder in Hugo is considered a [content section]. For example, if your site has three main sections---`blog`, `articles`, and `tutorials`---you will have three directories at `content/blog`, `content/articles`, and `content/tutorials`. Hugo uses sections to assign default [content types]. @@ -86,7 +86,6 @@ From **Hugo 0.31** you can have multiple static directories. [partials]: /templates/partials/ [searchconsole]: https://support.google.com/webmasters/answer/9008080#zippy=%2Chtml-file-upload [singles]: /templates/single-page-templates/ -[starters]: /tools/starter-kits/ [taxonomies]: /content-management/taxonomies/ [taxonomy templates]: /templates/taxonomy-templates/ [types]: /content-management/types/ diff --git a/docs/content/en/getting-started/external-learning-resources/index.md b/docs/content/en/getting-started/external-learning-resources/index.md index 7f993736a..17ba2849b 100644 --- a/docs/content/en/getting-started/external-learning-resources/index.md +++ b/docs/content/en/getting-started/external-learning-resources/index.md @@ -1,12 +1,12 @@ --- -title: External Learning Resources +title: External learning resources description: A list of tutorials and books on Hugo. keywords: [books, tutorials, learning, usage] menu: docs: parent: getting-started - weight: 70 -weight: 70 + weight: 60 +weight: 60 --- ## Books diff --git a/docs/content/en/getting-started/quick-start.md b/docs/content/en/getting-started/quick-start.md index 167dfc0e1..b00851bae 100644 --- a/docs/content/en/getting-started/quick-start.md +++ b/docs/content/en/getting-started/quick-start.md @@ -1,13 +1,13 @@ --- -title: Quick Start +title: Quick start description: Learn to create a Hugo site in minutes. categories: [getting started] keywords: [quick start,usage] menu: docs: parent: getting-started - weight: 10 -weight: 10 + weight: 20 +weight: 20 toc: true aliases: [/quickstart/,/overview/quickstart/] --- @@ -39,9 +39,10 @@ You must also be comfortable working from the command line. - Do not use Windows PowerShell - Run these commands from [PowerShell] or a Linux terminal such as WSL or Git Bash -PowerShell and Windows PowerShell are different applications. +PowerShell and Windows PowerShell [are different applications]. [PowerShell]: https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows +[are different applications]: https://learn.microsoft.com/en-us/powershell/scripting/whats-new/differences-from-windows-powershell?view=powershell-7.3 {{% /note %}} Run these commands to create a Hugo site with the [Ananke] theme. The next section provides an explanation of each command. @@ -50,7 +51,7 @@ Run these commands to create a Hugo site with the [Ananke] theme. The next secti hugo new site quickstart cd quickstart git init -git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke themes/ananke +git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke echo "theme = 'ananke'" >> hugo.toml hugo server ``` @@ -80,7 +81,7 @@ git init Clone the [Ananke] theme into the `themes` directory, adding it to your project as a [Git submodule]. ```text -git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke themes/ananke +git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke ``` Append a line to the site configuration file, indicating the current theme. diff --git a/docs/content/en/getting-started/usage.md b/docs/content/en/getting-started/usage.md index 908edca7e..11f28c6b2 100644 --- a/docs/content/en/getting-started/usage.md +++ b/docs/content/en/getting-started/usage.md @@ -6,8 +6,8 @@ keywords: [usage,livereload,command,flags] menu: docs: parent: getting-started - weight: 40 -weight: 40 + weight: 30 +weight: 30 aliases: [/overview/usage/,/extras/livereload/,/doc/usage/,/usage/] toc: true --- diff --git a/docs/content/en/hosting-and-deployment/_index.md b/docs/content/en/hosting-and-deployment/_index.md index 0d5ada297..4329469a5 100644 --- a/docs/content/en/hosting-and-deployment/_index.md +++ b/docs/content/en/hosting-and-deployment/_index.md @@ -1,14 +1,15 @@ --- -title: Hosting & Deployment -linktitle: Hosting & Deployment Overview +title: Hosting and deployment +linkTitle: Overview description: Site builds, automated deployments, and popular hosting solutions. categories: [hosting and deployment] keywords: [] menu: docs: + identifier: hosting-and-deployment-overview parent: hosting-and-deployment - weight: 01 -weight: 01 + weight: 1 +weight: 1 --- Because Hugo renders *static* websites, you can host your new Hugo website virtually anywhere. The following represent only a few of the more popular hosting and automated deployment solutions used by the Hugo community. diff --git a/docs/content/en/hosting-and-deployment/deployment-with-rclone.md b/docs/content/en/hosting-and-deployment/deployment-with-rclone.md index 27cd312ef..6d45a0883 100644 --- a/docs/content/en/hosting-and-deployment/deployment-with-rclone.md +++ b/docs/content/en/hosting-and-deployment/deployment-with-rclone.md @@ -1,13 +1,11 @@ --- -title: Deployment with Rclone +title: Deploy with Rclone description: If you have access to your web host with SFTP/FTP/SSH/HTTP(DAV), you can use rclone to incrementally deploy your entire Hugo website. categories: [hosting and deployment] keywords: [rclone,sftp,deployment] menu: docs: parent: hosting-and-deployment - weight: 80 -weight: 80 aliases: [/tutorials/deployment-with-rclone/] toc: true --- @@ -22,7 +20,7 @@ toc: true **NB**: You can remove ``--interactive`` in the commands below once you are comfortable with rclone, if you wish. Also, ``--gc`` and ``--minify`` are optional in the ``hugo`` commands below. -## Getting Started +## Getting started The spoiler is that you can even deploy your entire website from any compatible OS with no configuration. Using SFTP for example: @@ -31,9 +29,9 @@ hugo --gc --minify rclone sync --interactive --sftp-host sftp.example.com --sftp-user www-data --sftp-ask-password public/ :sftp:www/ ``` -## Configure Rclone for Even Easier Usage +## Configure Rclone for even easier usage -The easiest way is simply to run ``rclone config``. +The easiest way is simply to run `rclone config`. The [Rclone docs](https://rclone.org/docs/) provide [an example of configuring Rclone to use SFTP](https://rclone.org/sftp/). diff --git a/docs/content/en/hosting-and-deployment/deployment-with-rsync.md b/docs/content/en/hosting-and-deployment/deployment-with-rsync.md index 0bb23d044..7c4cbda07 100644 --- a/docs/content/en/hosting-and-deployment/deployment-with-rsync.md +++ b/docs/content/en/hosting-and-deployment/deployment-with-rsync.md @@ -1,13 +1,11 @@ --- -title: Deployment with Rsync +title: Deploy with Rsync description: If you have access to your web host with SSH, you can use a simple rsync one-liner to incrementally deploy your entire Hugo website. categories: [hosting and deployment] keywords: [rsync,deployment] menu: docs: parent: hosting-and-deployment - weight: 70 -weight: 70 aliases: [/tutorials/deployment-with-rsync/] toc: true --- @@ -26,7 +24,7 @@ hugo && rsync -avz --delete public/ [email protected]:~/www/ As you will see, we'll put this command in a shell script file, which makes building and deployment as easy as executing `./deploy`. -## Copy Your SSH Key to your Host +## Copy Your SSH Key to your host To make logging in to your server more secure and less interactive, you can upload your SSH key. If you have already installed your SSH key to your server, you can move on to the next section. @@ -77,7 +75,7 @@ Enter passphrase for key '/home/mylogin/.ssh/rsa_id': Now that you can log in with your SSH key, let's create a script to automate deployment of your Hugo site. -## Shell Script +## Shell script Create a new script called `deploy` the root of your Hugo tree: diff --git a/docs/content/en/hosting-and-deployment/hosting-on-21yunbox.md b/docs/content/en/hosting-and-deployment/hosting-on-21yunbox.md index 62eb331a1..d6dfb666d 100644 --- a/docs/content/en/hosting-and-deployment/hosting-on-21yunbox.md +++ b/docs/content/en/hosting-and-deployment/hosting-on-21yunbox.md @@ -6,8 +6,6 @@ keywords: [21yunbox,hosting,deployment] menu: docs: parent: hosting-and-deployment - weight: 10 -weight: 10 toc: true --- diff --git a/docs/content/en/hosting-and-deployment/hosting-on-aws-amplify.md b/docs/content/en/hosting-and-deployment/hosting-on-aws-amplify.md index 90fb5c083..0255c1723 100644 --- a/docs/content/en/hosting-and-deployment/hosting-on-aws-amplify.md +++ b/docs/content/en/hosting-and-deployment/hosting-on-aws-amplify.md @@ -6,8 +6,6 @@ keywords: [amplify,hosting,deployment] menu: docs: parent: hosting-and-deployment - weight: 10 -weight: 10 toc: true --- diff --git a/docs/content/en/hosting-and-deployment/hosting-on-azure-static-web-apps.md b/docs/content/en/hosting-and-deployment/hosting-on-azure-static-web-apps.md index f0d1d5de4..ec8cd996f 100644 --- a/docs/content/en/hosting-and-deployment/hosting-on-azure-static-web-apps.md +++ b/docs/content/en/hosting-and-deployment/hosting-on-azure-static-web-apps.md @@ -1,13 +1,11 @@ --- -title: Hosting on Azure Static Web Apps -description: Learn how to deploy a Hugo application to Azure Static Web Apps. +title: Host on Azure Static Web Apps +description: Publish a Hugo site to Azure Static Web Apps. categories: [hosting and deployment] keywords: [hosting,Azure Static Web Apps] menu: docs: parent: hosting-and-deployment - weight: 200 -weight: 200 toc: true --- diff --git a/docs/content/en/hosting-and-deployment/hosting-on-azure.md b/docs/content/en/hosting-and-deployment/hosting-on-azure.md deleted file mode 100644 index e76957d51..000000000 --- a/docs/content/en/hosting-and-deployment/hosting-on-azure.md +++ /dev/null @@ -1,96 +0,0 @@ ---- -title: Host on Azure Static Web Apps -description: Deploy Hugo to Azure Static Web Apps and automate the whole process with GitHub Action Workflow -categories: [hosting and deployment] -keywords: [azure,git,deployment,hosting] -menu: - docs: - parent: hosting-and-deployment - weight: 10 -weight: 10 -toc: true ---- - -[Azure Static Web Apps] is a service that automatically builds and deploys full stack web apps to Azure from a Git repository, using [GitHub Actions] or [Azure DevOps]. - -_The following documentation covers how to use GitHub Actions for the deployment. If you are using Azure DevOps, follow the Microsoft documentation._ - -## Assumptions - -1. You have Git 2.8 or greater [installed on your machine][installgit]. -2. You have a GitHub account. [Signing up][ghsignup] for GitHub is free. -3. You have an Azure account. You can sign up for a [Free Trial][azuretrial]. -4. You have a ready-to-publish Hugo website or have at least completed the [Quick Start]. - -## Deploy Hugo to Azure Static Web Apps - -1. Navigate to the [Azure Portal][azureportal] -2. Click **Create a Resource** -3. Search for **Static Web Apps** -4. Click **Static Web Apps** -5. Click **Create** - -![Create in Azure Portal](/images/hosting-and-deployment/hosting-on-azure/create-in-portal.png) - -6. For **Subscription**, accept the subscription that is listed or select a new one from the drop-down list. -7. In _Resource group_, select **New**. In _New resource group name_, enter **hugo-static-app** and select **OK**. -8. Next, a name for your app in the **Name** box. Valid characters include `a-z`, `A-Z`, `0-9` and `-`. -9. For _Region_, select an available region close to you. -10. For _SKU_, select **Free**. - -![Basic app details](/images/hosting-and-deployment/hosting-on-azure/basic-app-details.png) - -11. Click the **Sign in with GitHub** button. -12. Select the **Organization** under which your repo exists. -13. Select the Hugo app you wish to deploy as the _Repository_ . -14. For the _Branch_ select the branch you want to deploy (eg: **main**). -15. Select **Hugo** under the _Build Presets_, which will populate the configuration files with the standard Hugo build options - * **App Location** is the path in the Git repo where Hugo's config file is - * **Api Location** is the path where the Serverless API is (or left blank if there is no API) - * **Artifact Location** is the path where Hugo publishes to -16. Click **Review + Create** to review the details and then **Create** to start the creation of the Azure Static Web Apps and create the GitHub Action workflow for deployment. - -A GitHub Action workflow will immediately start a build using Hugo and deployment to Azure. The website can be accessed via the URL shown on the _Overview_ page of the Azure Static Web Apps resource in Azure. - -## Using A Custom Hugo Version - -When you create a Static Web App, a [workflow file][swaconfig] is generated which contains the deployment settings for the site. You can configure a specific Hugo version in the workflow file by providing a value for `HUGO_VERSION` in the `env` section of the `Azure/static-web-apps-deploy` GitHub Action. - -```yaml -jobs: - build_and_deploy_job: - if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') - runs-on: ubuntu-latest - name: Build and Deploy Job - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - name: Build And Deploy - id: builddeploy - uses: Azure/static-web-apps-deploy@v1 - with: - azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} - repo_token: ${{ secrets.GITHUB_TOKEN }} - action: "upload" - app_location: "/" # App source code path - api_location: "api" # Api source code path - optional - output_location: "public" # Built app content directory - optional - env: - HUGO_VERSION: 0.100.2 -``` - -## Use a Custom Domain - -Azure Static Web Apps supports custom domains as a CNAME or APEX domain mapping. You can configure the custom domains via the Azure Portal. Refer to the [official documentation for custom domains][domains] for more information. - -[Azure Static Web Apps]: https://docs.microsoft.com/azure/static-web-apps/?WT.mc_id=javascript-26008-aapowell -[GitHub Actions]: https://docs.github.com/en/actions -[Azure DevOps]: https://docs.microsoft.com/azure/static-web-apps/publish-devops?WT.mc_id=javascript-26008-aapowell -[ghsignup]: https://github.com/join -[installgit]: https://git-scm.com/downloads -[azuretrial]: https://azure.microsoft.com/free/?WT.mc_id=javascript-26008-aapowell -[azureportal]: https://portal.azure.com/ -[swaconfig]: https://docs.microsoft.com/azure/static-web-apps/github-actions-workflow?WT.mc_id=javascript-26008-aapowell -[domains]: https://docs.microsoft.com/azure/static-web-apps/custom-domain?WT.mc_id=javascript-26008-aapowell -[Quick Start]: /getting-started/quick-start/ diff --git a/docs/content/en/hosting-and-deployment/hosting-on-cloudflare-pages.md b/docs/content/en/hosting-and-deployment/hosting-on-cloudflare-pages.md index 2138f4a16..5c927ec99 100644 --- a/docs/content/en/hosting-and-deployment/hosting-on-cloudflare-pages.md +++ b/docs/content/en/hosting-and-deployment/hosting-on-cloudflare-pages.md @@ -5,8 +5,6 @@ categories: [hosting and deployment] menu: docs: parent: hosting-and-deployment - weight: 50 -weight: 50 toc: true --- diff --git a/docs/content/en/hosting-and-deployment/hosting-on-firebase.md b/docs/content/en/hosting-and-deployment/hosting-on-firebase.md index 406f6abc3..a5094a23f 100644 --- a/docs/content/en/hosting-and-deployment/hosting-on-firebase.md +++ b/docs/content/en/hosting-and-deployment/hosting-on-firebase.md @@ -6,8 +6,6 @@ keywords: [hosting,firebase] menu: docs: parent: hosting-and-deployment - weight: 20 -weight: 20 toc: true --- @@ -76,7 +74,7 @@ With this you will have the app initialized manually. After that you can manage Don't forget to update your static pages before push! -## Manual Deploy +## Manual deploy To deploy your Hugo site, execute the `firebase deploy` command, and your site will be up in no time: @@ -84,7 +82,7 @@ To deploy your Hugo site, execute the `firebase deploy` command, and your site w hugo && firebase deploy ``` -## CI Setup (Other tools) +## CI setup (other tools) You can generate a deploy token using diff --git a/docs/content/en/hosting-and-deployment/hosting-on-github/index.md b/docs/content/en/hosting-and-deployment/hosting-on-github/index.md index e5cbe1922..47a7074b7 100644 --- a/docs/content/en/hosting-and-deployment/hosting-on-github/index.md +++ b/docs/content/en/hosting-and-deployment/hosting-on-github/index.md @@ -1,13 +1,11 @@ --- -title: Host on GitHub +title: Host on GitHub Pages description: Deploy Hugo as a GitHub Pages project or personal/organizational site and automate the whole process with Github Actions categories: [hosting and deployment] keywords: [github,git,deployment,hosting] menu: docs: parent: hosting-and-deployment - weight: 30 -weight: 30 toc: true aliases: [/tutorials/github-pages-blog/] --- @@ -102,14 +100,14 @@ jobs: build: runs-on: ubuntu-latest env: - HUGO_VERSION: 0.111.3 + HUGO_VERSION: 0.115.1 steps: - name: Install Hugo CLI run: | wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ && sudo dpkg -i ${{ runner.temp }}/hugo.deb - - name: Install Dart Sass Embedded - run: sudo snap install dart-sass-embedded + - name: Install Dart Sass + run: sudo snap install dart-sass - name: Checkout uses: actions/checkout@v3 with: diff --git a/docs/content/en/hosting-and-deployment/hosting-on-gitlab.md b/docs/content/en/hosting-and-deployment/hosting-on-gitlab.md index 1e43e5975..b48a392b7 100644 --- a/docs/content/en/hosting-and-deployment/hosting-on-gitlab.md +++ b/docs/content/en/hosting-and-deployment/hosting-on-gitlab.md @@ -1,13 +1,11 @@ --- -title: Host on GitLab +title: Host on GitLab Pages description: GitLab makes it easy to build, deploy, and host your Hugo website via their free GitLab Pages service, which provides native support for Hugo. categories: [hosting and deployment] keywords: [hosting,deployment,git,gitlab] menu: docs: parent: hosting-and-deployment - weight: 40 -weight: 40 toc: true aliases: [/tutorials/hosting-on-gitlab/] --- @@ -28,24 +26,48 @@ The `baseURL` in your [site configuration](/getting-started/configuration/) must Define your [CI/CD](https://docs.gitlab.com/ee/ci/quick_start/) jobs by creating a `.gitlab-ci.yml` file in the root of your project. {{< code file=".gitlab-ci.yml" >}} -image: registry.gitlab.com/pages/hugo/hugo_extended:latest - variables: + DART_SASS_VERSION: 1.63.6 + HUGO_VERSION: 0.115.3 + NODE_VERSION: 20.x + GIT_DEPTH: 0 + GIT_STRATEGY: clone GIT_SUBMODULE_STRATEGY: recursive + TZ: America/Los_Angeles + +image: + name: golang:1.20.6-bookworm pages: script: - - hugo + # Install brotli + - apt-get update + - apt-get install -y brotli + # Install Dart Sass + - curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz + - tar -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz + - cp -r dart-sass/* /usr/local/bin + - rm -rf dart-sass* + # Install Hugo + - curl -LJO https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb + - apt-get install -y ./hugo_extended_${HUGO_VERSION}_linux-amd64.deb + - rm hugo_extended_${HUGO_VERSION}_linux-amd64.deb + # Install Node.js + - curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | bash - + - apt-get install -y nodejs + # Install Node.js dependencies + - "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true" + # Build + - hugo --gc --minify + # Compress + - find public -type f -regex '.*\.\(css\|html\|js\|txt\|xml\)$' -exec gzip -f -k {} \; + - find public -type f -regex '.*\.\(css\|html\|js\|txt\|xml\)$' -exec brotli -f -k {} \; artifacts: paths: - - public + - public rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH -{{< /code >}} - -{{% note %}} -See [this list](https://gitlab.com/pages/hugo/container_registry) if you wish to use a particular Hugo version to build your site. -{{% /note %}} + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH +{{% /code %}} ## Push your Hugo website to GitLab diff --git a/docs/content/en/hosting-and-deployment/hosting-on-keycdn.md b/docs/content/en/hosting-and-deployment/hosting-on-keycdn.md index bf6565899..87f66acf5 100644 --- a/docs/content/en/hosting-and-deployment/hosting-on-keycdn.md +++ b/docs/content/en/hosting-and-deployment/hosting-on-keycdn.md @@ -1,12 +1,11 @@ --- -title: "Host on KeyCDN" +title: Host on KeyCDN description: "Accelerate your Hugo site globally with a KeyCDN integration. This tutorial shows you how to set up your static site as a GitLab page behind a KeyCDN pull zone." categories: [hosting and deployment] keywords: [keycdn,hosting,deployment,cdn] menu: docs: parent: hosting-and-deployment - weight: 40 --- [KeyCDN](https://www.keycdn.com/) provides a multitude of features to help accelerate and secure your Hugo site globally including Brotli compression, Let's Encrypt support, Origin Shield, and more. @@ -73,7 +72,7 @@ While the Secret Variable for your API Key will look similar to: The Zone ID and API key are used to purge your zone – it’s not strictly needed but otherwise, the CDN might deliver older versions of your assets for quite a while. -## Push Your Changes to GitLab +## Push your changes to GitLab Now it’s time to push the newly created repository to GitLab: diff --git a/docs/content/en/hosting-and-deployment/hosting-on-netlify.md b/docs/content/en/hosting-and-deployment/hosting-on-netlify.md index 7d620f11a..00cc03042 100644 --- a/docs/content/en/hosting-and-deployment/hosting-on-netlify.md +++ b/docs/content/en/hosting-and-deployment/hosting-on-netlify.md @@ -6,8 +6,6 @@ keywords: [netlify,hosting,deployment] menu: docs: parent: hosting-and-deployment - weight: 10 -weight: 10 toc: true --- @@ -49,7 +47,7 @@ Select the repo you want to use for continuous deployment. If you have a large n ![Screenshot of step 1 of create a new site for Netlify: selecting the git provider](/images/hosting-and-deployment/hosting-on-netlify/netlify-create-new-site-step-2.jpg) -Once selected, you'll be brought to a screen for basic setup. Here you can select the branch you want to publish, your [build command], and your publish (i.e. deploy) directory. The publish directory should mirror that of what you've set in your [site configuration][config], the default of which is `public`. The following steps assume you are publishing from the `master` branch. +Once selected, you'll be brought to a screen for basic setup. Here you can select the branch you want to publish, your [build command], and your publish (i.e. deploy) directory. The publish directory should mirror that of what you've set in your [site configuration], the default of which is `public`. The following steps assume you are publishing from the `master` branch. ## Configure Hugo version in Netlify @@ -73,7 +71,7 @@ The Netlify configuration file can be a little hard to understand and get right {{< readfile file="netlify.toml" highlight="toml" >}} -## Build and Deploy Site +## Build and deploy site In the Netlify console, selecting "Deploy site" will immediately take you to a terminal for your build:. @@ -91,7 +89,7 @@ Now every time you push changes to your hosted git repository, Netlify will rebu See [this blog post](https://www.netlify.com/blog/2017/04/11/netlify-plus-hugo-0.20-and-beyond/) for more details about how Netlify handles Hugo versions. -## Use Hugo Themes with Netlify +## Use Hugo themes with Netlify The `git clone` method for installing themes is not supported by Netlify. If you were to use `git clone`, it would require you to recursively remove the `.git` subdirectory from the theme folder and would therefore prevent compatibility with future versions of the theme. @@ -124,7 +122,7 @@ You can update a theme to the latest version by executing the following command git submodule update --rebase --remote ``` -## Next Steps +## Next steps You now have a live website served over HTTPS, distributed through CDN, and configured for continuous deployment. Dig deeper into the Netlify documentation: @@ -134,7 +132,7 @@ You now have a live website served over HTTPS, distributed through CDN, and conf [app.netlify.com]: https://app.netlify.com [build command]: /getting-started/usage/#build-your-site -[config]: /getting-started/configuration/ +[site configuration]: /getting-started/configuration/ [ghsm]: https://github.com/blog/2104-working-with-submodules [gitsm]: https://git-scm.com/book/en/v2/Git-Tools-Submodules [httpscustom]: https://www.netlify.com/docs/ssl/ diff --git a/docs/content/en/hosting-and-deployment/hosting-on-render.md b/docs/content/en/hosting-and-deployment/hosting-on-render.md index d8f03c3e7..8965ad786 100644 --- a/docs/content/en/hosting-and-deployment/hosting-on-render.md +++ b/docs/content/en/hosting-and-deployment/hosting-on-render.md @@ -6,8 +6,6 @@ keywords: [hosting,deployment] menu: docs: parent: hosting-and-deployment - weight: 10 -weight: 10 toc: true --- @@ -48,23 +46,23 @@ You can set up a Hugo site on Render in two quick steps: That's it! Your site will be live on your Render URL (which looks like `yoursite.onrender.com`) as soon as the build is done. -## Continuous Deploys +## Continuous deploys Now that Render is connected to your repo, it will **automatically build and publish your site** any time you push to your GitHub/GitLab. You can choose to disable auto deploys under the **Settings** section for your site and deploy it manually from the Render dashboard. -## CDN and Cache Invalidation +## CDN and cache invalidation Render hosts your site on a global, lightning fast CDN which ensures the fastest possible download times for all your users across the globe. Every deploy automatically and instantly invalidates the CDN cache, so your users can always access the latest content on your site. -## Custom Domains +## Custom domains Add your own domains to your site easily using Render's [custom domains](https://render.com/docs/custom-domains) guide. -## Pull Request Previews +## Pull Request previews With Pull Request (PR) previews, you can visualize changes introduced in a pull request instead of simply relying on code reviews. @@ -72,7 +70,7 @@ Once enabled, every PR for your site will automatically generate a new static si Read more about [Pull Request Previews](https://render.com/docs/pull-request-previews) on Render. -## Hugo Themes +## Hugo themes Render automatically downloads all Git submodules defined in your Git repo on every build. This way Hugo themes added as submodules work as expected. diff --git a/docs/content/en/hosting-and-deployment/hugo-deploy.md b/docs/content/en/hosting-and-deployment/hugo-deploy.md index e0c98de2a..ed603012b 100644 --- a/docs/content/en/hosting-and-deployment/hugo-deploy.md +++ b/docs/content/en/hosting-and-deployment/hugo-deploy.md @@ -6,8 +6,8 @@ keywords: [s3,gcs,azure,hosting,deployment] menu: docs: parent: hosting-and-deployment - weight: 2 -weight: 2 + weight: 20 +weight: 20 toc: true --- diff --git a/docs/content/en/hugo-modules/_index.md b/docs/content/en/hugo-modules/_index.md index 76f21d43f..87dca37b8 100644 --- a/docs/content/en/hugo-modules/_index.md +++ b/docs/content/en/hugo-modules/_index.md @@ -1,12 +1,13 @@ --- title: Hugo Modules -linktitle: Hugo Modules Overview +linkTitle: Overview description: How to use Hugo Modules. menu: docs: + identifier: hugo-modules-overview parent: modules - weight: 01 -weight: 01 + weight: 10 +weight: 10 categories: [hugo modules] keywords: [themes,modules] aliases: [/themes/overview/,/themes/] @@ -22,7 +23,7 @@ Hugo Modules are powered by Go Modules. For more information about Go Modules, s - [https://github.com/golang/go/wiki/Modules](https://github.com/golang/go/wiki/Modules) - [https://go.dev/blog/using-go-modules](https://go.dev/blog/using-go-modules) -This is all very much brand new and there are only a few example projects around: +Some example projects: - [https://github.com/bep/docuapi](https://github.com/bep/docuapi) is a theme that has been ported to Hugo Modules while testing this feature. It is a good example of a non-Hugo-project mounted into Hugo’s folder structure. It even shows a JS Bundler implementation in regular Go templates. - [https://github.com/bep/my-modular-site](https://github.com/bep/my-modular-site) is a very simple site used for testing. diff --git a/docs/content/en/hugo-modules/configuration.md b/docs/content/en/hugo-modules/configuration.md index 828e7fcc8..b1a3f4bf8 100644 --- a/docs/content/en/hugo-modules/configuration.md +++ b/docs/content/en/hugo-modules/configuration.md @@ -1,17 +1,17 @@ --- -title: Configure Modules +title: Configure Hugo modules description: This page describes the configuration options for a module. categories: [hugo modules] keywords: [themes, source, organization, directories] menu: docs: parent: modules - weight: 10 -weight: 10 + weight: 20 +weight: 20 toc: true --- -## Module Config: Top level +## Module configuration: top level {{< code-toggle file="hugo" >}} [module] @@ -39,10 +39,10 @@ private : Comma separated glob list matching paths that should be treated as private. workspace -: The workspace file to use. This enables Go workspace mode. Note that this can also be set via OS env, e.g. `export HUGO_MODULE_WORKSPACE=/my/hugo.work` This only works with Go 1.18+. In Hugo `v0.109.0` we changed the default to `off` and we now resolve any relative work filenames relative to the working directory. +: The workspace file to use. This enables Go workspace mode. Note that this can also be set via OS env, e.g. `export HUGO_MODULE_WORKSPACE=/my/hugo.work` This only works with Go 1.18+. In Hugo `v0.109.0` we changed the default to `off` and we now resolve any relative work file names relative to the working directory. replacements -: A comma-separated list of mappings from module paths to directories, e.g. `github.com/bep/my-theme -> ../..,github.com/bep/shortcodes -> /some/path`. This is mostly useful for temporary local development of a module, in which case you might want to save it as an environment variable, e.g: `env HUGO_MODULE_REPLACEMENTS="github.com/bep/my-theme -> ../.."`. Relative paths are relative to [themesDir](https://gohugo.io/getting-started/configuration/#all-configuration-settings). Absolute paths are allowed. +: A comma-separated list of mappings from module paths to directories, e.g. `github.com/bep/my-theme -> ../..,github.com/bep/shortcodes -> /some/path`. This is mostly useful for temporary local development of a module, in which case you might want to save it as an environment variable, e.g: `env HUGO_MODULE_REPLACEMENTS="github.com/bep/my-theme -> ../.."`. Relative paths are relative to [themesDir](/getting-started/configuration/#all-configuration-settings). Absolute paths are allowed. Note that the above terms maps directly to their counterparts in Go Modules. Some of these setting may be natural to set as OS environment variables. To set the proxy server to use, as an example: @@ -52,7 +52,7 @@ env HUGO_MODULE_PROXY=https://proxy.example.org hugo {{< gomodules-info >}} -## Module Config: hugoVersion +## Module configuration: hugoVersion If your module requires a particular version of Hugo to work, you can indicate that in the `module` section and the user will be warned if using a too old/new version. @@ -76,7 +76,7 @@ max extended : Whether the extended version of Hugo is required. -## Module Config: imports +## Module configuration: imports {{< code-toggle file="hugo" >}} [module] @@ -109,10 +109,10 @@ noVendor {{< gomodules-info >}} -## Module Config: mounts +## Module configuration: mounts {{% note %}} -When the `mounts` config was introduced in Hugo 0.56.0, we were careful to preserve the existing `contentDir`, `staticDir`, and similar configuration to make sure all existing sites just continued to work. But you should not have both: if you add a `mounts` section you should remove the old `contentDir`, `staticDir`, etc. settings. +When the `mounts` configuration was introduced in Hugo 0.56.0, we were careful to preserve the existing `contentDir`, `staticDir`, and similar configuration to make sure all existing sites just continued to work. But you should not have both: if you add a `mounts` section you should remove the old `contentDir`, `staticDir`, etc. settings. {{% /note %}} {{% note %}} @@ -157,7 +157,7 @@ lang includeFiles (string or slice) : One or more [glob](https://github.com/gobwas/glob) patterns matching files or directories to include. If `excludeFiles` is not set, the files matching `includeFiles` will be the files mounted. -The glob patterns are matched to the filenames starting from the `source` root, they should have Unix styled slashes even on Windows, `/` matches the mount root and `**` can be used as a super-asterisk to match recursively down all directories, e.g `/posts/**.jpg`. +The glob patterns are matched to the file names starting from the `source` root, they should have Unix styled slashes even on Windows, `/` matches the mount root and `**` can be used as a super-asterisk to match recursively down all directories, e.g `/posts/**.jpg`. The search is case-insensitive. diff --git a/docs/content/en/hugo-modules/theme-components.md b/docs/content/en/hugo-modules/theme-components.md index d0005c8e8..d0a986b7e 100644 --- a/docs/content/en/hugo-modules/theme-components.md +++ b/docs/content/en/hugo-modules/theme-components.md @@ -1,17 +1,20 @@ --- -title: Theme Components +title: Theme components description: Hugo provides advanced theming support with Theme Components. categories: [hugo modules] keywords: [themes, theme, source, organization, directories] menu: docs: parent: modules - weight: 50 -weight: 50 + weight: 40 +weight: 40 aliases: [/themes/customize/,/themes/customizing/] toc: true --- + + + {{% note %}} This section contain information that may be outdated and is in the process of being rewritten. {{% /note %}} @@ -40,6 +43,6 @@ Also note that a component that is part of a theme can have its own configuratio * `menu` (global and per language) * `outputformats` and `mediatypes` -The same rules apply here: The left-most param/menu etc. with the same ID will win. There are some hidden and experimental namespace support in the above, which we will work to improve in the future, but theme authors are encouraged to create their own namespaces to avoid naming conflicts. +The same rules apply here: The left-most parameter/menu etc. with the same ID will win. There are some hidden and experimental namespace support in the above, which we will work to improve in the future, but theme authors are encouraged to create their own namespaces to avoid naming conflicts. [^1]: For themes hosted on the [Hugo Themes Showcase](https://themes.gohugo.io/) components need to be added as git submodules that point to the directory `exampleSite/themes` diff --git a/docs/content/en/hugo-modules/use-modules.md b/docs/content/en/hugo-modules/use-modules.md index a33bf844e..27a1f6051 100644 --- a/docs/content/en/hugo-modules/use-modules.md +++ b/docs/content/en/hugo-modules/use-modules.md @@ -6,8 +6,8 @@ keywords: [install, themes, source, organization, directories,usage,modules] menu: docs: parent: modules - weight: 20 -weight: 20 + weight: 30 +weight: 30 aliases: [/themes/usage/,/themes/installing/,/installing-and-using-themes/] toc: true --- @@ -16,7 +16,7 @@ toc: true {{< gomodules-info >}} -## Initialize a New Module +## Initialize a new module Use `hugo mod init` to initialize a new Hugo Module. If it fails to guess the module path, you must provide it as an argument, e.g.: @@ -26,9 +26,9 @@ hugo mod init github.com/gohugoio/myShortcodes Also see the [CLI Doc](/commands/hugo_mod_init/). -## Use a Module for a Theme +## Use a module for a theme -The easiest way to use a Module for a theme is to import it in the config. +The easiest way to use a Module for a theme is to import it in the configuration. 1. Initialize the hugo module system: `hugo mod init github.com/<your_user>/<your_project>` 2. Import the theme: @@ -39,33 +39,33 @@ The easiest way to use a Module for a theme is to import it in the config. path = "github.com/spf13/hyde" {{< /code-toggle >}} -## Update Modules +## Update modules -Modules will be downloaded and added when you add them as imports to your configuration, see [Module Imports](/hugo-modules/configuration/#module-config-imports). +Modules will be downloaded and added when you add them as imports to your configuration, see [Module Imports](/hugo-modules/configuration/#module-configuration-imports). To update or manage versions, you can use `hugo mod get`. Some examples: -### Update All Modules +### Update all modules ```bash hugo mod get -u ``` -### Update All Modules Recursively +### Update all modules recursively ```bash hugo mod get -u ./... ``` -### Update One Module +### Update one module ```bash hugo mod get -u github.com/gohugoio/myShortcodes ``` -### Get a Specific Version +### Get a specific version ```bash hugo mod get github.com/gohugoio/[email protected] @@ -83,9 +83,9 @@ replace github.com/bep/hugotestmods/mypartials => /Users/bep/hugotestmods/mypart If you have the `hugo server` running, the configuration will be reloaded and `/Users/bep/hugotestmods/mypartials` put on the watch list. -Instead of modifying the `go.mod` files, you can also use the modules config [`replacements`](https://gohugo.io/hugo-modules/configuration/#module-config-top-level) option. +Instead of modifying the `go.mod` files, you can also use the modules configuration [`replacements`](/hugo-modules/configuration/#module-configuration-top-level) option. -## Print Dependency Graph +## Print dependency graph Use `hugo mod graph` from the relevant module directory and it will print the dependency graph, including vendoring, module replacement or disabled status. @@ -106,7 +106,7 @@ github.com/bep/my-modular-site in-themesdir Also see the [CLI Doc](/commands/hugo_mod_graph/). -## Vendor Your Modules +## Vendor your modules `hugo mod vendor` will write all the module dependencies to a `_vendor` folder, which will then be used for all subsequent builds. @@ -124,7 +124,7 @@ Run `hugo mod tidy` to remove unused entries in `go.mod` and `go.sum`. Also see the [CLI Doc](/commands/hugo_mod_clean/). -## Clean Module Cache +## Clean module cache Run `hugo mod clean` to delete the entire modules cache. @@ -132,7 +132,7 @@ Note that you can also configure the `modules` cache with a `maxAge`, see [File Also see the [CLI Doc](/commands/hugo_mod_clean/). -## Module Workspaces +## Module workspaces {{< new-in "0.109.0" >}} @@ -144,7 +144,7 @@ A workspace can be configured in a `*.work` file and activated with the [module. See the [hugo.work](https://github.com/gohugoio/hugo/blob/master/hugo.work) file in the Hugo Docs repo for an example: -``` +```text go 1.19 use . @@ -155,7 +155,7 @@ Using the `use` directive, list all the modules you want to work on, pointing to With that you can start the Hugo server with that workspace enabled: -``` +```bash HUGO_MODULE_WORKSPACE=hugo.work hugo server --ignoreVendorPaths "**" ``` diff --git a/docs/content/en/hugo-pipes/_index.md b/docs/content/en/hugo-pipes/_index.md index 438ee2fe0..b649a5bf6 100755 --- a/docs/content/en/hugo-pipes/_index.md +++ b/docs/content/en/hugo-pipes/_index.md @@ -1,10 +1,12 @@ --- -title: Hugo Pipes Overview +title: Hugo Pipes +linkTitle: Overview categories: [asset management] keywords: [] menu: docs: - parent: pipes + identifier: hugo-pipes-overview + parent: hugo-pipes weight: 10 weight: 10 --- diff --git a/docs/content/en/hugo-pipes/babel.md b/docs/content/en/hugo-pipes/babel.md index 1762f85e5..222b5116b 100755 --- a/docs/content/en/hugo-pipes/babel.md +++ b/docs/content/en/hugo-pipes/babel.md @@ -5,9 +5,9 @@ categories: [asset management] keywords: [] menu: docs: - parent: pipes - weight: 48 -weight: 48 + parent: hugo-pipes + weight: 70 +weight: 70 signature: ["resources.Babel RESOURCE [OPTIONS]", "babel RESOURCE [OPTIONS]"] --- @@ -22,7 +22,7 @@ Hugo Pipe's Babel requires the `@babel/cli` and `@babel/core` JavaScript package If you are using the Hugo Snap package, Babel and plugin(s) need to be installed locally within your Hugo site directory, e.g., `npm install @babel/cli @babel/core --save-dev` without the `-g` flag. {{% /note %}} -### Config +### configuration We add the main project's `node_modules` to `NODE_PATH` when running Babel and similar tools. There are some known [issues](https://github.com/babel/babel/issues/5618) with Babel in this area, so if you have a `babel.config.js` living in a Hugo Module (and not in the project itself), we recommend using `require` to load the presets/plugins, e.g.: @@ -59,7 +59,7 @@ verbose [bool] : Log everything sourceMap [string] -: Output `inline` or `external` sourcemap from the babel compile. External sourcemaps will be written to the target with the output filename + ".map". Input sourcemaps can be read from js.Build and node modules and combined into the output sourcemaps. +: Output `inline` or `external` sourcemap from the babel compile. External sourcemaps will be written to the target with the output file name + ".map". Input sourcemaps can be read from js.Build and node modules and combined into the output sourcemaps. ### Examples diff --git a/docs/content/en/hugo-pipes/bundling.md b/docs/content/en/hugo-pipes/bundling.md index ae625537a..8b9899432 100755 --- a/docs/content/en/hugo-pipes/bundling.md +++ b/docs/content/en/hugo-pipes/bundling.md @@ -6,9 +6,9 @@ categories: [asset management] keywords: [] menu: docs: - parent: pipes - weight: 60 -weight: 60 + parent: hugo-pipes + weight: 90 +weight: 90 signature: ["resources.Concat TARGET_PATH SLICE_RESOURCES"] --- diff --git a/docs/content/en/hugo-pipes/fingerprint.md b/docs/content/en/hugo-pipes/fingerprint.md index d002dd3e2..bdabbe029 100755 --- a/docs/content/en/hugo-pipes/fingerprint.md +++ b/docs/content/en/hugo-pipes/fingerprint.md @@ -1,14 +1,14 @@ --- title: Fingerprint -linkTitle: Fingerprinting and SRI +linkTitle: Fingerprinting and SRI hashing description: Process a given resource, adding a hash string of the resource's content. categories: [asset management] keywords: [] menu: docs: - parent: pipes - weight: 70 -weight: 70 + parent: hugo-pipes + weight: 100 +weight: 100 signature: ["resources.Fingerprint RESOURCE [ALGORITHM]", "fingerprint RESOURCE [ALGORITHM]"] --- diff --git a/docs/content/en/hugo-pipes/introduction.md b/docs/content/en/hugo-pipes/introduction.md index 6e4cd76fb..fb93e5649 100755 --- a/docs/content/en/hugo-pipes/introduction.md +++ b/docs/content/en/hugo-pipes/introduction.md @@ -1,34 +1,34 @@ --- -title: Hugo Pipes Introduction -linkTitle: Hugo Pipes +title: Hugo Pipes +linkTitle: Introduction description: Hugo Pipes is Hugo's asset processing set of functions. categories: [asset management] keywords: [] menu: docs: - parent: pipes + parent: hugo-pipes weight: 20 -weight: 01 +weight: 20 toc: true aliases: [/assets/] --- -## Find Resources in /assets +## Find resources in /assets This is about the global Resources mounted inside `/assets`. For the `.Page` scoped Resources, see [Page Resources](/content-management/page-resources/). -Note that you can mount any directory into Hugo's virtual `assets` folder using the [Mount Configuration](/hugo-modules/configuration/#module-config-mounts). +Note that you can mount any directory into Hugo's virtual `assets` folder using the [Mount Configuration](/hugo-modules/configuration/#module-configuration-mounts). | Function | Description | | ------------- | ------------- | -| `resources.Get` | Get locates the filename given in Hugo's assets filesystem and creates a `Resource` object that can be used for further transformations. See [Get Resource with resources.Get and resources.GetRemote](#get-resource-with-resourcesget-and-resourcesgetremote). | -| `resources.GetRemote` | Same as `Get`, but it accepts remote URLs. See [Get Resource with resources.Get and resources.GetRemote](#get-resource-with-resourcesget-and-resourcesgetremote).| +| `resources.Get` | Get locates the file name given in Hugo's assets filesystem and creates a `Resource` object that can be used for further transformations. See [Get a resource](#get-a-resource). | +| `resources.GetRemote` | Same as `Get`, but it accepts remote URLs. See [Get a resource](#get-a-resource).| | `resources.GetMatch` | `GetMatch` finds the first Resource matching the given pattern, or nil if none found. See Match for a more complete explanation about the rules used. | | `resources.Match` | `Match` gets all resources matching the given base path prefix, e.g "*.png" will match all png files. The "*" does not match path delimiters (/), so if you organize your resources in sub-folders, you need to be explicit about it, e.g.: "images/*.png". To match any PNG image anywhere in the bundle you can do "\*\*.png", and to match all PNG images below the images folder, use "images/\*\*.jpg". The matching is case insensitive. Match matches by using the files name with path relative to the file system root with Unix style slashes (/) and no leading slash, e.g. "images/logo.png". See https://github.com/gobwas/glob for the full rules set.| See the [GoDoc Page](https://pkg.go.dev/github.com/gohugoio/[email protected]/tpl/resources) for the `resources` package for an up to date overview of all template functions in this namespace. -## Get Resource with resources.Get and resources.GetRemote +## Get a resource In order to process an asset with Hugo Pipes, it must be retrieved as a `Resource` using `resources.Get` or `resources.GetRemote`. @@ -71,7 +71,7 @@ By default, Hugo calculates a cache key based on the `URL` and the `options` (e. {{ $resource := resource.GetRemote $url (dict "key" $cacheKey) }} ``` -### Error Handling +### Error handling The return value from `resources.GetRemote` includes an `.Err` method that will return an error if the call failed. If you want to just log any error as a `WARNING` you can use a construct similar to the one below. @@ -87,7 +87,7 @@ The return value from `resources.GetRemote` includes an `.Err` method that will Note that if you do not handle `.Err` yourself, Hugo will fail the build the first time you start using the `Resource` object. -### Remote Options +### Remote options When fetching a remote `Resource`, `resources.GetRemote` takes an optional options map as the second argument, e.g.: @@ -113,15 +113,15 @@ You can also change the request method and set the request body: )}} ``` -### Caching of Remote Resources +### Caching of remote resources Remote resources fetched with `resources.GetRemote` will be cached on disk. See [Configure File Caches](/getting-started/configuration/#configure-file-caches) for details. -## Copy a Resource +## Copy a resource {{< new-in "0.100.0" >}} -`resources.Copy` allows you to copy almost any Hugo `Resource` (the one exception is the `Page`), possibly most useful for renaming things: +Use `resources.Copy` to copy a page resource or a global resource. Commonly used to change a resource's published path, `resources.Copy` takes two arguments: the target path relative to the root of the `publishDir` (with or without a leading `/`), and the resource to copy. ```go-html-template {{ with resources.Get "img/a.jpg" }} @@ -141,7 +141,7 @@ The target path must be different than the source path, as shown in the example Asset files must be stored in the asset directory. This is `/assets` by default, but can be configured via the configuration file's `assetDir` key. -### Asset Publishing +### Asset publishing Hugo publishes assets to the `publishDir` (typically `public`) when you invoke `.Permalink`, `.RelPermalink`, or `.Publish`. You can use `.Content` to inline the asset. diff --git a/docs/content/en/hugo-pipes/js.md b/docs/content/en/hugo-pipes/js.md index c880ac6fa..86c1564cf 100644 --- a/docs/content/en/hugo-pipes/js.md +++ b/docs/content/en/hugo-pipes/js.md @@ -1,14 +1,14 @@ --- title: js.Build -linkTitle: JavaScript Building +linkTitle: JavaScript building description: Process a JavaScript file with [ESBuild](https://github.com/evanw/esbuild). categories: [asset management] keywords: [] menu: docs: - parent: pipes - weight: 45 -weight: 45 + parent: hugo-pipes + weight: 60 +weight: 60 signature: ["js.Build RESOURCE [OPTIONS]"] --- @@ -34,7 +34,7 @@ And then in your JS file: import * as params from '@params'; ``` -Note that this is meant for small data sets, e.g. config settings. For larger data, please put/mount the files into `/assets` and import them directly. +Note that this is meant for small data sets, e.g. configuration settings. For larger data, please put/mount the files into `/assets` and import them directly. minify [bool] : Let `js.Build` handle the minification. @@ -91,7 +91,7 @@ format [string] Default is `iife`, a self-executing function, suitable for inclusion as a <script> tag. sourceMap [string] -: Whether to generate `inline` or `external` source maps from esbuild. External source maps will be written to the target with the output filename + ".map". Input source maps can be read from js.Build and node modules and combined into the output source maps. By default, source maps are not created. +: Whether to generate `inline` or `external` source maps from esbuild. External source maps will be written to the target with the output file name + ".map". Input source maps can be read from js.Build and node modules and combined into the output source maps. By default, source maps are not created. ### Import JS code from /assets @@ -137,7 +137,7 @@ import * as params from '@params'; Hugo will, by default, generate a `assets/jsconfig.json` file that maps the imports. This is useful for navigation/intellisense help inside code editors, but if you don't need/want it, you can [turn it off](/getting-started/configuration/#configure-build). -### Include Dependencies In package.json / node_modules +### Include dependencies In package.json / node_modules Any imports in a file outside `/assets` or that does not resolve to a component inside `/assets` will be resolved by [ESBuild](https://esbuild.github.io/) with the **project directory** as the resolve directory (used as the starting point when looking for `node_modules` etc.). Also see [hugo mod npm pack](/commands/hugo_mod_npm_pack/). If you have any imported npm dependencies in your project, you need to make sure to run `npm install` before you run `hugo`. diff --git a/docs/content/en/hugo-pipes/minification.md b/docs/content/en/hugo-pipes/minification.md index 100bd3353..a32ef6e6f 100755 --- a/docs/content/en/hugo-pipes/minification.md +++ b/docs/content/en/hugo-pipes/minification.md @@ -6,9 +6,9 @@ categories: [asset management] keywords: [] menu: docs: - parent: pipes - weight: 50 -weight: 50 + parent: hugo-pipes + weight: 80 +weight: 80 signature: ["resources.Minify RESOURCE", "minify RESOURCE"] --- diff --git a/docs/content/en/hugo-pipes/postcss.md b/docs/content/en/hugo-pipes/postcss.md index 0804c1072..4e969caf2 100755 --- a/docs/content/en/hugo-pipes/postcss.md +++ b/docs/content/en/hugo-pipes/postcss.md @@ -5,7 +5,7 @@ categories: [asset management] keywords: [] menu: docs: - parent: pipes + parent: hugo-pipes weight: 40 toc: true weight: 40 @@ -114,7 +114,7 @@ syntax ## Check Hugo environment -The current Hugo environment name (set by `--environment` or in config or OS environment) is available in the Node context, which allows constructs like this: +The current Hugo environment name (set by `--environment` or in configuration or OS environment) is available in the Node context, which allows constructs like this: {{< code file="postcss.config.js" >}} module.exports = { diff --git a/docs/content/en/hugo-pipes/postprocess.md b/docs/content/en/hugo-pipes/postprocess.md index f90b9854b..d82c892ce 100755 --- a/docs/content/en/hugo-pipes/postprocess.md +++ b/docs/content/en/hugo-pipes/postprocess.md @@ -5,9 +5,9 @@ categories: [asset management] keywords: [] menu: docs: - parent: pipes - weight: 39 -weight: 39 + parent: hugo-pipes + weight: 50 +weight: 50 signature: ["resources.PostProcess RESOURCE"] --- @@ -36,11 +36,17 @@ There are several ways to set up CSS purging with PostCSS in Hugo. If you have a The below configuration will write a `hugo_stats.json` file to the project root as part of the build. If you're only using this for the production build, you should consider placing it below [config/production](/getting-started/configuration/#configuration-directory). +<!-- TODO (jmm) writeStats => build.buildStats --> + {{< code-toggle file="hugo" >}} -[build] - writeStats = true +[build.buildStats] + enable = true {{< /code-toggle >}} +See the [configure build] documentation for details and options. + +[configure build]: /getting-started/configuration/#configure-build + `postcss.config.js` ```js @@ -71,7 +77,7 @@ Note that in the example above, the "CSS purge step" will only be applied to the ``` -## Hugo Environment variables available in PostCSS +## Hugo environment variables available in PostCSS These are the environment variables Hugo passes down to PostCSS (and Babel), which allows you do do `process.env.HUGO_ENVIRONMENT === 'production' ? [autoprefixer] : []` and similar: @@ -83,7 +89,7 @@ HUGO_ENVIRONMENT (and the alias HUGO_ENV) HUGO_PUBLISHDIR : {{< new-in "0.109.0" >}} The absolute path to the publish directory (the `public` directory). Note that the value will always point to a directory on disk even when running `hugo server` in memory mode. If you write to this folder from PostCSS when running the server, you could run the server with one of these flags: -``` +```text hugo server --renderToDisk hugo server --renderStaticToDisk ``` diff --git a/docs/content/en/hugo-pipes/resource-from-string.md b/docs/content/en/hugo-pipes/resource-from-string.md index 221898dba..f3f0cda4f 100755 --- a/docs/content/en/hugo-pipes/resource-from-string.md +++ b/docs/content/en/hugo-pipes/resource-from-string.md @@ -1,14 +1,14 @@ --- title: FromString -linkTitle: Resource from String +linkTitle: Resource from string description: Creates a resource from a string. categories: [asset management] keywords: [] menu: docs: - parent: pipes - weight: 90 -weight: 90 + parent: hugo-pipes + weight: 110 +weight: 110 signature: ["resources.FromString TARGET_PATH CONTENT"] --- @@ -16,6 +16,8 @@ signature: ["resources.FromString TARGET_PATH CONTENT"] It is possible to create a resource directly from the template using `resources.FromString` which takes two arguments, the target path for the created resource and the given content string. +The result is cached using the target path as the cache key. + The following example creates a resource file containing localized variables for every project's languages. ```go-html-template diff --git a/docs/content/en/hugo-pipes/resource-from-template.md b/docs/content/en/hugo-pipes/resource-from-template.md index 778eb0341..4f34817c0 100755 --- a/docs/content/en/hugo-pipes/resource-from-template.md +++ b/docs/content/en/hugo-pipes/resource-from-template.md @@ -1,14 +1,14 @@ --- title: ExecuteAsTemplate -linkTitle: Resource from Template +linkTitle: Resource from template description: Creates a resource from a template categories: [asset management] keywords: [] menu: docs: - parent: pipes - weight: 80 -weight: 80 + parent: hugo-pipes + weight: 120 +weight: 120 signature: ["resources.ExecuteAsTemplate TARGET_PATH CONTEXT RESOURCE"] --- @@ -16,7 +16,7 @@ signature: ["resources.ExecuteAsTemplate TARGET_PATH CONTEXT RESOURCE"] In order to use Hugo Pipes function on an asset file containing Go Template magic the function `resources.ExecuteAsTemplate` must be used. -The function takes three arguments: the target path for the created resource, the template context, and the resource object. +The function takes three arguments: the target path for the created resource, the template context, and the resource object. The target path is used to cache the result. ```go-html-template // assets/sass/template.scss diff --git a/docs/content/en/hugo-pipes/transform-to-css.md b/docs/content/en/hugo-pipes/transform-to-css.md deleted file mode 100644 index 9af649acb..000000000 --- a/docs/content/en/hugo-pipes/transform-to-css.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: ToCSS -linkTitle: Transpile Sass to SCSS -description: Transpile Sass to CSS. -categories: [asset management] -keywords: [] -menu: - docs: - parent: pipes - weight: 30 -weight: 02 -signature: ["resources.ToCSS RESOURCE [OPTIONS]", "toCSS RESOURCE [OPTIONS]"] ---- - -## Usage - -Any Sass or SCSS file can be transformed into a CSS file using `resources.ToCSS` which takes two arguments, the resource object and a map of options listed below. - -```go-html-template -{{ $sass := resources.Get "sass/main.scss" }} -{{ $style := $sass | resources.ToCSS }} -``` - -### Options - -transpiler [string] - -: The `transpiler` to use, valid values are `libsass` (default) and `dartsass`. If you want to use Hugo with Dart Sass you need to download a release binary from [Embedded Dart Sass](https://github.com/sass/dart-sass-embedded/releases) and make sure it's in your PC's `$PATH` (or `%PATH%` on Windows). - -targetPath [string] -: If not set, the transformed resource's target path will be the asset file original path with its extension replaced by `.css`. - -vars [map] -: Map of key/value pairs that will be available in the `hugo:vars` namespace, e.g. with `@use "hugo:vars" as v;` or (globally) with `@import "hugo:vars";` {{< new-in "0.109.0" >}} - -outputStyle [string] -: Default is `nested` (LibSass) and `expanded` (Dart Sass). Other available output styles for LibSass are `expanded`, `compact` and `compressed`. Dart Sass only supports `expanded` and `compressed`. - -precision [int] -: Precision of floating point math. **Note:** This option is not supported by Dart Sass. - -enableSourceMap [bool] -: When enabled, a source map will be generated. - -sourceMapIncludeSources [bool] -: When enabled, sources will be embedded in the generated source map. (Dart Sass only). {{< new-in "0.108.0" >}} - -includePaths [string slice] -: Additional SCSS/Sass include paths. Paths must be relative to the project directory. - -```go-html-template -{{ $options := (dict "targetPath" "style.css" "outputStyle" "compressed" "enableSourceMap" (not hugo.IsProduction) "includePaths" (slice "node_modules/myscss")) }} -{{ $style := resources.Get "sass/main.scss" | resources.ToCSS $options }} -``` - -{{% note %}} -Setting `outputStyle` to `compressed` will handle Sass/SCSS files minification better than the more generic [`resources.Minify`](/hugo-pipes/minification). -{{% /note %}} diff --git a/docs/content/en/hugo-pipes/transpile-sass-to-css.md b/docs/content/en/hugo-pipes/transpile-sass-to-css.md new file mode 100644 index 000000000..bf3d136f1 --- /dev/null +++ b/docs/content/en/hugo-pipes/transpile-sass-to-css.md @@ -0,0 +1,210 @@ +--- +title: ToCSS +linkTitle: Transpile Sass to CSS +description: Transpile Sass to CSS. +categories: [asset management] +keywords: [] +menu: + docs: + parent: hugo-pipes + weight: 30 +weight: 30 +signature: ["resources.ToCSS RESOURCE [OPTIONS]", "toCSS RESOURCE [OPTIONS]"] +toc: true +aliases: [/hugo-pipes/transform-to-css/] +--- + +## Usage + +Transpile Sass to CSS using the LibSass transpiler included in Hugo's extended edition, or [install Dart Sass](#dart-sass) to use the latest features of the Sass language. + +```go-html-template +{{ $options := dict "transpiler" "libsass" "targetPath" "css/style.css" }} +{{ with resources.Get "sass/main.scss" | toCSS $options | minify | fingerprint }} + <link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"> +{{ end }} +``` + +Sass has two forms of syntax: [SCSS] and [indented]. Hugo supports both. + +[scss]: https://sass-lang.com/documentation/syntax#scss +[indented]: https://sass-lang.com/documentation/syntax#the-indented-syntax + + +## Options + +transpiler +: (`string`) The transpiler to use, either `libsass` (default) or `dartsass`. Hugo's extended edition includes the LibSass transpiler. To use the Dart Sass transpiler, see the [installation instructions](#dart-sass) below. + +targetPath +: (`string`) If not set, the transformed resource's target path will be the original path of the asset file with its extension replaced by `.css`. + +vars {{< new-in "0.109.0" >}} +: (`map`) A map of key/value pairs that will be available in the `hugo:vars` namespace. Useful for [initializing Sass variables from Hugo templates](https://discourse.gohugo.io/t/42053/). + +```scss +// LibSass +@import "hugo:vars"; + +// Dart Sass +@use "hugo:vars" as v; +``` + +outputStyle +: (`string`) Output styles available to LibSass include `nested` (default), `expanded`, `compact`, and `compressed`. Output styles available to Dart Sass include `expanded` (default) and `compressed`. + +precision +: (`int`) Precision of floating point math. Not applicable to Dart Sass. + +enableSourceMap +: (`bool`) If `true`, generates a source map. + +sourceMapIncludeSources {{< new-in "0.108.0" >}} +: (`bool`) If `true`, embeds sources in the generated source map. Not applicable to LibSass. + +includePaths +: (`slice`) A slice of paths, relative to the project root, that the transpiler will use when resolving `@use` and `@import` statements. + +```go-html-template +{{ $options := dict + "transpiler" "dartsass" + "targetPath" "css/style.css" + "vars" site.Params.styles + "enableSourceMap" (not hugo.IsProduction) + "includePaths" (slice "node_modules/bootstrap/scss") +}} +{{ with resources.Get "sass/main.scss" | toCSS $options | minify | fingerprint }} + <link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"> +{{ end }} +``` + +## Dart Sass + +The extended version of Hugo includes [LibSass] to transpile Sass to CSS. In 2020, the Sass team deprecated LibSass in favor of [Dart Sass]. + +Use the latest features of the Sass language by installing Dart Sass in your development and production environments. + +### Installation overview + +Dart Sass is compatible with Hugo v0.114.0 and later. + +If you have been using Embedded Dart Sass[^1] with Hugo v0.113.0 and earlier, uninstall Embedded Dart Sass, then install Dart Sass. If you have installed both, Hugo will use Dart Sass. + +If you install Hugo as a [Snap package] there is no need to install Dart Sass. The Hugo Snap package includes Dart Sass. + +[^1]: In 2023, the Sass team deprecated Embedded Dart Sass in favor of Dart Sass. + +### Installing in a development environment + +When you install Dart Sass somewhere in your PATH, Hugo will find it. + +OS|Package manager|Site|Installation +:--|:--|:--|:-- +Linux|Homebrew|[brew.sh]|`brew install sass/sass/sass` +Linux|Snap|[snapcraft.io]|`sudo snap install dart-sass` +macOS|Homebrew|[brew.sh]|`brew install sass/sass/sass` +Windows|Chocolatey|[chocolatey.org]|`choco install sass` +Windows|Scoop|[scoop.sh]|`scoop install sass` + +You may also install [prebuilt binaries] for Linux, macOS, and Windows. + +Run `hugo env` to list the active transpilers. + +### Installing in a production environment + +For [CI/CD] deployments (e.g., GitHub Pages, GitLab Pages, Netlify, etc.) you must edit the workflow to install Dart Sass before Hugo builds the site[^2]. Some providers allow you to use one of the package managers above, or you can download and extract one of the prebuilt binaries. + +[^2]: You do not have to do this if (a) you have not modified the assets cache location, and (b) you have not set `useResourceCacheWhen` to `never` in your [site configuration], and (c) you add and commit your resources directory to your repository. + +#### GitHub Pages + +To install Dart Sass for your builds on GitHub Pages, add this step to the GitHub Pages workflow file: + +```yaml +- name: Install Dart Sass + run: sudo snap install dart-sass +``` + +If you are using GitHub Pages for the first time with your repository, GitHub provides a [starter workflow] for Hugo that includes Dart Sass. This is the simplest way to get started. + +#### GitLab Pages + +To install Dart Sass for your builds on GitLab Pages, the `.gitlab-ci.yml` file should look something like this: + +```yaml +variables: + HUGO_VERSION: 0.115.1 + DART_SASS_VERSION: 1.63.6 + GIT_DEPTH: 0 + GIT_STRATEGY: clone + GIT_SUBMODULE_STRATEGY: recursive + TZ: America/Los_Angeles +image: + name: golang:1.20-buster +pages: + script: + # Install Dart Sass + - curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz + - tar -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz + - cp -r dart-sass/* /usr/local/bin + - rm -rf dart-sass* + # Install Hugo + - curl -LJO https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb + - apt install -y ./hugo_extended_${HUGO_VERSION}_linux-amd64.deb + - rm hugo_extended_${HUGO_VERSION}_linux-amd64.deb + # Build + - hugo --gc --minify + artifacts: + paths: + - public + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH +``` + +#### Netlify + +To install Dart Sass for your builds on Netlify, the `netlify.toml` file should look something like this: + +```toml +[build.environment] +HUGO_VERSION = "0.115.1" +DART_SASS_VERSION = "1.63.6" +TZ = "America/Los_Angeles" + +[build] +publish = "public" +command = """\ + curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz && \ + tar -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz && \ + rm dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz && \ + export PATH=/opt/build/repo/dart-sass:$PATH && \ + hugo --gc --minify \ + """ +``` + +### Example + +To transpile with Dart Sass, set `transpiler` to `dartsass` in the options map passed to `resources.ToCSS`. For example: + +```go-html-template +{{ $options := dict "transpiler" "dartsass" "targetPath" "css/style.css" }} +{{ with resources.Get "sass/main.scss" | toCSS $options | minify | fingerprint }} + <link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"> +{{ end }} +``` + +### Miscellaneous + +If you build Hugo from source and run `mage test -v`, the test will fail if you install Dart Sass as a Snap package. This is due to the Snap package's strict confinement model. + +[brew.sh]: https://brew.sh/ +[chocolatey.org]: https://community.chocolatey.org/packages/sass +[ci/cd]: https://en.wikipedia.org/wiki/CI/CD +[dart sass]: https://sass-lang.com/dart-sass +[libsass]: https://sass-lang.com/libsass +[prebuilt binaries]: https://github.com/sass/dart-sass/releases/latest +[scoop.sh]: https://scoop.sh/#/apps?q=sass +[site configuration]: /getting-started/configuration/#configure-build +[snap package]: /installation/linux/#snap +[snapcraft.io]: https://snapcraft.io/dart-sass +[starter workflow]: https://github.com/actions/starter-workflows/blob/main/pages/hugo.yml diff --git a/docs/content/en/installation/_index.md b/docs/content/en/installation/_index.md index 3a7713dd5..e2d2c96a3 100644 --- a/docs/content/en/installation/_index.md +++ b/docs/content/en/installation/_index.md @@ -1,14 +1,16 @@ --- title: Installation -linkTitle: Installation overview +linkTitle: Overview description: Install Hugo on macOS, Linux, Windows, BSD, and on any machine that can run the Go compiler tool chain. aliases: [/getting-started/installing/] categories: [installation] keywords: [installation] menu: docs: + identifier: installation-overview parent: installation weight: 10 +weight: 10 --- {{% param "description" %}} diff --git a/docs/content/en/installation/common/01-editions.md b/docs/content/en/installation/common/01-editions.md index ee9f3ff93..cbc338665 100644 --- a/docs/content/en/installation/common/01-editions.md +++ b/docs/content/en/installation/common/01-editions.md @@ -2,7 +2,11 @@ Hugo is available in two editions: standard and extended. With the extended edition you can: -- Encode WebP images (you can decode WebP images with both editions) -- Transpile Sass to CSS using the embedded LibSass transpiler +- Encode to the WebP format when [processing images]. You can decode WebP images with either edition. +- [Transpile Sass to CSS] using the embedded LibSass transpiler. The extended edition is not required to use the [Dart Sass] transpiler. We recommend that you install the extended edition. + +[dart sass]: /hugo-pipes/transpile-sass-to-css/#dart-sass +[processing images]: /content-management/image-processing/ +[transpile sass to css]: /hugo-pipes/transpile-sass-to-css/ diff --git a/docs/content/en/installation/common/02-prerequisites.md b/docs/content/en/installation/common/02-prerequisites.md index 008370825..423950113 100644 --- a/docs/content/en/installation/common/02-prerequisites.md +++ b/docs/content/en/installation/common/02-prerequisites.md @@ -1,27 +1,36 @@ ## Prerequisites -Although not required in all cases, Git and Go are often used when working with Hugo. +Although not required in all cases, [Git], [Go], and [Dart Sass] are commonly used when working with Hugo. Git is required to: -- Use the [Hugo Modules] feature - Build Hugo from source +- Use the [Hugo Modules] feature - Install a theme as a Git submodule - Access [commit information] from a local Git repository -- Host your site with services such as [AWS Amplify], [CloudCannon], [Cloudflare Pages], [GitHub Pages], [GitLab Pages], and [Netlify]. +- Host your site with services such as [CloudCannon], [Cloudflare Pages], [GitHub Pages], [GitLab Pages], and [Netlify] Go is required to: -- Use the Hugo Modules feature - Build Hugo from source +- Use the Hugo Modules feature + +Dart Sass is required to transpile Sass to CSS when using the latest features of the Sass language. + +Please refer to the relevant documentation for installation instructions: -Please refer to the [Git] and [Go] documentation for installation instructions. +- [Git][git install] +- [Go][go install] +- [Dart Sass][dart sass install] -[AWS Amplify]: https://aws.amazon.com/amplify/ -[CloudCannon]: https://cloudcannon.com/ -[Cloudflare Pages]: https://pages.cloudflare.com/ -[Git]: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git -[GitHub Pages]: https://pages.github.com/ -[GitLab Pages]: https://docs.gitlab.com/ee/user/project/pages/ -[Go]: https://go.dev/doc/install -[Netlify]: https://www.netlify.com/ +[cloudcannon]: https://cloudcannon.com/ +[cloudflare pages]: https://pages.cloudflare.com/ +[dart sass install]: /hugo-pipes/transpile-sass-to-css/#dart-sass +[dart sass]: https://sass-lang.com/dart-sass +[git install]: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git +[git]: https://git-scm.com/ +[github pages]: https://pages.github.com/ +[gitlab pages]: https://docs.gitlab.com/ee/user/project/pages/ +[go install]: https://go.dev/doc/install +[go]: https://go.dev/ +[netlify]: https://www.netlify.com/ diff --git a/docs/content/en/installation/common/03-prebuilt-binaries.md b/docs/content/en/installation/common/03-prebuilt-binaries.md index f821f79a2..884869e1e 100644 --- a/docs/content/en/installation/common/03-prebuilt-binaries.md +++ b/docs/content/en/installation/common/03-prebuilt-binaries.md @@ -13,7 +13,7 @@ Please consult your operating system documentation if you need help setting file If you do not see a prebuilt binary for the desired edition, operating system, and architecture, install Hugo using one of the methods described below. -[commit information]: https://gohugo.io/variables/git +[commit information]: /variables/git [edition]: #editions [Git]: https://git-scm.com/ [Go]: https://go.dev/ diff --git a/docs/content/en/installation/linux.md b/docs/content/en/installation/linux.md index eafbe2125..11c6795f1 100644 --- a/docs/content/en/installation/linux.md +++ b/docs/content/en/installation/linux.md @@ -29,6 +29,18 @@ This will install the extended edition of Hugo: sudo snap install hugo ``` +To enable access to removable media: + +```sh +sudo snap connect hugo:removable-media +``` + +To revoke access to removable media: + +```sh +sudo snap disconnect hugo:removable-media +``` + [most distributions]: https://snapcraft.io/docs/installing-snapd [strictly confined]: https://snapcraft.io/docs/snap-confinement [Snap]: https://snapcraft.io/ diff --git a/docs/content/en/news/0.62.0-relnotes/index.md b/docs/content/en/news/0.62.0-relnotes/index.md index 71f01145d..a3587013a 100644 --- a/docs/content/en/news/0.62.0-relnotes/index.md +++ b/docs/content/en/news/0.62.0-relnotes/index.md @@ -1,7 +1,7 @@ --- date: 2019-12-23 -title: "Hugo Christmas Edition!" +title: Hugo Christmas edition! description: "Hugo 0.62 brings Markdown Render Hooks. And it's faster!" categories: ["Releases"] --- @@ -76,8 +76,3 @@ Hugo now has: * Fix abs path handling in module mounts [ad6504e6](https://github.com/gohugoio/hugo/commit/ad6504e6b504277bbc7b60d093cdccd4f3baaa4f) [@bep](https://github.com/bep) [#6622](https://github.com/gohugoio/hugo/issues/6622) * Fix incorrect MIME type from image/jpg to image/jpeg [158e7ec2](https://github.com/gohugoio/hugo/commit/158e7ec204e5149d77893d353cac9f55946d3e9a) [@zaitseff](https://github.com/zaitseff) - - - - - diff --git a/docs/content/en/news/0.71.0-relnotes/index.md b/docs/content/en/news/0.71.0-relnotes/index.md index 07d951bf3..581a76dba 100644 --- a/docs/content/en/news/0.71.0-relnotes/index.md +++ b/docs/content/en/news/0.71.0-relnotes/index.md @@ -1,7 +1,7 @@ --- date: 2020-05-18 -title: "Markdown Render Hooks for Headings" +title: Markdown render hooks for headings description: "Render hooks for headings, update to Go 1.14.3, several bug fixes etc." categories: ["Releases"] --- @@ -43,8 +43,3 @@ Hugo now has: * Fix Babel on Windows [723ec555](https://github.com/gohugoio/hugo/commit/723ec555e75fbfa94d90d3ecbcd5775d6c7800e1) [@bep](https://github.com/bep) [#7251](https://github.com/gohugoio/hugo/issues/7251) * Upgrade chroma to 0.7.3 to fix invalid css [b342e8fb](https://github.com/gohugoio/hugo/commit/b342e8fbdb23157f3979af91cb5d8d3438003707) [@apexskier](https://github.com/apexskier) [#7207](https://github.com/gohugoio/hugo/issues/7207) - - - - - diff --git a/docs/content/en/news/0.77.0-relnotes/index.md b/docs/content/en/news/0.77.0-relnotes/index.md index c9db7ef99..3f7c100ec 100644 --- a/docs/content/en/news/0.77.0-relnotes/index.md +++ b/docs/content/en/news/0.77.0-relnotes/index.md @@ -14,7 +14,7 @@ Hugo `0.77.0` is a small, but useful release. Some notable updates are: There are also several useful **[Hugo Modules](https://gohugo.io/hugo-modules/)** enhancements: -* We have added `Replacements` to the [Module Configuration](https://gohugo.io/hugo-modules/configuration/#module-config-top-level). This should enable a much simpler developer workflow, simpler to set up preview sites for your remote theme etc, as you now can do `env HUGO_MODULE_REPLACEMENTS="github.com/bep/myprettytheme -> ../.." hugo` and similar. +* We have added `Replacements` to the [Module Configuration](https://gohugo.io/hugo-modules/configuration/#module-configuration-top-level). This should enable a much simpler developer workflow, simpler to set up preview sites for your remote theme etc, as you now can do `env HUGO_MODULE_REPLACEMENTS="github.com/bep/myprettytheme -> ../.." hugo` and similar. * The module `Path` for local modules can now be absolute for imports defined in the project. This release represents **38 contributions by 11 contributors** to the main Hugo code base. [@bep](https://github.com/bep) leads the Hugo development with a significant amount of contributions, but also a big shoutout to [@moorereason](https://github.com/moorereason), and [@anthonyfok](https://github.com/anthonyfok) for their ongoing contributions. @@ -83,8 +83,3 @@ Hugo now has: * Fix for bare TOML keys [fc6abc39](https://github.com/gohugoio/hugo/commit/fc6abc39c75c152780151c35bc95b12bee01b09c) [@bep](https://github.com/bep) * Fix i18n .Count regression [f9e798e8](https://github.com/gohugoio/hugo/commit/f9e798e8c4234bd60277e3cb10663ba254d4ecb7) [@bep](https://github.com/bep) [#7787](https://github.com/gohugoio/hugo/issues/7787) * Fix typo in 0.76.0 release note [ee56efff](https://github.com/gohugoio/hugo/commit/ee56efffcb3f81120b0d3e0297b4fb5966124354) [@digitalcraftsman](https://github.com/digitalcraftsman) - - - - - diff --git a/docs/content/en/news/0.89.0-relnotes/index.md b/docs/content/en/news/0.89.0-relnotes/index.md index 6e32087e6..83a0932c2 100644 --- a/docs/content/en/news/0.89.0-relnotes/index.md +++ b/docs/content/en/news/0.89.0-relnotes/index.md @@ -8,7 +8,7 @@ categories: ["Releases"] This release is a dependency refresh (the new Goldmark version comes with a lot of bug fixes, as one example), many bug fixes, but also some nice new features: -We have added the [configuration settings](https://gohugo.io/hugo-modules/configuration/#module-config-mounts) **includeFiles** and **excludeFiles** to the mount configuration. This allows fine grained control over what files to include, and it works for all of Hugo's file systems (including `/static`). +We have added the [configuration settings](https://gohugo.io/hugo-modules/configuration/#module-configuration-mounts) **includeFiles** and **excludeFiles** to the mount configuration. This allows fine grained control over what files to include, and it works for all of Hugo's file systems (including `/static`). We have also [reimplemented archetypes](https://github.com/gohugoio/hugo/pull/9045). The old implementation had some issues, mostly related to the context (e.g. name, file paths) passed to the template. This new implementation is using the exact same code path for evaluating the pages as in a regular build. This also makes it more robust and easier to reason about in a multilingual setup. Now, if you are explicit about the target path, Hugo will now always pick the correct mount and language: diff --git a/docs/content/en/readfiles/dateformatting.md b/docs/content/en/readfiles/dateformatting.md index 0a8d7b212..e6c395151 100644 --- a/docs/content/en/readfiles/dateformatting.md +++ b/docs/content/en/readfiles/dateformatting.md @@ -11,7 +11,7 @@ Jan 2 15:04:05 2006 MST 1 2 3 4 5 6 -7 ``` -### Hugo Date Templating Reference +### Hugo date templating reference Each of the following examples show the reference formatting string followed by the string Hugo will output in your HTML. @@ -54,7 +54,7 @@ date: 2017-03-03T14:15:59-06:00 `"Mon, 02 Jan 2006 15:04:05 -0700"` (RFC339) : **Returns**: `Fri, 03 Mar 2017 14:15:59 -0600` -### Cardinal Numbers and Ordinal Abbreviations +### Cardinal numbers and ordinal abbreviations Spelled-out cardinal numbers (e.g. "one", "two", and "three") and ordinal abbreviations (e.g. "1st", "2nd", and "3rd") are not currently supported. diff --git a/docs/content/en/showcase/ampio-help/index.md b/docs/content/en/showcase/ampio-help/index.md index 198e62fca..3d21192b8 100644 --- a/docs/content/en/showcase/ampio-help/index.md +++ b/docs/content/en/showcase/ampio-help/index.md @@ -39,7 +39,7 @@ Hugo was our first choice of SSG. The multilingualism support was the primary fe The rich functionalities of WordPress WYSIWYG editors soon turned out to be a curse. It became burdensome to maintain formatting consistency across documents prepared by multiple contributors. When we considered Markdown, we knew that it would give us a lot less flexibility. In our case, it proved to be a blessing in disguise---the constraints imposed by the notation ensured that each document was prepared in the same way. And in the cases where Markdown was not enough, Hugo shortcodes gave us all that we needed to get the results we anticipated. -In terms of PDF generation, we utilized [custom output formats](https://gohugo.io/templates/output-formats/) to produce intermediary document representations, which are consumed by our custom tool transforming them to TeX documents, which are finally used to produce PDF files. +In terms of PDF generation, we utilized [custom output formats](/templates/output-formats/) to produce intermediary document representations, which are consumed by our custom tool transforming them to TeX documents, which are finally used to produce PDF files. Custom output formats were also used to create search indexes. The search functionality is built on the brilliant [TNTSearch](https://github.com/teamtnt/tntsearch) library. The search queries and results are handled by PHP snippets embedded into static documents handled by Hugo. diff --git a/docs/content/en/showcase/digitalgov/index.md b/docs/content/en/showcase/digitalgov/index.md index b06eb355b..c0a927edb 100644 --- a/docs/content/en/showcase/digitalgov/index.md +++ b/docs/content/en/showcase/digitalgov/index.md @@ -20,7 +20,7 @@ Digital.gov is built using the [U.S. Web Design System](https://designsystem.dig _More on the [USWDS maturity model »](https://designsystem.digital.gov/maturity-model/)_ -## Open Tools +## Open tools We didn’t start from scratch. We built and designed the Digital.gov using many of the open-source tools and services that we develop for government here in the [Technology Transformation Services](https://www.gsa.gov/tts/) (TTS). diff --git a/docs/content/en/showcase/forestry/index.md b/docs/content/en/showcase/forestry/index.md index 1a9c0faaa..fbfe9b961 100644 --- a/docs/content/en/showcase/forestry/index.md +++ b/docs/content/en/showcase/forestry/index.md @@ -40,9 +40,9 @@ Lastly, we want to take the opportunity to give some love to other amazing tools * [**Hugo**](https://gohugo.io/) -- of course. * Chris can’t think of modern web development without [**Gulp**](https://gulpjs.com/) & [**Webpack**](https://webpack.js.org/). We used them to add additional build steps such as Browsersync, CSS, JS and SVG optimization. * Speaking about adding steps to our build, our lives would be much harder without [**CircleCI**](https://circleci.com/) for continuous deployment and automated testing purposes. -* We can’t stop raving about [**Algolia**](https://www.algolia.com/). Chris loves it and even wrote a tutorial on [how to implement Algolia](https://forestry.io/blog/search-with-algolia-in-hugo/) into static sites using Hugo’s [Custom Outputs](https://gohugo.io/templates/output-formats/). +* We can’t stop raving about [**Algolia**](https://www.algolia.com/). Chris loves it and even wrote a tutorial on [how to implement Algolia](https://forestry.io/blog/search-with-algolia-in-hugo/) into static sites using Hugo’s [Custom Outputs](/templates/output-formats/). * [**Cloudinary**](https://cloudinary.com/) is probably one of the easiest ways to get responsive images into your website. * We might be a little biased on this one - We think [**Forestry.io**](https://forestry.io/) is a great way to add a content management system with a clean UI on top of your site without interrupting your experience as a developer. * For hosting purposes we use the almighty [**AWS**](https://aws.amazon.com/). * [**Formspree.io**](https://formspree.io/) is managing our support and enterprise requests. -* We also use browser cookies and JS to customize our user’s experience and give it a more dynamic feel.
\ No newline at end of file +* We also use browser cookies and JS to customize our user’s experience and give it a more dynamic feel. diff --git a/docs/content/en/showcase/letsencrypt/index.md b/docs/content/en/showcase/letsencrypt/index.md index fc57a26b8..d59908df0 100644 --- a/docs/content/en/showcase/letsencrypt/index.md +++ b/docs/content/en/showcase/letsencrypt/index.md @@ -1,5 +1,5 @@ --- -title: "Let’s Encrypt" +title: Let’s Encrypt date: 2018-03-13 description: "Showcase: Lessons learned from taking letsencrypt.org to Hugo." siteURL: https://letsencrypt.org/ @@ -13,7 +13,7 @@ The **Let’s Encrypt website** has a common set of elements: A landing page and I helped them port the site from Jekyll to Hugo. There are usually very few surprises doing this. I know Hugo very well, but working on sites with a history usually comes up with something new. -That site is bookmarked in many browsers, so preserving the URLs was a must. Hugo's URL handling is very flexible, but there was one challenge. The website has a mix of standard and what we in Hugo call _ugly URLs_ (`https://letsencrypt.org/2017/12/07/looking-forward-to-2018.html`). In Hugo this is handled automatically, and you can turn it on globally or per language. But before Hugo `0.33` you could not configure it for parts of your site. You could set it manually for the relevant pages in front matter -- which is how it was done in Jekyll -- but that would be hard to manage, especially when you start to introduce translations. So, in [Hugo 0.33](https://gohugo.io/news/0.33-relnotes/) I added support for _ugly URLs_ per section and also `url` set in front matter for list pages (`https://letsencrypt.org/blog/`). +That site is bookmarked in many browsers, so preserving the URLs was a must. Hugo's URL handling is very flexible, but there was one challenge. The website has a mix of standard and what we in Hugo call _ugly URLs_ (`https://letsencrypt.org/2017/12/07/looking-forward-to-2018.html`). In Hugo this is handled automatically, and you can turn it on globally or per language. But before Hugo `0.33` you could not configure it for parts of your site. You could set it manually for the relevant pages in front matter -- which is how it was done in Jekyll -- but that would be hard to manage, especially when you start to introduce translations. So, in [Hugo 0.33](/news/0.33-relnotes) I added support for _ugly URLs_ per section and also `url` set in front matter for list pages (`https://letsencrypt.org/blog/`). The lessons learned from this also lead to [disableLanguages](/content-management/multilingual/#disable-a-language) in Hugo `0.34` (a way to turn off languages during translation). And I also registered [this issue](https://github.com/gohugoio/hugo/issues/4463). Once fixed it will make it easier to handle partially translated sites. diff --git a/docs/content/en/templates/404.md b/docs/content/en/templates/404.md index 05bfb71a8..3650d5a07 100644 --- a/docs/content/en/templates/404.md +++ b/docs/content/en/templates/404.md @@ -1,14 +1,14 @@ --- -title: Custom 404 Page -linktitle: 404 Page +title: Custom 404 page +linkTitle: 404 page description: If you know how to create a single page template, you have unlimited options for creating a custom 404. categories: [templates] keywords: [404, page not found] menu: docs: parent: templates - weight: 120 -weight: 120 + weight: 220 +weight: 220 --- When using Hugo with [GitHub Pages](https://pages.github.com/), you can provide your own template for a [custom 404 error page](https://docs.github.com/en/pages/getting-started-with-github-pages/creating-a-custom-404-page-for-your-github-pages-site) by creating a 404.html template file in the root of your `layouts` folder. When Hugo generates your site, the `404.html` file will be placed in the root. @@ -36,7 +36,7 @@ This is a basic example of a 404.html template: {{ end }} {{< /code >}} -## Automatic Loading +## Automatic loading Your 404.html file can be set to load automatically when a visitor enters a mistaken URL path, dependent upon the web serving environment you are using. For example: diff --git a/docs/content/en/templates/_index.md b/docs/content/en/templates/_index.md index aad680a76..527d9a1b1 100644 --- a/docs/content/en/templates/_index.md +++ b/docs/content/en/templates/_index.md @@ -1,12 +1,13 @@ --- title: Templates -linktitle: Templates Overview +linkTitle: Overview description: Go templating, template types and lookup order, shortcodes, and data. menu: docs: + identifier: templates-overview parent: templates - weight: 01 -weight: 01 + weight: 10 +weight: 10 categories: [templates] keywords: [] aliases: [/templates/overview/,/templates/content] diff --git a/docs/content/en/templates/base.md b/docs/content/en/templates/base.md index acfc7824a..ec84f1a22 100644 --- a/docs/content/en/templates/base.md +++ b/docs/content/en/templates/base.md @@ -1,13 +1,13 @@ --- -title: Base Templates and Blocks +title: Base templates and blocks description: The base and block constructs allow you to define the outer shell of your master templates (i.e., the chrome of the page). -categories: [templates,fundamentals] +categories: [fundamentals,templates] keywords: [blocks,base] menu: docs: parent: templates - weight: 20 -weight: 20 + weight: 40 +weight: 40 aliases: [/templates/blocks/,/templates/base-templates-and-blocks/] toc: true --- @@ -16,13 +16,13 @@ The `block` keyword allows you to define the outer shell of your pages' one or m {{< youtube QVOMCYitLEc >}} -## Base Template Lookup Order +## Base template lookup order The base template lookup order closely follows that of the template it applies to (e.g. `_default/list.html`). See [Template Lookup Order](/templates/lookup-order/) for details and examples. -## Define the Base Template +## Define the base template The following defines a simple base template at `_default/baseof.html`. As a default template, it is the shell from which all your pages will be rendered unless you specify another `*baseof.html` closer to the beginning of the lookup order. @@ -48,7 +48,7 @@ The following defines a simple base template at `_default/baseof.html`. As a def </html> {{< /code >}} -## Override the Base Template +## Override the base template From the above base template, you can define a [default list template][hugolists]. The default list template will inherit all of the code defined above and can then implement its own `"main"` block from: diff --git a/docs/content/en/templates/data-templates.md b/docs/content/en/templates/data-templates.md index c9b676a7d..ba143d892 100644 --- a/docs/content/en/templates/data-templates.md +++ b/docs/content/en/templates/data-templates.md @@ -1,13 +1,13 @@ --- -title: Data Templates +title: Data templates description: In addition to Hugo's built-in variables, you can specify your own custom data in templates or shortcodes that pull from both local and dynamic sources. categories: [templates] keywords: [data,dynamic,csv,json,toml,yaml,xml] menu: docs: parent: templates - weight: 80 -weight: 80 + weight: 150 +weight: 150 aliases: [/extras/datafiles/,/extras/datadrivencontent/,/doc/datafiles/] toc: true --- @@ -18,7 +18,7 @@ Hugo supports loading data from YAML, JSON, XML, and TOML files located in the ` {{< youtube FyPgSuwIMWQ >}} -## The Data Folder +## The data folder The `data` folder should store additional data for Hugo to use when generating your site. @@ -31,13 +31,13 @@ In both cases, it's a good idea to outsource the data in their (own) files. These files must be YAML, JSON, XML, or TOML files (using the `.yml`, `.yaml`, `.json`, `.xml`, or `.toml` extension). The data will be accessible as a `map` in the `.Site.Data` variable. -To access the data using the `site.Data.filename` notation, the filename must begin with an underscore or a Unicode letter, followed by zero or more underscores, Unicode letters, or Unicode digits. For example: +To access the data using the `site.Data.filename` notation, the file name must begin with an underscore or a Unicode letter, followed by zero or more underscores, Unicode letters, or Unicode digits. For example: - `123.json` - Invalid - `x123.json` - Valid - `_123.json` - Valid -To access the data using the [`index`](/functions/index-function/) function, the filename is irrelevant. For example: +To access the data using the [`index`](/functions/index-function/) function, the file name is irrelevant. For example: Data file|Template code :--|:-- @@ -46,7 +46,7 @@ Data file|Template code `_123.json`|`{{ index .Site.Data "_123" }}` `x-123.json`|`{{ index .Site.Data "x-123" }}` -## Data Files in Themes +## Data files in themes Data Files can also be used in themes. @@ -89,7 +89,7 @@ discography = [ ] {{< /code-toggle >}} -The list of bass players can be accessed via `.Site.Data.jazz.bass`, a single bass player by adding the filename without the suffix, e.g. `.Site.Data.jazz.bass.jacopastorius`. +The list of bass players can be accessed via `.Site.Data.jazz.bass`, a single bass player by adding the file name without the suffix, e.g. `.Site.Data.jazz.bass.jacopastorius`. You can now render the list of recordings for all the bass players in a template: @@ -111,7 +111,7 @@ And then in the `partials/artist.html`: Discover a new favorite bass player? Just add another `.toml` file in the same directory. -## Example: Accessing Named Values in a Data File +## Example: accessing named values in a data file Assume you have the following data structure in your `User0123.[yml|toml|xml|json]` data file located directly in `data/`: @@ -133,7 +133,7 @@ You can use the following code to render the `Short Description` in your layout: Note the use of the [`markdownify` template function][markdownify]. This will send the description through the Markdown rendering engine. -## Get Remote Data +## Get remote data Use `getJSON` or `getCSV` to get remote data: @@ -217,11 +217,11 @@ You can also set `cacheDir` in the [main configuration file][config]. If you don't like caching at all, you can fully disable caching with the command-line flag `--ignoreCache`. -### Authentication When Using REST URLs +### Authentication when using REST URLs Currently, you can only use those authentication methods that can be put into an URL. [OAuth] and other authentication methods are not implemented. -## Load Local files +## Load local files To load local files with `getJSON` and `getCSV`, the source files must reside within Hugo's working directory. The file extension does not matter, but the content does. @@ -231,7 +231,7 @@ It applies the same output logic as above in [Get Remote Data](#get-remote-data) The local CSV files to be loaded using `getCSV` must be located **outside** the `data` directory. {{% /note %}} -## LiveReload with Data Files +## LiveReload with data files There is no chance to trigger a [LiveReload] when the content of a URL changes. However, when a *local* file changes (i.e., `data/*` and `themes/<THEME>/data/*`), a LiveReload will be triggered. Symlinks are not supported. Note too that because downloading data takes a while, Hugo stops processing your Markdown files until the data download has been completed. @@ -239,12 +239,12 @@ There is no chance to trigger a [LiveReload] when the content of a URL changes. If you change any local file and the LiveReload is triggered, Hugo will read the data-driven (URL) content from the cache. If you have disabled the cache (i.e., by running the server with `hugo server --ignoreCache`), Hugo will re-download the content every time LiveReload triggers. This can create *huge* traffic. You may reach API limits quickly. {{% /note %}} -## Examples of Data-driven Content +## Examples of data-driven content - Photo gallery JSON powered: [https://github.com/pcdummy/hugo-lightslider-example](https://github.com/pcdummy/hugo-lightslider-example) - GitHub Starred Repositories [in a post](https://github.com/SchumacherFM/blog-cs/blob/master/content%2Fposts%2Fgithub-starred.md) using data-driven content in a [custom short code](https://github.com/SchumacherFM/blog-cs/blob/master/layouts%2Fshortcodes%2FghStarred.html). -## Specs for Data Formats +## Specs for data formats * [TOML Spec][toml] * [YAML Spec][yaml] diff --git a/docs/content/en/templates/files.md b/docs/content/en/templates/files.md index 1f40b7af8..7b058d531 100644 --- a/docs/content/en/templates/files.md +++ b/docs/content/en/templates/files.md @@ -1,18 +1,18 @@ --- -title: Local File Templates +title: Local file templates description: Hugo's `readDir` and `readFile` functions make it easy to traverse your project's directory structure and write file contents to your templates. categories: [templates] keywords: [files,directories] menu: docs: parent: templates - weight: 110 -weight: 110 + weight: 180 +weight: 180 aliases: [/extras/localfiles/,/templates/local-files/] toc: true --- -## Traverse Local Files +## Traverse local files With Hugo's [`readDir`][readDir] and [`readFile`][readFile] template functions, you can traverse your website's files on your server. diff --git a/docs/content/en/templates/homepage.md b/docs/content/en/templates/homepage.md index 0bab21ed5..5fe6902d3 100644 --- a/docs/content/en/templates/homepage.md +++ b/docs/content/en/templates/homepage.md @@ -1,14 +1,13 @@ --- -title: Homepage Template -linktitle: Homepage Template +title: Homepage template description: The homepage of a website is often formatted differently than the other pages. For this reason, Hugo makes it easy for you to define your new site's homepage as a unique template. categories: [templates] keywords: [homepage] menu: docs: parent: templates - weight: 30 -weight: 30 + weight: 70 +weight: 70 aliases: [/layout/homepage/,/templates/homepage-template/] toc: true --- @@ -21,17 +20,17 @@ The homepage template is the *only* required template for building a site and th {{< youtube ut1xtRZ1QOA >}} -## Homepage Template Lookup Order +## Homepage template lookup order See [Template Lookup](/templates/lookup-order/). -## Add Content and Front Matter to the Homepage +## Add content and front matter to the homepage The homepage, similar to other [list pages in Hugo][lists], accepts content and front matter from an `_index.md` file. This file should live at the root of your `content` folder (i.e., `content/_index.md`). You can then add body copy and metadata to your homepage the way you would any other content file. See the homepage template below or [Content Organization][contentorg] for more information on the role of `_index.md` in adding content and front matter to list pages. -## Example Homepage Template +## Example homepage template The following is an example of a homepage template that uses [partial][partials], [base] templates, and a content file at `content/_index.md` to populate the `{{ .Title }}` and `{{ .Content }}` [page variables][pagevars]. diff --git a/docs/content/en/templates/internal.md b/docs/content/en/templates/internal.md index 9ec79a16c..828244fa0 100644 --- a/docs/content/en/templates/internal.md +++ b/docs/content/en/templates/internal.md @@ -1,13 +1,13 @@ --- -title: Internal Templates +title: Internal templates description: Hugo ships with a group of boilerplate templates that cover the most common use cases for static websites. categories: [templates] keywords: [internal, analytics,] menu: docs: parent: templates - weight: 168 -weight: 168 + weight: 190 +weight: 190 toc: true --- <!-- reference: https://discourse.gohugo.io/t/lookup-order-for-partials/5705/6 @@ -40,7 +40,7 @@ googleAnalytics = "G-MEASUREMENT_ID" googleAnalytics = "UA-PROPERTY_ID" {{</ code-toggle >}} -### Use the Google Analytics Template +### Use the Google Analytics template You can then include the Google Analytics internal template: @@ -74,7 +74,7 @@ You also have the option to set the following in the front matter for a given pi * `disqus_title` * `disqus_url` -### Use the Disqus Template +### Use the Disqus template To add Disqus, include the following line in templates where you want your comments to appear: @@ -82,9 +82,9 @@ To add Disqus, include the following line in templates where you want your comme {{ template "_internal/disqus.html" . }} ``` -A `.Site.DisqusShortname` variable is also exposed from the config. +A `.Site.DisqusShortname` variable is also exposed from the configuration. -### Conditional Loading of Disqus Comments +### Conditional loading of Disqus comments Users have noticed that enabling Disqus comments when running the Hugo web server on `localhost` (i.e. via `hugo server`) causes the creation of unwanted discussions on the associated Disqus account. @@ -149,7 +149,7 @@ tags = [] Hugo uses the page title and description for the title and description metadata. The first 6 URLs from the `images` array are used for image metadata. -If [page bundles](/content-management/page-bundles/) are used and the `images` array is empty or undefined, images with filenames matching `*feature*` or `*cover*,*thumbnail*` are used for image metadata. +If [page bundles](/content-management/page-bundles/) are used and the `images` array is empty or undefined, images with file names matching `*feature*` or `*cover*,*thumbnail*` are used for image metadata. Various optional metadata can also be set: @@ -160,7 +160,7 @@ Various optional metadata can also be set: If using YouTube this will produce a og:video tag like `<meta property="og:video" content="url">`. Use the `https://youtu.be/<id>` format with YouTube videos (example: `https://youtu.be/qtIqKaDlqXo`). -### Use the Open Graph Template +### Use the Open Graph template To add Open Graph metadata, include the following line between the `<head>` tags in your templates: @@ -195,7 +195,7 @@ If no images are found at all, then an image-less Twitter `summary` card is used Hugo uses the page title and description for the card's title and description fields. The page summary is used if no description is given. -The `.Site.Social.twitter` variable is exposed from the config as the value for `twitter:site`. +The `.Site.Social.twitter` variable is exposed from the configuration as the value for `twitter:site`. {{< code-toggle file="hugo" >}} [social] @@ -208,7 +208,7 @@ NOTE: The `@` will be added for you <meta name="twitter:site" content="@GoHugoIO"/> ``` -### Use the Twitter Cards Template +### Use the Twitter Cards template To add Twitter card metadata, include the following line immediately after the `<head>` element in your templates: @@ -216,7 +216,7 @@ To add Twitter card metadata, include the following line immediately after the ` {{ template "_internal/twitter_cards.html" . }} ``` -## The Internal Templates +## The internal templates The code for these templates is located [here](https://github.com/gohugoio/hugo/tree/master/tpl/tplimpl/embedded/templates). diff --git a/docs/content/en/templates/introduction.md b/docs/content/en/templates/introduction.md index 2fb7f094f..5d60e9ed1 100644 --- a/docs/content/en/templates/introduction.md +++ b/docs/content/en/templates/introduction.md @@ -1,14 +1,14 @@ --- -title: Introduction to Hugo Templating -linktitle: Templating +title: Templating +linkTitle: Templating description: Hugo uses Go's `html/template` and `text/template` libraries as the basis for the templating. -categories: [templates,fundamentals] +categories: [fundamentals,templates] keywords: [go] menu: docs: parent: templates - weight: 10 -weight: 10 + weight: 20 +weight: 20 aliases: [/layouts/introduction/,/layout/introduction/, /templates/go-templates/] toc: true --- @@ -19,11 +19,11 @@ The following is only a primer on Go Templates. For an in-depth look into Go Tem Go Templates provide an extremely simple template language that adheres to the belief that only the most basic of logic belongs in the template or view layer. -## Basic Syntax +## Basic syntax Go Templates are HTML files with the addition of [variables][variables] and [functions][functions]. Go Template variables and functions are accessible within `{{ }}`. -### Access a Predefined Variable +### Access a predefined variable A _predefined variable_ could be a variable already existing in the current scope (like the `.Title` example in the [Variables](#variables) section below) or a custom variable (like the @@ -47,7 +47,7 @@ The following example calls the `add` function with inputs of `1` and `2`: {{ add 1 2 }} ``` -#### Methods and Fields are Accessed via dot Notation +#### Methods and fields are accessed via dot notation Accessing the Page Parameter `bar` defined in a piece of content's [front matter]. @@ -55,13 +55,13 @@ Accessing the Page Parameter `bar` defined in a piece of content's [front matter {{ .Params.bar }} ``` -#### Parentheses Can be Used to Group Items Together +#### Parentheses can be used to group items together ```go-html-template {{ if or (isset .Params "alt") (isset .Params "caption") }} Caption {{ end }} ``` -#### A Single Statement Can be Split over Multiple Lines +#### A single statement can be split over multiple lines ```go-html-template {{ if or @@ -70,14 +70,14 @@ Accessing the Page Parameter `bar` defined in a piece of content's [front matter }} ``` -#### Raw String Literals Can Include Newlines +#### Raw string literals can include newlines ```go-html-template {{ $msg := `Line one. Line two.` }} ``` -## Variables {#variables} +## Variables Each Go Template gets a data object. In Hugo, each template is passed a `Page`. In the below example, `.Title` is one of the elements @@ -120,14 +120,14 @@ Go Templates only ship with a few basic functions but also provide a mechanism f [Hugo template functions][functions] provide additional functionality specific to building websites. Functions are called by using their name followed by the required parameters separated by spaces. Template functions cannot be added without recompiling Hugo. -### Example 1: Adding Numbers +### Example 1: adding numbers ```go-html-template {{ add 1 2 }} <!-- prints 3 --> ``` -### Example 2: Comparing Numbers +### Example 2: comparing numbers ```go-html-template {{ lt 1 2 }} @@ -191,7 +191,7 @@ The Go Templates make heavy use of `range` to iterate over a _map_, _array_, or _slice_. The following are different examples of how to use `range`. -#### Example 1: Using Context (`.`) +#### Example 1: using context (`.`) ```go-html-template {{ range $array }} @@ -199,7 +199,7 @@ use `range`. {{ end }} ``` -#### Example 2: Declaring a variable name for an array element's value +#### Example 2: declaring a variable name for an array element's value ```go-html-template {{ range $elem_val := $array }} @@ -207,7 +207,7 @@ use `range`. {{ end }} ``` -#### Example 3: Declaring variable names for an array element's index _and_ value +#### Example 3: declaring variable names for an array element's index _and_ value For an array or slice, the first declared variable will map to each element's index. @@ -218,7 +218,7 @@ element's index. {{ end }} ``` -#### Example 4: Declaring variable names for a map element's key _and_ value +#### Example 4: declaring variable names for a map element's key _and_ value For a map, the first declared variable will map to each map element's key. @@ -229,7 +229,7 @@ key. {{ end }} ``` -#### Example 5: Conditional on empty _map_, _array_, or _slice_ +#### Example 5: conditional on empty _map_, _array_, or _slice_ If the _map_, _array_, or _slice_ passed into the range is zero-length then the else statement is evaluated. @@ -388,11 +388,11 @@ that `{{ . }}` always refers to the **current context**. current item in the loop; i.e., `{{ . }}` will no longer refer to the data available to the entire page. -If you need to access page-level data (e.g., page params set in front +If you need to access page-level data (e.g., page parameters set in front matter) from within the loop, you will likely want to do one of the following: -### 1. Define a Variable Independent of Context +### 1. Define a variable independent of context The following shows how to define a variable independent of the context. @@ -412,7 +412,7 @@ The following shows how to define a variable independent of the context. Notice how once we have entered the loop (i.e. `range`), the value of `{{ . }}` has changed. We have defined a variable outside the loop (`{{ $title }}`) that we've assigned a value so that we have access to the value from within the loop as well. {{% /note %}} -### 2. Use `$.` to Access the Global Context +### 2. Use `$.` to access the global context `$` has special significance in your templates. `$` is set to the starting value of `.` ("the dot") by default. This is a [documented feature of Go text/template][dotdoc]. This means you have access to the global context from anywhere. Here is an equivalent example of the preceding code block but now using `$` to grab `.Site.Title` from the global context: @@ -476,7 +476,7 @@ Go considers the following characters _whitespace_: In order to keep your templates organized and share information throughout your team, you may want to add comments to your templates. There are two ways to do that with Hugo. -### Go Templates comments +### Go templates comments Go Templates support `{{/*` and `*/}}` to open and close a comment block. Nothing within that block will be rendered. @@ -498,7 +498,7 @@ For example: {{ "<!-- This is an HTML comment -->" | safeHTML }} ``` -If you need variables to construct such HTML comments, just pipe `printf` to `safeHTML`. +If you need variables to construct such HTML comments, just pipe `printf` to `safeHTML`. For example: @@ -506,7 +506,7 @@ For example: {{ printf "<!-- Our website is named: %s -->" .Site.Title | safeHTML }} ``` -#### HTML comments containing Go Templates +#### HTML comments containing Go templates HTML comments are by default stripped, but their content is still evaluated. That means that although the HTML comment will never render any content to the final HTML pages, code contained within the comment may fail the build process. @@ -521,11 +521,11 @@ Do **not** try to comment out Go Template code using HTML comments. The templating engine will strip the content within the HTML comment, but will first evaluate any Go Template code if present within. So the above example will render `Emma Goldman`, as the `$author` variable got evaluated in the HTML comment. But the build would have failed if that code in the HTML comment had an error. -## Hugo Parameters +## Hugo parameters Hugo provides the option of passing values to your template layer through your [site configuration][config] (i.e. for site-wide values) or through the metadata of each specific piece of content (i.e. the [front matter]). You can define any values of any type and use them however you want in your templates, as long as the values are supported by the [front matter format](/content-management/front-matter#front-matter-formats). -## Use Content (`Page`) Parameters +## Use content (`Page`) parameters You can provide variables to be used by templates in individual content's [front matter]. @@ -556,7 +556,7 @@ Here is an example of corresponding code that could be used inside a `toc.html` We want the *default* behavior to be for pages to include a TOC unless otherwise specified. This template checks to make sure that the `notoc:` field in this page's front matter is not `true`. -## Use Site Configuration Parameters +## Use site configuration parameters You can arbitrarily define as many site-level parameters as you want in your [site's configuration file][config]. These parameters are globally available in your templates. @@ -569,7 +569,7 @@ params: sidebarrecentlimit: 5 {{< /code >}} -Within a footer layout, you might then declare a `<footer>` that is only rendered if the `copyrighthtml` parameter is provided. If it *is* provided, you will then need to declare the string is safe to use via the [`safeHTML` function][safehtml] so that the HTML entity is not escaped again. This would let you easily update just your top-level config file each January 1st, instead of hunting through your templates. +Within a footer layout, you might then declare a `<footer>` that is only rendered if the `copyrighthtml` parameter is provided. If it *is* provided, you will then need to declare the string is safe to use via the [`safeHTML` function][safehtml] so that the HTML entity is not escaped again. This would let you easily update just your top-level configuration file each January 1st, instead of hunting through your templates. ```go-html-template {{ if .Site.Params.copyrighthtml }} @@ -603,7 +603,7 @@ Finally, you can pull "magic constants" out of your layouts as well. The followi </nav> ``` -## Example: Show Future Events +## Example: show future events Given the following content structure and [front matter]: diff --git a/docs/content/en/templates/lists/index.md b/docs/content/en/templates/lists/index.md index 08d3d21ec..204cbcbcc 100644 --- a/docs/content/en/templates/lists/index.md +++ b/docs/content/en/templates/lists/index.md @@ -1,19 +1,19 @@ --- -title: Lists of Content in Hugo -linktitle: List Templates +title: Lists of content in Hugo +linkTitle: List templates description: Lists have a specific meaning and usage in Hugo when it comes to rendering your site homepage, section page, taxonomy list, or taxonomy terms list. categories: [templates] keywords: [lists,sections,rss,taxonomies,terms] menu: docs: parent: templates - weight: 22 -weight: 22 + weight: 60 +weight: 60 aliases: [/templates/list/,/layout/indexes/] toc: true --- -## What is a List Page Template? +## What is a list page template? {{< youtube 8b2YTSMdMps >}} @@ -21,10 +21,12 @@ A list page template is a template used to render multiple pieces of content in Hugo uses the term *list* in its truest sense; i.e. a sequential arrangement of material, especially in alphabetical or numerical order. Hugo uses list templates on any output HTML page where content is traditionally listed: -* [Taxonomy terms pages][taxterms] -* [Taxonomy list pages][taxlists] -* [Section list pages][sectiontemps] -* [RSS][rss] +* [Home page](/templates/homepage) +* [Section pages](/templates/section-templates) +* [Taxonomy pages](/templates/taxonomy-templates) +* [Taxonomy term pages](/templates/taxonomy-templates) +* [RSS feeds](/templates/rss) +* [Sitemaps](/templates/sitemap-template) For template lookup order, see [Template Lookup](/templates/lookup-order/). @@ -32,15 +34,15 @@ The idea of a list page comes from the [hierarchical mental model of the web][me [![Image demonstrating a hierarchical website sitemap.](site-hierarchy.svg)](site-hierarchy.svg) -## List Defaults +## List defaults -### Default Templates +### Default templates Since section lists and taxonomy lists (N.B., *not* [taxonomy terms lists][taxterms]) are both *lists* with regards to their templates, both have the same terminating default of `_default/list.html` or `themes/<THEME>/layouts/_default/list.html` in their lookup order. In addition, both [section lists][sectiontemps] and [taxonomy lists][taxlists] have their own default list templates in `_default`. See [Template Lookup Order](/templates/lookup-order/) for the complete reference. -## Add Content and Front Matter to List Pages +## Add content and front matter to list pages Since v0.18, [everything in Hugo is a `Page`][bepsays]. This means list pages and the homepage can have associated content files (i.e. `_index.md`) that contain page metadata (i.e., front matter) and content. @@ -50,7 +52,7 @@ This new model allows you to include list-specific front matter via `.Params` an It is important to note that all `_index.md` content files will render according to a *list* template and not according to a [single page template](/templates/single-page-templates/). {{% /note %}} -### Example Project Directory +### Example project directory The following is an example of a typical Hugo project directory's content: @@ -89,9 +91,9 @@ You can now access this `_index.md`'s' content in your list template: <main> <article> <header> - <h1>{{ .Title} }</h1> + <h1>{{ .Title }}</h1> </header> - <!-- "{{ .Content} }" pulls from the markdown content of the corresponding _index.md --> + <!-- "{{ .Content }}" pulls from the markdown content of the corresponding _index.md --> {{ .Content }} </article> <ul> @@ -126,7 +128,7 @@ This above will output the following HTML: <!--bottom of your baseof--> {{< /code >}} -### List Pages Without `_index.md` +### List pages without `_index.md` You do *not* have to create an `_index.md` file for every list page (i.e. section, taxonomy, taxonomy terms, etc) or the homepage. If Hugo does not find an `_index.md` within the respective content section when rendering a list template, the page will be created but with no `{{ .Content }}` and only the default values for `.Title` etc. @@ -153,9 +155,9 @@ Using this same `layouts/_default/list.html` template and applying it to the `qu The default behavior of Hugo is to pluralize list titles; hence the inflection of the `quote` section to "Quotes" when called with the `.Title` [page variable](/variables/page/). You can change this via the `pluralizeListTitles` directive in your [site configuration](/getting-started/configuration/). {{% /note %}} -## Example List Templates +## Example list templates -### Section Template +### Section template This list template has been modified slightly from a template originally used in [spf13.com](https://spf13.com/). It makes use of [partial templates][partials] for the chrome of the rendered page rather than using a [base template][base]. The examples that follow also use the [content view templates][views] `li.html` or `summary.html`. @@ -176,7 +178,7 @@ This list template has been modified slightly from a template originally used in {{ partial "footer.html" . }} {{< /code >}} -### Taxonomy Template +### Taxonomy template {{< code file="layouts/_default/taxonomy.html" >}} {{ define "main" }} @@ -192,7 +194,7 @@ This list template has been modified slightly from a template originally used in {{ end }} {{< /code >}} -## Order Content +## Order content Hugo lists render the content based on metadata you provide in [front matter]. In addition to sane defaults, Hugo also ships with multiple methods to make quick work of ordering content inside list templates: @@ -209,7 +211,7 @@ Hugo lists render the content based on metadata you provide in [front matter]. I </ul> {{< /code >}} -### By Weight +### By weight Lower weight gets higher precedence. So content with lower weight will come first. @@ -224,7 +226,7 @@ Lower weight gets higher precedence. So content with lower weight will come firs </ul> {{< /code >}} -### By Date +### By date {{< code file="layouts/partials/by-date.html" >}} <ul> @@ -238,7 +240,7 @@ Lower weight gets higher precedence. So content with lower weight will come firs </ul> {{< /code >}} -### By Publish Date +### By publish date {{< code file="layouts/partials/by-publish-date.html" >}} <ul> @@ -252,7 +254,7 @@ Lower weight gets higher precedence. So content with lower weight will come firs </ul> {{< /code >}} -### By Expiration Date +### By expiration date {{< code file="layouts/partials/by-expiry-date.html" >}} <ul> @@ -265,7 +267,7 @@ Lower weight gets higher precedence. So content with lower weight will come firs </ul> {{< /code >}} -### By Last Modified Date +### By last modified date {{< code file="layouts/partials/by-last-mod.html" >}} <ul> @@ -279,7 +281,7 @@ Lower weight gets higher precedence. So content with lower weight will come firs </ul> {{< /code >}} -### By Length +### By length {{< code file="layouts/partials/by-length.html" >}} <ul> @@ -293,7 +295,7 @@ Lower weight gets higher precedence. So content with lower weight will come firs </ul> {{< /code >}} -### By Title +### By title {{< code file="layouts/partials/by-title.html" >}} <ul> @@ -307,7 +309,7 @@ Lower weight gets higher precedence. So content with lower weight will come firs </ul> {{< /code >}} -### By Link Title +### By link title {{< code file="layouts/partials/by-link-title.html" >}} <ul> @@ -321,7 +323,7 @@ Lower weight gets higher precedence. So content with lower weight will come firs </ul> {{< /code >}} -### By Parameter +### By page parameter Order based on the specified front matter parameter. Content that does not have the specified front matter field will use the site's `.Site.Params` default. If the parameter is not found at all in some entries, those entries will appear together at the end of the ordering. @@ -340,7 +342,7 @@ If the targeted front matter field is nested beneath another field, you can acce {{ end }} {{< /code >}} -### Reverse Order +### Reverse order Reversing order can be applied to any of the above methods. The following uses `ByDate` as an example: @@ -355,11 +357,11 @@ Reversing order can be applied to any of the above methods. The following uses ` </ul> {{< /code >}} -## Group Content +## Group content Hugo provides some functions for grouping pages by Section, Type, Date, etc. -### By Page Field +### By page field {{< code file="layouts/partials/by-page-field.html" >}} <!-- Groups content according to content section. The ".Key" in this instance will be the section's title. --> @@ -399,7 +401,7 @@ In the above example, you may want `{{ .Title }}` to point the `title` field you {{ end }} {{< /code >}} -### By Date +### By date {{< code file="layouts/partials/by-page-date.html" >}} <!-- Groups content by month according to the "date" field in front matter --> @@ -418,7 +420,7 @@ In the above example, you may want `{{ .Title }}` to point the `title` field you {{< new-in "0.97.0" >}} `GroupByDate` accepts the same time layouts as in [time.Format](/functions/dateformat/) and The `.Key` in the result will be localized for the current language. -### By Publish Date +### By publish date {{< code file="layouts/partials/by-page-publish-date.html" >}} <!-- Groups content by month according to the "publishDate" field in front matter --> @@ -437,17 +439,18 @@ In the above example, you may want `{{ .Title }}` to point the `title` field you {{< new-in "0.97.0" >}} `GroupByDate` accepts the same time layouts as in [time.Format](/functions/dateformat/) and The `.Key` in the result will be localized for the current language. -### By Lastmod -{{< code file="layouts/partials/by-page-lastmod.html" >}} -<!-- Groups content by month according to the "lastMod" field in front matter --> -{{ range .Pages.GroupByLastmod "2006-01" }} +### By expiration date + +{{< code file="layouts/partials/by-page-expiry-date.html" >}} +<!-- Groups content by month according to the "expiryDate" field in front matter --> +{{ range .Pages.GroupByExpiryDate "2006-01" }} <h3>{{ .Key }}</h3> <ul> {{ range .Pages }} <li> <a href="{{ .Permalink }}">{{ .Title }}</a> - <div class="meta">{{ .Lastmod.Format "Mon, Jan 2, 2006" }}</div> + <div class="meta">{{ .ExpiryDate.Format "Mon, Jan 2, 2006" }}</div> </li> {{ end }} </ul> @@ -456,17 +459,17 @@ In the above example, you may want `{{ .Title }}` to point the `title` field you {{< new-in "0.97.0" >}} `GroupByDate` accepts the same time layouts as in [time.Format](/functions/dateformat/) and The `.Key` in the result will be localized for the current language. -### By Expiry Date +### By last modified date -{{< code file="layouts/partials/by-page-expiry-date.html" >}} -<!-- Groups content by month according to the "expiryDate" field in front matter --> -{{ range .Pages.GroupByExpiryDate "2006-01" }} +{{< code file="layouts/partials/by-page-lastmod.html" >}} +<!-- Groups content by month according to the "lastMod" field in front matter --> +{{ range .Pages.GroupByLastmod "2006-01" }} <h3>{{ .Key }}</h3> <ul> {{ range .Pages }} <li> <a href="{{ .Permalink }}">{{ .Title }}</a> - <div class="meta">{{ .ExpiryDate.Format "Mon, Jan 2, 2006" }}</div> + <div class="meta">{{ .Lastmod.Format "Mon, Jan 2, 2006" }}</div> </li> {{ end }} </ul> @@ -475,7 +478,7 @@ In the above example, you may want `{{ .Title }}` to point the `title` field you {{< new-in "0.97.0" >}} `GroupByDate` accepts the same time layouts as in [time.Format](/functions/dateformat/) and The `.Key` in the result will be localized for the current language. -### By Page Parameter +### By page parameter {{< code file="layouts/partials/by-page-param.html" >}} <!-- Groups content according to the "param_key" field in front matter --> @@ -492,7 +495,7 @@ In the above example, you may want `{{ .Title }}` to point the `title` field you {{ end }} {{< /code >}} -### By Page Parameter in Date Format +### By page parameter in date format The following template takes grouping by `date` a step further and uses Go's layout string. See the [`Format` function] for more examples of how to use Go's layout string to format dates in Hugo. @@ -511,13 +514,13 @@ The following template takes grouping by `date` a step further and uses Go's lay {{ end }} {{< /code >}} -### Reverse Key Order +### Reverse key order Ordering of groups is performed by keys in alphanumeric order (A–Z, 1–100) and in reverse chronological order (i.e., with the newest first) for dates. While these are logical defaults, they are not always the desired order. There are two different syntaxes to change Hugo's default ordering for groups, both of which work the same way. -#### 1. Adding the Reverse Method +#### 1. Adding the reverse method ```go-html-template {{ range (.Pages.GroupBy "Section").Reverse }} @@ -527,7 +530,7 @@ While these are logical defaults, they are not always the desired order. There a {{ range (.Pages.GroupByDate "2006-01").Reverse }} ``` -#### 2. Providing the Alternate Direction +#### 2. Providing the alternate direction ```go-html-template {{ range .Pages.GroupByDate "2006-01" "asc" }} @@ -537,7 +540,7 @@ While these are logical defaults, they are not always the desired order. There a {{ range .Pages.GroupBy "Section" "desc" }} ``` -### Order Within Groups +### Order within groups Because Grouping returns a `{{ .Key }}` and a slice of pages, all the ordering methods listed above are available. @@ -561,7 +564,7 @@ Here is the ordering for the example that follows: {{ end }} {{< /code >}} -## Filtering and Limiting Lists {#filtering-and-limiting-lists} +## Filtering and limiting lists Sometimes you only want to list a subset of the available content. A common is to only display posts from [**main sections**][mainsections] diff --git a/docs/content/en/templates/lookup-order.md b/docs/content/en/templates/lookup-order.md index 431c32c52..7f66a7734 100644 --- a/docs/content/en/templates/lookup-order.md +++ b/docs/content/en/templates/lookup-order.md @@ -1,27 +1,25 @@ --- -title: Hugo's Lookup Order -linktitle: Template Lookup Order -description: Hugo searches for the layout to use for a given page in a well defined order, starting from the most specific. -categories: [templates,fundamentals] +title: Template lookup order +description: Hugo uses the rules below to select a template for a given page, starting from the most specific. +categories: [fundamentals,templates] keywords: [templates] menu: docs: parent: templates - weight: 15 - quicklinks: -weight: 15 + weight: 30 +weight: 30 +toc: true --- -## Hugo Layouts Lookup Rules - -Hugo takes the parameters listed below into consideration when choosing a layout for a given page. They are listed in a priority order. This should feel natural, but look at the table below for concrete examples of the different parameter variations. +## Lookup rules +Hugo takes the parameters listed below into consideration when choosing a template for a given page. The templates are ordered by specificity. This should feel natural, but look at the table below for concrete examples of the different parameter variations. Kind : The page `Kind` (the home page is one). See the example tables below per kind. This also determines if it is a **single page** (i.e. a regular content page. We then look for a template in `_default/single.html` for HTML) or a **list page** (section listings, home page, taxonomy lists, taxonomy terms. We then look for a template in `_default/list.html` for HTML). Layout -: Can be set in page front matter. +: Can be set in front matter. Output Format : See [Custom Output Formats](/templates/output-formats). An output format has both a `name` (e.g. `rss`, `amp`, `html`) and a `suffix` (e.g. `xml`, `html`). We prefer matches with both (e.g. `index.amp.html`, but look for less specific templates. @@ -29,7 +27,7 @@ Output Format Note that if the output format's Media Type has more than one suffix defined, only the first is considered. Language -: We will consider a language code in the template name. If the site language is `fr`, `index.fr.amp.html` will win over `index.amp.html`, but `index.amp.html` will be chosen before `index.fr.html`. +: We will consider a language tag in the template name. If the site language is `fr`, `index.fr.amp.html` will win over `index.amp.html`, but `index.amp.html` will be chosen before `index.fr.html`. Type : Is value of `type` if set in front matter, else it is the name of the root section (e.g. "blog"). It will always have a value, so if not set, the value is "page". @@ -38,38 +36,25 @@ Section : Is relevant for `section`, `taxonomy` and `term` types. {{% note %}} -**Tip:** The examples below look long and complex. That is the flexibility talking. Most Hugo sites contain just a handful of templates: - -```bash -├── _default -│ ├── baseof.html -│ ├── list.html -│ └── single.html -└── index.html -``` +Templates can live in either the project's or the themes' layout folders, and the most specific templates will be chosen. Hugo will interleave the lookups listed below, finding the most specific one either in the project or themes. {{% /note %}} - -## Hugo Layouts Lookup Rules With Theme - -In Hugo, layouts can live in either the project's or the themes' layout folders, and the most specific layout will be chosen. Hugo will interleave the lookups listed below, finding the most specific one either in the project or themes. - -## Examples: Layout Lookup for Regular Pages +## Regular pages {{< datatable-filtered "output" "layouts" "Kind == page" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}} -## Examples: Layout Lookup for Home Page +## Home page {{< datatable-filtered "output" "layouts" "Kind == home" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}} -## Examples: Layout Lookup for Section Pages +## Section pages {{< datatable-filtered "output" "layouts" "Kind == section" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}} -## Examples: Layout Lookup for Taxonomy Pages +## Taxonomy pages {{< datatable-filtered "output" "layouts" "Kind == taxonomy" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}} -## Examples: Layout Lookup for Term Pages +## Term pages {{< datatable-filtered "output" "layouts" "Kind == term" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}} diff --git a/docs/content/en/templates/menu-templates.md b/docs/content/en/templates/menu-templates.md index b858ebd21..6c009cbdb 100644 --- a/docs/content/en/templates/menu-templates.md +++ b/docs/content/en/templates/menu-templates.md @@ -1,14 +1,14 @@ --- -title: Menu Templates +title: Menu templates description: Use menu variables and methods in your templates to render a menu. categories: [templates] keywords: [lists,sections,menus] menu: docs: parent: templates - weight: 130 + weight: 140 toc: true -weight: 130 +weight: 140 aliases: [/templates/menus/] --- diff --git a/docs/content/en/templates/output-formats.md b/docs/content/en/templates/output-formats.md index d454ecc0d..3983acc24 100644 --- a/docs/content/en/templates/output-formats.md +++ b/docs/content/en/templates/output-formats.md @@ -1,20 +1,20 @@ --- -title: Custom Output Formats +title: Custom output formats description: Hugo can output content in multiple formats, including calendar events, e-book formats, Google AMP, and JSON search indexes, or any custom text format. -categories: [templates] +categories: [fundamentals,templates] keywords: ["amp", "outputs", "rss"] menu: docs: parent: templates - weight: 18 -weight: 18 + weight: 210 +weight: 210 aliases: [/templates/outputs/,/extras/output-formats/,/content-management/custom-outputs/] toc: true --- This page describes how to properly configure your site with the media types and output formats, as well as where to create your templates for your custom outputs. -## Media Types +## Media types A [media type] (also known as _MIME type_ and _content type_) is a two-part identifier for file formats and format contents transmitted on the internet. @@ -25,11 +25,11 @@ This is the full set of built-in media types in Hugo: **Note:** - It is possible to add custom media types or change the defaults; e.g., if you want to change the suffix for `text/html` to `asp`. -- `Suffixes` are the values that will be used for URLs and filenames for that media type in Hugo. +- `Suffixes` are the values that will be used for URLs and file names for that media type in Hugo. - The `Type` is the identifier that must be used when defining new/custom `Output Formats` (see below). - The full set of media types will be registered in Hugo's built-in development server to make sure they are recognized by the browser. -To add or modify a media type, define it in a `mediaTypes` section in your [site configuration][config], either for all sites or for a given language. +To add or modify a media type, define it in a `mediaTypes` section in your [site configuration], either for all sites or for a given language. {{< code-toggle file="hugo" >}} [mediaTypes] @@ -48,15 +48,14 @@ The above example adds one new media type, `text/enriched`, and changes the suff [mediaTypes."text/html"] suffixes = ["htm"] -# Redefine HTML to update its media type. [outputFormats] [outputFormats.HTML] mediaType = "text/html" {{</ code-toggle >}} -**Note** that for the above to work, you also need to add an `outputs` definition in your site config. +**Note** that for the above to work, you also need to add an `outputs` definition in your site configuration. -## Output Format Definitions +## Output format definitions Given a media type and some additional configuration, you get an **Output Format**. @@ -80,7 +79,7 @@ protocol = "bep://" The above example is fictional, but if used for the homepage on a site with `baseURL` `https://example.org`, it will produce a plain text homepage with the URL `bep://example.org/myindex.enr`. -### Configure Output Formats +### Configure output formats The following is the full list of configuration options for output formats and their default values: @@ -94,7 +93,7 @@ The following is the full list of configuration options for output formats and t : sub path to save the output files. `baseName` -: the base filename for the list filenames (homepage, etc.). **Default:** `index`. +: the base file name for the list file names (homepage, etc.). **Default:** `index`. `rel` : can be used to create `rel` values in `link` tags. **Default:** `alternate`. @@ -120,12 +119,12 @@ The following is the full list of configuration options for output formats and t `weight` : Setting this to a non-zero value will be used as the first sort criteria. -## Output Formats for Pages +## Output formats for pages A `Page` in Hugo can be rendered to multiple _output formats_ on the file system. -### Default Output Formats +### Default output formats Every `Page` has a [`Kind`][page_kinds] attribute, and the default Output Formats are set based on that. @@ -138,13 +137,13 @@ Formats are set based on that. | `taxonomy` | HTML, RSS | | `term` | HTML, RSS | -### Customizing Output Formats +### Customizing output formats This can be changed by defining an `outputs` list of output formats in either the `Page` front matter or in the site configuration (either for all sites or per language). -Example from site config file: +Example from site configuration file: {{< code-toggle file="hugo" >}} [outputs] @@ -172,7 +171,7 @@ outputs: - json {{< /code-toggle >}} -## List Output formats +## List output formats Each `Page` has both an `.OutputFormats` (all formats, including the current) and an `.AlternativeOutputFormats` variable, the latter of which is useful for creating a `link rel` list in your site's `<head>`: @@ -182,7 +181,7 @@ Each `Page` has both an `.OutputFormats` (all formats, including the current) an {{ end -}} ``` -## Link to Output Formats +## Link to output formats `.Permalink` and `.RelPermalink` on `Page` will return the first output format defined for that page (usually `HTML` if nothing else is defined). This is regardless of the template file they are being called from. @@ -212,7 +211,7 @@ From content files, you can use the [`ref` or `relref` shortcodes](/content-mana [Who]({{</* relref "about.md#who" "amp" */>}}) ``` -## Templates for Your Output Formats +## Templates for your output formats A new output format needs a corresponding template in order to render anything useful. @@ -242,7 +241,7 @@ The partial below is a plain text template (Output Format is `CSV`, and since th ``` [base]: /templates/base/ -[config]: /getting-started/configuration/ +[site configuration]: /getting-started/configuration/ [lookup order]: /templates/lookup-order/ [media type]: https://en.wikipedia.org/wiki/Media_type [partials]: /templates/partials/ diff --git a/docs/content/en/templates/pagination.md b/docs/content/en/templates/pagination.md index 5de1f661d..e1d09918a 100644 --- a/docs/content/en/templates/pagination.md +++ b/docs/content/en/templates/pagination.md @@ -1,21 +1,20 @@ --- title: Pagination -linktitle: Pagination description: Hugo supports pagination for your homepage, section pages, and taxonomies. categories: [templates] keywords: [lists,sections,pagination] menu: docs: parent: templates - weight: 140 -weight: 140 + weight: 100 +weight: 100 aliases: [/extras/pagination,/doc/pagination/] toc: true --- The real power of Hugo pagination shines when combined with the [`where` function][where] and its SQL-like operators: [`first`], [`last`], and [`after`]. You can even [order the content][lists] the way you've become used to with Hugo. -## Configure Pagination +## Configure pagination Pagination can be configured in your [site configuration][configuration]: @@ -29,7 +28,7 @@ Setting `paginate` to a positive value will split the list pages for the homepag `paginatePath` is used to adapt the `URL` to the pages in the paginator (the default setting will produce URLs on the form `/page/1/`. -## List Paginator Pages +## List paginator pages {{% note %}} `.Paginator` is provided to help you build a pager menu. This feature is currently only supported on homepage and list pages (i.e., taxonomies and section lists). diff --git a/docs/content/en/templates/partials.md b/docs/content/en/templates/partials.md index 57a7acf05..16c117f2f 100644 --- a/docs/content/en/templates/partials.md +++ b/docs/content/en/templates/partials.md @@ -1,20 +1,20 @@ --- -title: Partial Templates +title: Partial templates description: Partials are smaller, context-aware components in your list and page templates that can be used economically to keep your templating DRY. categories: [templates] keywords: [lists,sections,partials] menu: docs: parent: templates - weight: 90 -weight: 90 + weight: 120 +weight: 120 aliases: [/templates/partial/,/layout/chrome/,/extras/analytics/] toc: true --- {{< youtube pjS4pOLyB7c >}} -## Partial Template Lookup Order +## Partial template lookup order Partial templates---like [single page templates][singletemps] and [list page templates][listtemps]---have a specific [lookup order]. However, partials are simpler in that Hugo will only check in two places: @@ -23,7 +23,7 @@ Partial templates---like [single page templates][singletemps] and [list page tem This allows a theme's end user to copy a partial's contents into a file of the same name for [further customization][customize]. -## Use Partials in your Templates +## Use partials in your templates All partials for your Hugo project are located in a single `layouts/partials` directory. For better organization, you can create multiple subdirectories within `partials` as well: @@ -64,13 +64,13 @@ As shown in the above example directory structure, you can nest your directories {{ partial "footer/scripts.html" . }} ``` -### Variable Scoping +### Variable scoping The second argument in a partial call is the variable being passed down. The above examples are passing the `.`, which tells the template receiving the partial to apply the current [context][context]. This means the partial will *only* be able to access those variables. The partial is isolated and *has no access to the outer scope*. From within the partial, `$.Var` is equivalent to `.Var`. -## Returning a value from a Partial +## Returning a value from a partial In addition to outputting markup, partials can be used to return a value of any type. In order to return a value, a partial must include a lone `return` statement *at the end of the partial*. @@ -113,7 +113,7 @@ In addition to outputting markup, partials can be used to return a value of any Only one `return` statement is allowed per partial file. {{% /note %}} -## Inline Partials +## Inline partials You can also define partials inline in the template. But remember that template namespace is global, so you need to make sure that the names are unique to avoid conflicts. @@ -126,7 +126,7 @@ Value: {{ partial "my-inline-partial.html" . }} {{ end }} ``` -## Cached Partials +## Cached partials The [`partialCached` template function][partialcached] can offer significant performance gains for complex templates that don't need to be re-rendered on every invocation. The simplest usage is as follows: diff --git a/docs/content/en/templates/render-hooks.md b/docs/content/en/templates/render-hooks.md index 395cb9240..13106b7f7 100644 --- a/docs/content/en/templates/render-hooks.md +++ b/docs/content/en/templates/render-hooks.md @@ -1,14 +1,15 @@ --- -title: "Markdown Render Hooks" -linkTitle: "Render Hooks" -description: "Render Hooks allow custom templates to override markdown rendering functionality." +title: Markdown render hooks +linkTitle: Render hooks +description: Render Hooks allow custom templates to override markdown rendering functionality. categories: [templates] keywords: [markdown] toc: true menu: docs: parent: templates - weight: 20 + weight: 200 +weight: 200 --- Note that this is only supported with the [Goldmark](/getting-started/configuration-markup#goldmark) renderer. @@ -45,7 +46,7 @@ Some use cases for the above: * Resolve and [process](/content-management/image-processing/) images. * Add [header links](https://remysharp.com/2014/08/08/automatic-permalinks-for-blog-posts). -## Render Hooks for Headings, Links and Images +## Render hooks for headings, links and images ### Context passed to `render-link` and `render-image` @@ -91,13 +92,13 @@ Attributes (map) The `render-image` templates will also receive: IsBlock {{< new-in "0.108.0" >}} -: Returns true if this is a standalone image and the config option [markup.goldmark.parser.wrapStandAloneImageWithinParagraph](/getting-started/configuration-markup/#goldmark) is disabled. +: Returns true if this is a standalone image and the configuration option [markup.goldmark.parser.wrapStandAloneImageWithinParagraph](/getting-started/configuration-markup/#goldmark) is disabled. Ordinal {{< new-in "0.108.0" >}} : Zero-based ordinal for all the images in the current document. -### Link with title Markdown example +### Link with title markdown example ```md [Text](https://www.gohugo.io "Title") @@ -109,7 +110,7 @@ Here is a code example for how the render-link.html template could look: <a href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a> {{< /code >}} -### Image Markdown example +### Image markdown example ```md ![Text](https://gohugo.io/images/hugo-logo-wide.svg "Title") @@ -143,7 +144,7 @@ The rendered html will be <h3 id="section-a">Section A <a href="#section-a">¶</a></h3> ``` -## Render Hooks for Code Blocks +## Render hooks for code blocks {{< new-in "0.93.0" >}} @@ -180,4 +181,4 @@ Page : The owning `Page`. Position -: Useful in error logging as it prints the filename and position (linenumber, column), e.g. `{{ errorf "error in code block: %s" .Position }}`. +: Useful in error logging as it prints the file name and position (linenumber, column), e.g. `{{ errorf "error in code block: %s" .Position }}`. diff --git a/docs/content/en/templates/robots.md b/docs/content/en/templates/robots.md index a658ded24..b9cdb76dd 100644 --- a/docs/content/en/templates/robots.md +++ b/docs/content/en/templates/robots.md @@ -1,18 +1,18 @@ --- -title: Robots.txt File -linktitle: Robots.txt +title: Robots.txt file +linkTitle: Robots.txt description: Hugo can generate a customized robots.txt in the same way as any other template. categories: [templates] keywords: [robots,search engines] menu: docs: parent: templates - weight: 165 -weight: 165 + weight: 230 +weight: 230 aliases: [/extras/robots-txt/] --- -To generate a robots.txt file from a template, change the [site configuration][config]: +To generate a robots.txt file from a template, change the [site configuration]: {{< code-toggle file="hugo" >}} enableRobotsTXT = true @@ -26,14 +26,14 @@ User-agent: * Search engines that honor the Robots Exclusion Protocol will interpret this as permission to crawl everything on the site. -## Robots.txt Template Lookup Order +## robots.txt template lookup order You may overwrite the internal template with a custom template. Hugo selects the template using this lookup order: 1. `/layouts/robots.txt` 2. `/themes/<THEME>/layouts/robots.txt` -## Robots.txt Template Example +## robots.txt template example {{< code file="layouts/robots.txt" >}} User-agent: * @@ -47,14 +47,13 @@ This template creates a robots.txt file with a `Disallow` directive for each pag {{% note %}} To create a robots.txt file without using a template: -1. Set `enableRobotsTXT` to `false` in the [site configuration][config]. +1. Set `enableRobotsTXT` to `false` in the [site configuration]. 2. Create a robots.txt file in the `static` directory. Remember that Hugo copies everything in the [static directory][static] to the root of `publishDir` (typically `public`) when you build your site. -[config]: /getting-started/configuration/ [static]: /getting-started/directory-structure/ {{% /note %}} -[config]: /getting-started/configuration/ +[site configuration]: /getting-started/configuration/ [internal]: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/robots.txt diff --git a/docs/content/en/templates/rss.md b/docs/content/en/templates/rss.md index c378a65f5..90b5155ad 100644 --- a/docs/content/en/templates/rss.md +++ b/docs/content/en/templates/rss.md @@ -1,22 +1,22 @@ --- -title: RSS Templates +title: RSS templates description: Hugo ships with its own RSS 2.0 template that requires almost no configuration, or you can create your own RSS templates. keywords: [rss, xml, templates] categories: [templates] menu: docs: parent: templates - weight: 150 -weight: 150 + weight: 160 +weight: 160 toc: true --- -## RSS Template Lookup Order +## RSS template lookup order See [Template Lookup Order](/templates/lookup-order/) for the complete reference. {{% note %}} -Hugo ships with its own [RSS 2.0 template](#the-embedded-rssxml). The embedded template will be sufficient for most use cases. +Hugo ships with its own [RSS 2.0 template](#the-embedded-rssxml-template). The embedded template will be sufficient for most use cases. {{% /note %}} RSS pages are of the type `Page` and have all the [page variables](/variables/page/) available to use in the templates. @@ -27,7 +27,7 @@ A [section’s][section] RSS will be rendered at `/<SECTION>/index.xml` (e.g., [ Hugo provides the ability for you to define any RSS type you wish and can have different RSS files for each section and taxonomy. -## Lookup Order for RSS Templates +## Lookup order for RSS templates The table below shows the RSS template lookup order for the different page kinds. The first listing shows the lookup order when running with a theme (`demoTheme`). @@ -47,13 +47,13 @@ copyright = "This work is licensed under a Creative Commons Attribution-ShareAli name = "My Name Here" {{< /code-toggle >}} -## The Embedded rss.xml +## The embedded rss.xml template This is the default RSS template that ships with Hugo: <https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/rss.xml> -## Reference your RSS Feed in `<head>` +## Reference your RSS feed in `<head>` In your `header.html` template, you can specify your RSS feed in your `<head></head>` tag using Hugo's [Output Formats][Output Formats] like this: @@ -79,7 +79,6 @@ Either of the two snippets above will generate the below `link` tag on the site _We are assuming `BaseURL` to be `https://example.com/` and `$.Site.Title` to be `"Site Title"` in this example._ -[config]: /getting-started/configuration/ [embedded]: #the-embedded-rss-xml [RSS 2.0]: https://cyber.harvard.edu/rss/rss.html "RSS 2.0 Specification" [section]: /content-management/sections/ diff --git a/docs/content/en/templates/section-templates.md b/docs/content/en/templates/section-templates.md index fa27bf4e8..db8ffd667 100644 --- a/docs/content/en/templates/section-templates.md +++ b/docs/content/en/templates/section-templates.md @@ -1,33 +1,33 @@ --- -title: Section Page Templates -linktitle: Section Templates +title: Section page templates +linkTitle: Section templates description: Templates used for section pages are **lists** and therefore have all the variables and methods available to list pages. categories: [templates] keywords: [lists,sections,templates] menu: docs: parent: templates - weight: 40 -weight: 40 + weight: 80 +weight: 80 aliases: [/templates/sections/] toc: true --- -## Add Content and Front Matter to Section Templates +## Add content and front matter to section templates To effectively leverage section page templates, you should first understand Hugo's [content organization](/content-management/organization/) and, specifically, the purpose of `_index.md` for adding content and front matter to section and other list pages. -## Section Template Lookup Order +## Section template lookup order See [Template Lookup](/templates/lookup-order/). -## Page Kinds +## Page kinds Every `Page` in Hugo has a `.Kind` attribute. {{% page-kinds %}} -## `.Site.GetPage` with Sections +## `.Site.GetPage` with sections `Kind` can easily be combined with the [`where` function][where] in your templates to create kind-specific lists of content. This method is ideal for creating lists, but there are times where you may want to fetch just the index page of a single section via the section's path. @@ -41,7 +41,7 @@ Examples: - `{{ .Site.GetPage "section" "posts" }}` - `{{ .Site.GetPage "page" "search" }}` -## Example: Creating a Default Section Template +## Example: creating a default section template {{< code file="layouts/_default/section.html" >}} {{ define "main" }} @@ -61,7 +61,7 @@ Examples: {{ end }} {{< /code >}} -### Example: Using `.Site.GetPage` +### Example: using `.Site.GetPage` The `.Site.GetPage` example that follows assumes the following project directory structure: diff --git a/docs/content/en/templates/shortcode-templates.md b/docs/content/en/templates/shortcode-templates.md index 21078a634..f293b6d52 100644 --- a/docs/content/en/templates/shortcode-templates.md +++ b/docs/content/en/templates/shortcode-templates.md @@ -1,14 +1,14 @@ --- -title: Create Your Own Shortcodes -linktitle: Shortcode Templates +title: Create your own shortcodes +linkTitle: Shortcode templates description: You can extend Hugo's built-in shortcodes by creating your own using the same templating syntax as that for single and list pages. categories: [templates] keywords: [shortcodes,templates] menu: docs: parent: templates - weight: 100 -weight: 100 + weight: 130 +weight: 130 toc: true --- @@ -18,13 +18,13 @@ Shortcodes are a means to consolidate templating into small, reusable snippets t Hugo also ships with built-in shortcodes for common use cases. (See [Content Management: Shortcodes](/content-management/shortcodes/).) {{% /note %}} -## Create Custom Shortcodes +## Create custom shortcodes Hugo's built-in shortcodes cover many common, but not all, use cases. Luckily, Hugo provides the ability to easily create custom shortcodes to meet your website's needs. {{< youtube Eu4zSaKOY4A >}} -### File Location +### File location To create a shortcode, place an HTML template in the `layouts/shortcodes` directory of your [source organization]. Consider the file name carefully since the shortcode name will mirror that of the file but without the `.html` extension. For example, `layouts/shortcodes/myshortcode.html` will be called with either `{{</* myshortcode /*/>}}` or `{{%/* myshortcode /*/%}}`. @@ -36,14 +36,14 @@ You can organize your shortcodes in subfolders, e.g. in `layouts/shortcodes/boxe Note the forward slash. -### Shortcode Template Lookup Order +### Shortcode template lookup order Shortcode templates have a simple [lookup order]: 1. `/layouts/shortcodes/<SHORTCODE>.html` 2. `/themes/<THEME>/layouts/shortcodes/<SHORTCODE>.html` -### Positional vs Named Parameters +### Positional vs. named parameters You can create shortcodes using the following types of parameters: @@ -57,7 +57,7 @@ For more complex layouts with multiple or optional parameters, named parameters Allowing both types of parameters (i.e., a "flexible" shortcode) is useful for complex layouts where you want to set default values that can be easily overridden by users. -### Access Parameters +### Access parameters All shortcode parameters can be accessed via the `.Get` method. Whether you pass a key (i.e., string) or a number to the `.Get` method depends on whether you are accessing a named or positional parameter, respectively. @@ -115,7 +115,7 @@ The `.Params` variable in shortcodes contains the list parameters passed to shor : these are the parameters passed directly into the shortcode declaration (e.g., a YouTube video ID) `$.Page.Params` -: refers to the page's params; the "page" in this case refers to the content file in which the shortcode is declared (e.g., a `shortcode_color` field in a content's front matter could be accessed via `$.Page.Params.shortcode_color`). +: refers to the page's parameters; the "page" in this case refers to the content file in which the shortcode is declared (e.g., a `shortcode_color` field in a content's front matter could be accessed via `$.Page.Params.shortcode_color`). `$.Page.Site.Params` : refers to global variables as defined in your [site's configuration file][config]. @@ -150,15 +150,15 @@ You can also use the variable `.Page` to access all the normal [page variables][ A shortcodes can also be nested. In a nested shortcode, you can access the parent shortcode context with [`.Parent` variable][shortcodesvars]. This can be very useful for inheritance of common shortcode parameters from the root. -### Checking for Existence +### Checking for existence You can check if a specific shortcode is used on a page by calling `.HasShortcode` in that page template, providing the name of the shortcode. This is sometimes useful when you want to include specific scripts or styles in the header that are only used by that shortcode. -## Custom Shortcode Examples +## Custom shortcode examples The following are examples of the different types of shortcodes you can create via shortcode template files in `/layouts/shortcodes`. -### Single-word Example: `year` +### Single-word example: `year` Let's assume you would like to keep mentions of your copyright year current in your content files without having to continually review your Markdown. Your goal is to be able to call the shortcode as follows: @@ -170,7 +170,7 @@ Let's assume you would like to keep mentions of your copyright year current in y {{ now.Format "2006" }} {{< /code >}} -### Single Positional Example: `youtube` +### Single positional example: `youtube` Embedded videos are a common addition to Markdown content that can quickly become unsightly. The following is the code used by [Hugo's built-in YouTube shortcode][youtubeshortcode]: @@ -197,7 +197,7 @@ Would load the template at `/layouts/shortcodes/youtube.html`: </div> {{< /code >}} -### Single Named Example: `image` +### Single named example: `image` Let's say you want to create your own `img` shortcode rather than use Hugo's built-in [`figure` shortcode][figure]. Your goal is to be able to call the shortcode as follows in your content files: @@ -239,7 +239,7 @@ Would be rendered as: </figure> {{< /code >}} -### Single Flexible Example: `vimeo` +### Single flexible example: `vimeo` ```go-html-template {{</* vimeo 49718712 */>}} @@ -271,7 +271,7 @@ Would be rendered as: </div> {{< /code >}} -### Paired Example: `highlight` +### Paired example: `highlight` The following is taken from `highlight`, which is a [built-in shortcode] that ships with Hugo. @@ -298,7 +298,7 @@ The rendered output of the HTML example code block will be as follows: </pre></div> {{< /code >}} -### Nested Shortcode: Image Gallery +### Nested shortcode: image gallery Hugo's [`.Parent` shortcode variable][parent] provides access to the parent shortcode context when the shortcode in question is called within the context of a *parent* shortcode. This provides an inheritance model for common shortcode parameters. @@ -341,32 +341,32 @@ This will output the following HTML. Note how the first two `img` shortcodes inh <img src="/images/three.jpg"> ``` -## Error Handling in Shortcodes +## Error handling in shortcodes Use the [errorf](/functions/errorf) template func and [.Position](/variables/shortcodes/) variable to get useful error messages in shortcodes: ```bash {{ with .Get "name" }} {{ else }} -{{ errorf "missing value for param 'name': %s" .Position }} +{{ errorf "missing value for parameter 'name': %s" .Position }} {{ end }} ``` When the above fails, you will see an `ERROR` log similar to the below: ```bash -ERROR 2018/11/07 10:05:55 missing value for param name: "/Users/bep/dev/go/gohugoio/hugo/docs/content/en/variables/shortcodes.md:32:1" +ERROR 2018/11/07 10:05:55 missing value for parameter name: "/Users/bep/dev/go/gohugoio/hugo/docs/content/en/variables/shortcodes.md:32:1" ``` -## More Shortcode Examples +## More shortcode examples More shortcode examples can be found in the [shortcodes directory for spf13.com][spfscs] and the [shortcodes directory for the Hugo docs][docsshortcodes]. -## Inline Shortcodes +## Inline shortcodes You can also implement your shortcodes inline -- e.g. where you use them in the content file. This can be useful for scripting that you only need in one place. -This feature is disabled by default, but can be enabled in your site config: +This feature is disabled by default, but can be enabled in your site configuration: {{< code-toggle file="hugo" >}} enableInlineShortcodes = true @@ -386,25 +386,24 @@ The above will print the current date and time. This means that the current page can be accessed via `.Page.Title` etc. This also means that there are no concept of "nested inline shortcodes". -The same inline shortcode can be reused later in the same content file, with different params if needed, using the self-closing syntax: +The same inline shortcode can be reused later in the same content file, with different parameters if needed, using the self-closing syntax: ```go-text-template {{</* time.inline /*/>}} ``` -[basic content files]: /content-management/formats/ "See how Hugo leverages markdown--and other supported formats--to create content for your website." +[basic content files]: /content-management/formats/ [built-in shortcode]: /content-management/shortcodes/ -[config]: /getting-started/configuration/ "Learn more about Hugo's built-in configuration variables as well as how to us your site's configuration file to include global key-values that can be used throughout your rendered website." -[Content Management: Shortcodes]: /content-management/shortcodes/#using-hugo-s-built-in-shortcodes "Check this section if you are not familiar with the definition of what a shortcode is or if you are unfamiliar with how to use Hugo's built-in shortcodes in your content files." -[source organization]: /getting-started/directory-structure/#directory-structure-explained "Learn how Hugo scaffolds new sites and what it expects to find in each of your directories." -[docsshortcodes]: https://github.com/gohugoio/hugo/tree/master/docs/layouts/shortcodes "See the shortcode source directory for the documentation site you're currently reading." +[config]: /getting-started/configuration/ +[Content Management: Shortcodes]: /content-management/shortcodes/#using-hugo-s-built-in-shortcodes +[source organization]: /getting-started/directory-structure/#directory-structure-explained +[docsshortcodes]: https://github.com/gohugoio/hugo/tree/master/docs/layouts/shortcodes [figure]: /content-management/shortcodes/#figure [hugosc]: /content-management/shortcodes/#using-hugo-s-built-in-shortcodes -[lookup order]: /templates/lookup-order/ "See the order in which Hugo traverses your template files to decide where and how to render your content at build time" -[pagevars]: /variables/page/ "See which variables you can leverage in your templating for page vs list templates." +[lookup order]: /templates/lookup-order/ +[pagevars]: /variables/page/ [parent]: /variables/shortcodes/ -[shortcodesvars]: /variables/shortcodes/ "Certain variables are specific to shortcodes, although most .Page variables can be accessed within your shortcode template." -[spfscs]: https://github.com/spf13/spf13.com/tree/master/layouts/shortcodes "See more examples of shortcodes by visiting the shortcode directory of the source for spf13.com, the blog of Hugo's creator, Steve Francia." -[templates]: /templates/ "The templates section of the Hugo docs." +[shortcodesvars]: /variables/shortcodes/ +[spfscs]: https://github.com/spf13/spf13.com/tree/master/layouts/shortcodes [vimeoexample]: #single-flexible-example-vimeo -[youtubeshortcode]: /content-management/shortcodes/#youtube "See how to use Hugo's built-in YouTube shortcode." +[youtubeshortcode]: /content-management/shortcodes/#youtube diff --git a/docs/content/en/templates/single-page-templates.md b/docs/content/en/templates/single-page-templates.md index 559f2fb17..861ced99d 100644 --- a/docs/content/en/templates/single-page-templates.md +++ b/docs/content/en/templates/single-page-templates.md @@ -1,22 +1,22 @@ --- -title: Single Page Templates +title: Single page templates description: The primary view of content in Hugo is the single view. Hugo will render every Markdown file provided with a corresponding single template. categories: [templates] keywords: [page, templates] menu: docs: parent: templates - weight: 60 -weight: 60 + weight: 50 +weight: 50 aliases: [/layout/content/] toc: true --- -## Single Page Template Lookup Order +## Single page template lookup order See [Template Lookup](/templates/lookup-order/). -## Example Single Page Templates +## Example single page templates Content pages are of the type `page` and will therefore have all the [page variables][pagevars] and [site variables] available to use in their templates. @@ -26,45 +26,44 @@ This single page template makes use of Hugo [base templates], the [`.Format` fun {{< code file="layouts/posts/single.html" >}} {{ define "main" }} - -<section id="main"> - <h1 id="title">{{ .Title }}</h1> - <div> - <article id="content"> - {{ .Content }} - </article> - </div> -</section> -<aside id="meta"> - <div> - <section> - <h4 id="date"> {{ .Date.Format "Mon Jan 2, 2006" }} </h4> - <h5 id="wordcount"> {{ .WordCount }} Words </h5> + <section id="main"> + <h1 id="title">{{ .Title }}</h1> + <div> + <article id="content"> + {{ .Content }} + </article> + </div> </section> - {{ with .GetTerms "topics" }} - <ul id="topics"> - {{ range . }} - <li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li> - {{ end }} - </ul> - {{ end }} - {{ with .GetTerms "tags" }} - <ul id="tags"> - {{ range . }} - <li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li> - {{ end }} - </ul> - {{ end }} - </div> - <div> - {{ with .PrevInSection }} - <a class="previous" href="{{ .Permalink }}"> {{ .Title }}</a> - {{ end }} - {{ with .NextInSection }} - <a class="next" href="{{ .Permalink }}"> {{ .Title }}</a> - {{ end }} - </div> -</aside> + <aside id="meta"> + <div> + <section> + <h4 id="date"> {{ .Date.Format "Mon Jan 2, 2006" }} </h4> + <h5 id="wordcount"> {{ .WordCount }} Words </h5> + </section> + {{ with .GetTerms "topics" }} + <ul id="topics"> + {{ range . }} + <li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li> + {{ end }} + </ul> + {{ end }} + {{ with .GetTerms "tags" }} + <ul id="tags"> + {{ range . }} + <li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li> + {{ end }} + </ul> + {{ end }} + </div> + <div> + {{ with .PrevInSection }} + <a class="previous" href="{{ .Permalink }}"> {{ .Title }}</a> + {{ end }} + {{ with .NextInSection }} + <a class="next" href="{{ .Permalink }}"> {{ .Title }}</a> + {{ end }} + </div> + </aside> {{ end }} {{< /code >}} @@ -72,13 +71,12 @@ To easily generate new instances of a content type (e.g., new `.md` files in a s [archetypes]: /content-management/archetypes/ [base templates]: /templates/base/ -[config]: /getting-started/configuration/ [content type]: /content-management/types/ [directory structure]: /getting-started/directory-structure/ [dry]: https://en.wikipedia.org/wiki/Don%27t_repeat_yourself [`.format` function]: /functions/format/ [front matter]: /content-management/front-matter/ -[pagetaxonomy]: /templates/taxonomy-templates/#display-a-single-piece-of-contents-taxonomies +[pagetaxonomy]: /templates/taxonomy-templates/#list-terms-assigned-to-a-page [pagevars]: /variables/page/ [partials]: /templates/partials/ [section]: /content-management/sections/ diff --git a/docs/content/en/templates/sitemap-template.md b/docs/content/en/templates/sitemap-template.md index 37462a086..32299bf52 100644 --- a/docs/content/en/templates/sitemap-template.md +++ b/docs/content/en/templates/sitemap-template.md @@ -1,13 +1,13 @@ --- -title: Sitemap Templates +title: Sitemap templates description: Hugo provides built-in sitemap templates. categories: [templates] keywords: [sitemap, xml, templates] menu: docs: parent: templates - weight: 160 -weight: 160 + weight: 170 +weight: 170 aliases: [/layout/sitemap/,/templates/sitemap/] toc: true --- @@ -43,7 +43,7 @@ filename priority : The priority of a page relative to any other page on the site. Valid values range from 0.0 to 1.0. Default is `-1` (priority omitted from rendered sitemap). -## Override Default Values +## Override default values Override the default values for a given page in front matter. @@ -54,7 +54,7 @@ title = 'News' priority = 0.8 {{</ code-toggle >}} -## Override Built-in Templates +## Override built-in templates To override the built-in sitemap.xml template, create a new file in either of these locations: @@ -68,7 +68,7 @@ To override the built-in sitemapindex.xml template, create a new file in either - layouts/sitemapindex.xml - layouts/_default/sitemapindex.xml -## Disable Sitemap Generation +## Disable sitemap generation You may disable sitemap generation in your site configuration: diff --git a/docs/content/en/templates/taxonomy-templates.md b/docs/content/en/templates/taxonomy-templates.md index e343df471..9b4117e66 100644 --- a/docs/content/en/templates/taxonomy-templates.md +++ b/docs/content/en/templates/taxonomy-templates.md @@ -1,13 +1,13 @@ --- -title: Taxonomy Templates +title: Taxonomy templates description: Taxonomy templating includes taxonomy list pages, taxonomy terms pages, and using taxonomies in your single page templates. categories: [templates] keywords: [taxonomies,metadata,front matter,terms,templates] menu: docs: parent: templates - weight: 50 -weight: 50 + weight: 90 +weight: 90 aliases: [/taxonomies/displaying/,/templates/terms/,/indexes/displaying/,/taxonomies/templates/,/indexes/ordering/, /templates/taxonomies/, /templates/taxonomy/] toc: true --- @@ -23,21 +23,21 @@ Hugo provides multiple ways to use taxonomies throughout your project templates: * Order the way the terms for a taxonomy are displayed in a [taxonomy terms template](#taxonomy-terms-templates) * List a single content's taxonomy terms within a [single page template] -## Taxonomy List Templates +## Taxonomy list templates Taxonomy list page templates are lists and therefore have all the variables and methods available to [list pages][lists]. -### Taxonomy List Template Lookup Order +### Taxonomy list template lookup order See [Template Lookup](/templates/lookup-order/). -## Taxonomy Terms Templates +## Taxonomy terms templates -### Taxonomy Terms Templates Lookup Order +### Taxonomy terms templates lookup order See [Template Lookup](/templates/lookup-order/). -### Taxonomy Methods +### Taxonomy methods A Taxonomy is a `map[string]WeightedPages`. @@ -95,40 +95,40 @@ type WeightedPages []WeightedPage .Pages : Returns a slice of pages, which then can be ordered using any of the [list methods][renderlists]. -## Displaying custom metadata in Taxonomy Terms Templates +## Displaying custom metadata in taxonomy terms templates If you need to display custom metadata for each taxonomy term, you will need to create a page for that term at `/content/<TAXONOMY>/<TERM>/_index.md` and add your metadata in its front matter, [as explained in the taxonomies documentation](/content-management/taxonomies/#add-custom-metadata-to-a-taxonomy-or-term). Based on the Actors taxonomy example shown there, within your taxonomy terms template, you may access your custom fields by iterating through the variable `.Pages` as such: ```go-html-template <ul> - {{ range .Pages }} - <li> - <a href="{{ .Permalink }}">{{ .Title }}</a> - {{ .Params.wikipedia }} - </li> - {{ end }} + {{ range .Pages }} + <li> + <a href="{{ .Permalink }}">{{ .Title }}</a> + {{ .Params.wikipedia }} + </li> + {{ end }} </ul> ``` <!-- Begin /taxonomies/ordering/ --> -## Order Taxonomies +## Order taxonomies Taxonomies can be ordered by either alphabetical key or by the number of content pieces assigned to that key. -### Order Alphabetically Example +### Order alphabetically example ```go-html-template <ul> - {{ range .Data.Terms.Alphabetical }} - <li><a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a> {{ .Count }}</li> - {{ end }} + {{ range .Data.Terms.Alphabetical }} + <li><a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a> {{ .Count }}</li> + {{ end }} </ul> ``` <!-- [See Also Taxonomy Lists](/templates/list/) --> -## Order Content within Taxonomies +## Order content within taxonomies Hugo uses both `date` and `weight` to order content within taxonomies. @@ -140,11 +140,10 @@ The default weight for any piece of content is 0. Zero means "does not have a we Weights of zero are thus treated specially: if two pages have unequal weights, and one of them is zero, then the zero-weighted page will always appear after the other one, regardless of the other's weight. Zero weights should thus be used with care: for example, if both positive and negative weights are used to extend a sequence in both directions, a zero-weighted page will appear not in the middle of the list, but at the end. -### Assign Weight +### Assign weight Content can be assigned weight for each taxonomy that it's assigned to. - {{< code-toggle file="content/example.md" fm=true copy=false >}} tags = [ "a", "b", "c" ] tags_weight = 22 @@ -186,79 +185,75 @@ using the [list templates](/templates/lists/): 3. You can list all terms for a taxonomy 4. You can list all taxonomies (with their terms) -## Display a Single Piece of Content's Taxonomies - -Within your content templates, you may wish to display the taxonomies that piece of content is assigned to. +## List terms assigned to a page -Because we are leveraging the front matter system to define taxonomies for content, the taxonomies assigned to each content piece are located in the usual place (i.e., `.Params.<TAXONOMYPLURAL>`). +List the terms assigned to a page using the `.Page.GetTerms` method. -### Example: List Tags in a Single Page Template +To render an unordered list: ```go-html-template -<ul> - {{ range (.GetTerms "tags") }} - <li><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li> +{{ $taxonomy := "tags" }} +{{ with .GetTerms $taxonomy }} + <p>{{ (site.GetPage $taxonomy).LinkTitle }}:</p> + <ul> + {{ range . }} + <li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li> {{ end }} -</ul> + </ul> +{{ end }} ``` -If you want to list taxonomies inline, you will have to take care of optional plural endings in the title (if multiple taxonomies), as well as commas. Let's say we have a taxonomy "directors" such as `directors: [ "Joel Coen", "Ethan Coen" ]` in the TOML-format front matter. - -To list such taxonomies, use the following: - -### Example: Comma-delimit Tags in a Single Page Template +To render a comma-delimited list: ```go-html-template -{{ $taxo := "directors" }} <!-- Use the plural form here --> -{{ with .Param $taxo }} - <strong>Director{{ if gt (len .) 1 }}s{{ end }}:</strong> - {{ range $index, $director := . }} - {{- if gt $index 0 }}, {{ end -}} - {{ with $.Site.GetPage (printf "/%s/%s" $taxo $director) -}} - <a href="{{ .Permalink }}">{{ $director }}</a> - {{- end -}} - {{- end -}} +{{ $taxonomy := "tags" }} +{{ with .GetTerms $taxonomy }} + <p> + {{ (site.GetPage $taxonomy).LinkTitle }}: + {{ range $k, $_ := . -}} + {{ if $k }}, {{ end }} + <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a> + {{- end }} + </p> {{ end }} ``` -Alternatively, you may use the [delimit template function][delimit] as a shortcut if the taxonomies should just be listed with a separator. See {{< gh 2143 >}} on GitHub for discussion. - -## List Content with the Same Taxonomy Term +## List content with the same taxonomy term If you are using a taxonomy for something like a series of posts, you can list individual pages associated with the same taxonomy. This is also a quick and dirty method for showing related content: -### Example: Showing Content in Same Series +### Example: showing content in same series ```go-html-template <ul> - {{ range .Site.Taxonomies.series.golang }} - <li><a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a></li> - {{ end }} + {{ range .Site.Taxonomies.series.golang }} + <li><a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a></li> + {{ end }} </ul> ``` -## List All content in a Given taxonomy +## List all content in a given taxonomy This would be very useful in a sidebar as “featured content”. You could even have different sections of “featured content” by assigning different terms to the content. -### Example: Grouping "Featured" Content +### Example: grouping "featured" content ```go-html-template <section id="menu"> - <ul> - {{ range $key, $taxonomy := .Site.Taxonomies.featured }} - <li>{{ $key }}</li> - <ul> - {{ range $taxonomy.Pages }} - <li hugo-nav="{{ .RelPermalink }}"><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li> - {{ end }} - </ul> + <ul> + {{ range $key, $taxonomy := .Site.Taxonomies.featured }} + <li>{{ $key }}</li> + <ul> + {{ range $taxonomy.Pages }} + <li hugo-nav="{{ .RelPermalink }}"><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li> {{ end }} - </ul> + </ul> + {{ end }} + </ul> </section> ``` -## Render a Site's Taxonomies +## Render a site's taxonomies If you wish to display the list of all keys for your site's taxonomy, you can retrieve them from the [`.Site` variable][sitevars] available on every page. @@ -266,57 +261,56 @@ This may take the form of a tag cloud, a menu, or simply a list. The following example displays all terms in a site's tags taxonomy: -### Example: List All Site Tags {#example-list-all-site-tags} +### Example: list all site tags ```go-html-template <ul> - {{ range .Site.Taxonomies.tags }} - <li><a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a> {{ .Count }}</li> - {{ end }} + {{ range .Site.Taxonomies.tags }} + <li><a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a> {{ .Count }}</li> + {{ end }} </ul> ``` -### Example: List All Taxonomies, Terms, and Assigned Content +### Example: list all taxonomies, terms, and assigned content This example will list all taxonomies and their terms, as well as all the content assigned to each of the terms. {{< code file="layouts/partials/all-taxonomies.html" >}} -<section> - <ul id="all-taxonomies"> - {{ range $taxonomy_term, $taxonomy := .Site.Taxonomies }} - {{ with $.Site.GetPage (printf "/%s" $taxonomy_term) }} - <li><a href="{{ .Permalink }}">{{ $taxonomy_term }}</a> - <ul> - {{ range $key, $value := $taxonomy }} - <li>{{ $key }}</li> - <ul> - {{ range $value.Pages }} - <li hugo-nav="{{ .RelPermalink }}"> - <a href="{{ .Permalink }}">{{ .LinkTitle }}</a> - </li> - {{ end }} - </ul> - {{ end }} - </ul> - </li> - {{ end }} +<ul> + {{ range $taxonomy, $terms := site.Taxonomies }} + <li> + {{ with site.GetPage $taxonomy }} + <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a> + {{ end }} + <ul> + {{ range $term, $weightedPages := $terms }} + <li> + <a href="{{ .Page.RelPermalink }}">{{ .Page.LinkTitle }}</a> + <ul> + {{ range $weightedPages }} + <li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li> + {{ end }} + </ul> + </li> {{ end }} - </ul> -</section> + </ul> + </li> + {{ end }} +</ul> {{< /code >}} -## `.Site.GetPage` for Taxonomies +## `.Site.GetPage` for taxonomies Because taxonomies are lists, the [`.GetPage` function][getpage] can be used to get all the pages associated with a particular taxonomy term using a terse syntax. The following ranges over the full list of tags on your site and links to each of the individual taxonomy pages for each term without having to use the more fragile URL construction of the ["List All Site Tags" example above](#example-list-all-site-tags): {{< code file="links-to-all-tags.html" >}} {{ $taxo := "tags" }} <ul class="{{ $taxo }}"> - {{ with ($.Site.GetPage (printf "/%s" $taxo)) }} - {{ range .Pages }} - <li><a href="{{ .Permalink }}">{{ .Title }}</a></li> - {{ end }} + {{ with ($.Site.GetPage (printf "/%s" $taxo)) }} + {{ range .Pages }} + <li><a href="{{ .Permalink }}">{{ .Title }}</a></li> {{ end }} + {{ end }} </ul> {{< /code >}} diff --git a/docs/content/en/templates/template-debugging.md b/docs/content/en/templates/template-debugging.md index 0f32fa732..fd400018b 100644 --- a/docs/content/en/templates/template-debugging.md +++ b/docs/content/en/templates/template-debugging.md @@ -1,20 +1,20 @@ --- -title: Template Debugging +title: Template debugging description: You can use Go templates' `printf` function to debug your Hugo templates. These snippets provide a quick and easy visualization of the variables available to you in different contexts. categories: [templates] keywords: [debugging,troubleshooting] menu: docs: parent: templates - weight: 180 -weight: 180 + weight: 240 +weight: 240 --- Here are some snippets you can add to your template to answer some common questions. These snippets use the `printf` function available in all Go templates. This function is an alias to the Go function, [fmt.Printf](https://pkg.go.dev/fmt). -## What Variables are Available in this Context? +## What variables are available in this context? You can use the template syntax, `$.`, to get the top-level template context from anywhere in your template. This will print out all the values under, `.Site`. @@ -44,7 +44,15 @@ When developing a [homepage], what does one of the pages you're looping through {{ end }} ``` -## Why Am I Showing No Defined Variables? +In some cases it might be more helpful to use the following snippet on the current context to get a pretty printed view of what you're able to work with: + +```go-html-template +<pre>{{ . | jsonify (dict "indent" " ") }}</pre> +``` + +Note that Hugo will throw an error if you attempt to use this construct to display context that includes a page collection (e.g., the context passed to home, section, taxonomy, and term templates). + +## Why am I showing no defined variables? Check that you are passing variables in the `partial` function: diff --git a/docs/content/en/templates/views.md b/docs/content/en/templates/views.md index 24ff61150..3d00a4ed6 100644 --- a/docs/content/en/templates/views.md +++ b/docs/content/en/templates/views.md @@ -1,13 +1,13 @@ --- -title: Content View Templates -description: Hugo can render alternative views of your content, which is especially useful in list and summary views. +title: Content view templates +description: Hugo can render alternative views of your content, useful in list and summary views. categories: [templates] keywords: [views] menu: docs: parent: templates - weight: 70 -weight: 70 + weight: 110 +weight: 110 toc: true --- @@ -18,7 +18,7 @@ The following are common use cases for content views: * You want content of every type to be shown on the homepage but only with limited [summary views][summaries]. * You only want a bulleted list of your content on a [taxonomy list page][taxonomylists]. Views make this very straightforward by delegating the rendering of each different type of content to the content itself. -## Create a Content View +## Create a content view To create a new view, create a template in each of your different content type directories with the view name. The following example contains an "li" view and a "summary" view for the `posts` and `project` content types. As you can see, these sit next to the [single content view][single] template, `single.html`. You can even provide a specific view for a given type and continue to use the `_default/single.html` for the primary view. @@ -45,7 +45,7 @@ Hugo also has support for a default content template to be used in the event tha summary.html ``` -## Which Template Will be Rendered? +## Which template will be rendered? The following is the [lookup order][lookup] for content views: @@ -54,7 +54,7 @@ The following is the [lookup order][lookup] for content views: 3. `/themes/<THEME>/layouts/<TYPE>/<VIEW>.html` 4. `/themes/<THEME>/layouts/_default/<VIEW>.html` -## Example: Content View Inside a List +## Example: content view inside a list The following example demonstrates how to use content views inside your [list templates][lists]. diff --git a/docs/content/en/tools/_index.md b/docs/content/en/tools/_index.md index b553dac9c..6cc8c44d7 100644 --- a/docs/content/en/tools/_index.md +++ b/docs/content/en/tools/_index.md @@ -1,14 +1,15 @@ --- -title: Developer Tools -linktitle: Developer Tools Overview +title: Developer tools +linkTitle: Overview description: In addition to Hugo's powerful CLI, there is a large number of community-developed tool chains for Hugo developers. categories: [developer tools] keywords: [] menu: docs: - parent: tools - weight: 01 -weight: 01 + identifier: developer-tools-overview + parent: developer-tools + weight: 10 +weight: 10 --- One of Hugo's greatest strengths is its passionate---and always evolving---developer community. With the exception of the `highlight` shortcode mentioned in [Syntax Highlighting][syntax], the tools and other projects featured in this section are offerings from both commercial services and open-source projects, many of which are developed by Hugo developers just like you. diff --git a/docs/content/en/tools/editors.md b/docs/content/en/tools/editors.md index 5efeba336..92720ab42 100644 --- a/docs/content/en/tools/editors.md +++ b/docs/content/en/tools/editors.md @@ -1,14 +1,14 @@ --- -title: Editor Plug-ins for Hugo -linktitle: Editor Plug-ins +title: Editor plugins for Hugo +linkTitle: Editor plugins description: The Hugo community uses a wide range of preferred tools and has developed plug-ins for some of the most popular text editors to help automate parts of your workflow. categories: [developer tools] keywords: [editor, plug-ins] menu: docs: - parent: tools - weight: 50 -weight: 50 + parent: developer-tools + weight: 20 +weight: 20 --- The Hugo community uses a wide range of preferred tools and has developed plug-ins for some of the most popular text editors to help automate parts of your workflow. @@ -37,9 +37,4 @@ The Hugo community uses a wide range of preferred tools and has developed plug-i * [Vim Hugo Helper](https://github.com/robertbasic/vim-hugo-helper). A small Vim plugin to help me with writing posts with Hugo. * [vim-hugo](https://github.com/phelipetls/vim-hugo). A Vim plugin with syntax highlighting for templates and a few other features. -## Atom - -* [Hugofy](https://atom.io/packages/hugofy). A Hugo Static Website Generator package for Atom. -* [language-hugo](https://atom.io/packages/language-hugo). Adds syntax highlighting to Hugo files. - [formats]: /content-management/formats/ diff --git a/docs/content/en/tools/frontends.md b/docs/content/en/tools/frontends.md index 1bfaf0995..bc4df22b5 100644 --- a/docs/content/en/tools/frontends.md +++ b/docs/content/en/tools/frontends.md @@ -1,22 +1,22 @@ --- -title: Frontend Interfaces with Hugo -linktitle: Frontends +title: Frontend interfaces with Hugo +linkTitle: Frontends description: Do you prefer a graphical user interface over a text editor? Give these frontends a try. categories: [developer tools] keywords: [frontend, gui] menu: docs: - parent: tools - weight: 40 -weight: 40 + parent: developer-tools + weight: 30 +weight: 30 --- - [enwrite](https://github.com/zzamboni/enwrite). Enwrite enables evernote-powered, statically generated blogs and websites. Now posting to your blog or updating your website is as easy as writing a new note in Evernote! - [Lipi](https://github.com/SohanChy/Lipi). Lipi is a native GUI frontend written in Java to manage your Hugo websites. -- [Netlify CMS](https://netlifycms.org). Netlify CMS is an open source, serverless solution for managing Git based content in static sites, and it works on any platform that can host static sites. A [Hugo/Netlify CMS starter](https://github.com/netlify-templates/one-click-hugo-cms) is available to get new projects running quickly. +- [Decap CMS (formerly Netlify CMS)](https://decapcms.org/). Decap CMS is an open source, serverless solution for managing Git based content in static sites, and it works on any platform that can host static sites. A [Hugo/Decap CMS starter](https://github.com/decaporg/one-click-hugo-cms) is available to get new projects running quickly. - [Hokus CMS](https://github.com/julianoappelklein/hokus). Hokus CMS is an open source, multi-platform, easy to use, desktop application for Hugo. Build from simple to complex user interfaces for Hugo websites by choosing from a dozen ready-to-use components — all for free, with no vendor lock-in. -## Commercial Services +## Commercial services - [DATOCMS](https://www.datocms.com) DatoCMS is a fully customizable administrative area for your static websites. Use your favorite website generator, let your clients publish new content independently, and the host the site anywhere you like. - [CloudCannon](https://cloudcannon.com/hugo-cms/). The intuitive Git-based CMS for your Hugo website. CloudCannon syncs changes from your Git repository and pushes content changes back, so your development and content teams are always in sync. Edit all of your content on the page with visual editing, build entire pages with reusable custom components and then publish confidently. diff --git a/docs/content/en/tools/migrations.md b/docs/content/en/tools/migrations.md index 0156c46db..6ef605ec6 100644 --- a/docs/content/en/tools/migrations.md +++ b/docs/content/en/tools/migrations.md @@ -1,13 +1,13 @@ --- title: Migrate to Hugo -linktitle: Migrations +linkTitle: Migrations description: A list of community-developed tools for migrating from your existing static site generator or content management system to Hugo. keywords: [migrations, jekyll, wordpress, drupal, ghost, contentful] menu: docs: - parent: tools - weight: 10 -weight: 10 + parent: developer-tools + weight: 50 +weight: 50 aliases: [/developer-tools/migrations/, /developer-tools/migrated/] toc: true --- @@ -47,7 +47,7 @@ Alternatively, you can use the new [Jekyll import command](/commands/hugo_import ## Medium -- [medium2md](https://github.com/gautamdhameja/medium-2-md) - A simple Medium to Hugo exporter able to import stories in one command, including Front Matter. +- [medium2md](https://github.com/gautamdhameja/medium-2-md) - A simple Medium to Hugo exporter able to import stories in one command, including front matter. - [medium-to-hugo](https://github.com/bgadrian/medium-to-hugo) - CLI tool written in Go to export medium posts into a Hugo compatible Markdown format. Tags and images are included. All images will be downloaded locally and linked appropriately. ## Tumblr diff --git a/docs/content/en/tools/other.md b/docs/content/en/tools/other.md index 3f8aeebbb..272827911 100644 --- a/docs/content/en/tools/other.md +++ b/docs/content/en/tools/other.md @@ -1,14 +1,14 @@ --- -title: Other Hugo Community Projects -linktitle: Other Projects +title: Other community projects +linkTitle: Other projects description: Some interesting projects developed by the Hugo community that don't quite fit into our other developer tool categories. categories: [developer tools] keywords: [frontend, gui] menu: docs: - parent: tools - weight: 70 -weight: 70 + parent: developer-tools + weight: 60 +weight: 60 --- And for all the other small things around Hugo: diff --git a/docs/content/en/tools/search.md b/docs/content/en/tools/search.md index 030e9f2c7..620ba4862 100644 --- a/docs/content/en/tools/search.md +++ b/docs/content/en/tools/search.md @@ -1,12 +1,12 @@ --- -title: Search for your Hugo Website -linktitle: Search +title: Search for your Hugo website +linkTitle: Search description: See some of the open-source and commercial search options for your newly created Hugo website. menu: docs: - parent: tools - weight: 60 -weight: 60 + parent: developer-tools + weight: 40 +weight: 40 toc: true --- @@ -23,7 +23,7 @@ A static website with a dynamic search function? Yes, Hugo provides an alternati * [Pagefind](https://github.com/cloudcannon/pagefind). A fully static search library that aims to perform well on large sites, while using as little of your users' bandwidth as possible. * [Hugo Lyra](https://github.com/paolomainardi/hugo-lyra). Hugo-Lyra is a JavaScript module to integrate [Lyra](https://github.com/LyraSearch/lyra) into a Hugo website. It contains the server-side part to generate the index and the client-side library (optional) to bootstrap the search engine easily. -## Commercial Search Services +## Commercial search services * [Algolia](https://www.algolia.com/)'s Search API makes it easy to deliver a great search experience in your apps and websites. Algolia Search provides hosted full-text, numerical, faceted, and geolocalized search. * [Bonsai](https://www.bonsai.io) is a fully-managed hosted Elasticsearch service that is fast, reliable, and simple to set up. Easily ingest your docs from Hugo into Elasticsearch following [this guide from the docs](https://docs.bonsai.io/hc/en-us/articles/13929190788756-Hugo). diff --git a/docs/content/en/tools/starter-kits.md b/docs/content/en/tools/starter-kits.md deleted file mode 100644 index 69c8f3e0b..000000000 --- a/docs/content/en/tools/starter-kits.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: Starter Kits -description: A list of community-developed projects designed to help you get up and running with Hugo. -keywords: [starters,assets,pipeline] -menu: - docs: - parent: tools - weight: 30 -weight: 30 -aliases: [/developer-tools/migrations/,/developer-tools/migrated/] ---- - -Know of a Hugo-related starter kit that isn't mentioned here? [Please add it to the list.][addkit] - -{{% note %}} -The following starter kits are developed by active members of the Hugo community. If you find yourself having issues with any of the projects, it's best to file an issue directly with the project's maintainer(s). -{{% /note %}} - -* [Wowchemy]. Wowchemy is the 5,500+ star open source Hugo starter kit and website builder trusted by 750,000+ sites since 2016. Create _any_ kind of site with [50+ templates, widgets, and extensions](https://wowchemy.com/). Translated into 35+ languages and backed by a large, active community of 150+ contributors. -* [Hugo Wrapper][hugow]. Hugo Wrapper is a POSIX-style shell script which acts as a wrapper to download and run Hugo binary for your platform. It can be executed in variety of [Operating Systems][hugow-test] and [Command Shells][hugow-test]. -* [GOHUGO AMP]. GoHugo AMP is a starter theme that aims to make it easy to adopt [Google's AMP Project][amp]. The starter kit comes with 40+ shortcodes and partials plus automatic structured data. The project also includes a [separate site with extensive documentation][gohugodocs]. -* [Hyas]. Hyas is a Hugo starter helping you build modern websites that are secure, fast, and SEO-ready — by default. It is Netlify-ready (functions, redirects, headers) and comes with [documentation](https://gethyas.com/) to easily make it your own. - -[Wowchemy]: https://github.com/wowchemy/wowchemy-hugo-modules -[addkit]: https://github.com/gohugoio/hugo/edit/master/docs/content/en/tools/starter-kits.md -[amp]: https://amp.dev -[GOHUGO AMP]: https://github.com/wildhaber/gohugo-amp -[gohugodocs]: https://github.com/wildhaber/gohugo-amp.gohugohq.com -[hugow]: https://github.com/khos2ow/hugo-wrapper -[hugow-test]: https://github.com/khos2ow/hugo-wrapper#tested-on -[Hyas]: https://github.com/h-enk/hyas diff --git a/docs/content/en/troubleshooting/_index.md b/docs/content/en/troubleshooting/_index.md index 51f1791a3..01b38ecdb 100644 --- a/docs/content/en/troubleshooting/_index.md +++ b/docs/content/en/troubleshooting/_index.md @@ -1,11 +1,13 @@ --- title: Troubleshoot +linkTitle: Overview description: Frequently asked questions and known issues pulled from the Hugo Discuss forum. menu: docs: + identifier: troubleshooting-overview parent: troubleshooting - weight: 1 -weight: 1 + weight: 10 +weight: 10 aliases: [/troubleshooting/faqs/,/faqs/] --- diff --git a/docs/content/en/troubleshooting/build-performance.md b/docs/content/en/troubleshooting/build-performance.md index b58cdc11f..b4bbe28da 100644 --- a/docs/content/en/troubleshooting/build-performance.md +++ b/docs/content/en/troubleshooting/build-performance.md @@ -1,14 +1,15 @@ --- -title: Build Performance +title: Build performance description: An overview of features used for diagnosing and improving performance issues in site builds. menu: docs: parent: troubleshooting -weight: 3 + weight: 30 +weight: 30 toc: true --- -## Template Metrics +## Template metrics Hugo is a very fast static site generator, but it is possible to write inefficient templates. Hugo's _template metrics_ feature is extremely helpful @@ -63,14 +64,14 @@ Template Metrics: ``` {{% note %}} -**A Note About Parallelism** +**A note about parallelism** Hugo builds pages in parallel where multiple pages are generated simultaneously. Because of this parallelism, the sum of "cumulative duration" values is usually greater than the actual time it takes to build a site. {{% /note %}} -## Cached Partials +## Cached partials Some `partial` templates such as sidebars or menus are executed many times during a site build. Depending on the content within the `partial` template and diff --git a/docs/content/en/troubleshooting/faq.md b/docs/content/en/troubleshooting/faq.md index 04e857acb..c854b273d 100644 --- a/docs/content/en/troubleshooting/faq.md +++ b/docs/content/en/troubleshooting/faq.md @@ -1,13 +1,14 @@ --- -title: Frequently Asked Questions -linktitle: FAQ +title: Frequently asked questions +linkTitle: Frequently asked questions description: Solutions to some common Hugo problems. categories: [troubleshooting] menu: docs: parent: troubleshooting + weight: 20 +weight: 20 keywords: [faqs] -weight: 2 toc: true aliases: [/faq/] --- @@ -18,7 +19,7 @@ aliases: [/faq/] ## I can't see my content! -Is your Markdown file [in draft mode](https://gohugo.io/content-management/front-matter/#front-matter-variables)? When testing, run `hugo server` with the `-D` or `--buildDrafts` [switch](https://gohugo.io/getting-started/usage/#draft-future-and-expired-content). +Is your Markdown file [in draft mode](/content-management/front-matter/#front-matter-variables)? When testing, run `hugo server` with the `-D` or `--buildDrafts` [switch](/getting-started/usage/#draft-future-and-expired-content). Is your Markdown file part of a [leaf bundle](/content-management/page-bundles/)? If there is an `index.md` file in the same or any parent directory then other Markdown files will not be rendered as individual pages. @@ -28,7 +29,7 @@ Yes you can! See [Configure with Environment Variables](/getting-started/configu ## How do I schedule posts? -1. Set `publishDate` in the page [Front Matter](/content-management/front-matter/) to a datetime in the future. If you want the creation and publication datetime to be the same, it's also sufficient to only set `date`[^date-hierarchy]. +1. Set `publishDate` in the page [front matter](/content-management/front-matter/) to a datetime in the future. If you want the creation and publication datetime to be the same, it's also sufficient to only set `date`[^date-hierarchy]. 2. Build and publish at intervals. How to automate the "publish at intervals" part depends on your situation: @@ -42,7 +43,7 @@ Also see this Twitter thread: {{< tweet user="ChrisShort" id="962380712027590657" >}} -[^date-hierarchy]: See [Configure Dates](https://gohugo.io/getting-started/configuration/#configure-dates) for the order in which the different date variables are complemented by each other when not explicitly set. +[^date-hierarchy]: See [Configure Dates](/getting-started/configuration/#configure-dates) for the order in which the different date variables are complemented by each other when not explicitly set. ## Can I use the latest Hugo version on Netlify? diff --git a/docs/content/en/variables/_index.md b/docs/content/en/variables/_index.md index 9b5289573..1ad42a9b3 100644 --- a/docs/content/en/variables/_index.md +++ b/docs/content/en/variables/_index.md @@ -1,14 +1,15 @@ --- -title: Variables and Params -linktitle: Variables Overview +title: Variables and parameters +linkTitle: Overview description: Page-, file-, taxonomy-, and site-level variables and parameters available in templates. -categories: [variables and params] +categories: [variables and parameters] keywords: [variables,params,values,globals] menu: docs: + identifier: variables-overview parent: variables weight: 1 -weight: 01 +weight: 1 aliases: [/templates/variables/] --- diff --git a/docs/content/en/variables/files.md b/docs/content/en/variables/files.md index 784ab7c64..fa2a63a9c 100644 --- a/docs/content/en/variables/files.md +++ b/docs/content/en/variables/files.md @@ -1,7 +1,7 @@ --- -title: File Variables +title: File variables description: "Use File variables to access file-related values for each page that is backed by a file." -categories: [variables and params] +categories: [variables and parameters] keywords: [files] menu: docs: diff --git a/docs/content/en/variables/git.md b/docs/content/en/variables/git.md index dfd6e5407..0804f6a32 100644 --- a/docs/content/en/variables/git.md +++ b/docs/content/en/variables/git.md @@ -1,8 +1,8 @@ --- -title: Git Info Variables -linktitle: Git Variables +title: Git variables +linkTitle: Git variables description: Get the last Git revision information for every content file. -categories: [variables and params] +categories: [variables and parameters] keywords: [git] menu: docs: @@ -16,13 +16,13 @@ aliases: [/extras/gitinfo/] Hugo's Git integrations should be fairly performant but *can* increase your build time. This will depend on the size of your Git history. {{% /note %}} -## `.GitInfo` Prerequisites +## `.GitInfo` prerequisites 1. The Hugo site must be in a Git-enabled directory. 2. The Git executable must be installed and in your system `PATH`. 3. The `.GitInfo` feature must be enabled in your Hugo project by passing `--enableGitInfo` flag on the command line or by setting `enableGitInfo` to `true` in your [site's configuration file][configuration]. -## The `.GitInfo` Object +## The `.GitInfo` object The `GitInfo` object contains the following fields: diff --git a/docs/content/en/variables/menus.md b/docs/content/en/variables/menus.md index b88514803..0fe727cd8 100644 --- a/docs/content/en/variables/menus.md +++ b/docs/content/en/variables/menus.md @@ -1,7 +1,7 @@ --- -title: Menu Variables +title: Menu variables description: Use these variables and methods in your menu templates. -categories: [variables and params] +categories: [variables and parameters] keywords: [menus] menu: docs: diff --git a/docs/content/en/variables/page.md b/docs/content/en/variables/page.md index edad543ad..fc6e2f567 100644 --- a/docs/content/en/variables/page.md +++ b/docs/content/en/variables/page.md @@ -1,7 +1,7 @@ --- -title: Page Variables +title: Page variables description: Page-level variables are defined in a content file's front matter, derived from the content's file location, or extracted from the content body itself. -categories: [variables and params] +categories: [variables and parameters] keywords: [pages] menu: docs: @@ -13,7 +13,7 @@ toc: true The following is a list of page-level variables. Many of these will be defined in the front matter, derived from file location, or extracted from the content itself. -## Page Variables +## Page variables .AlternativeOutputFormats : contains all alternative formats for a given page; this variable is especially useful `link rel` list in your site's `<head>`. (See [Output Formats](/templates/output-formats/).) @@ -176,7 +176,7 @@ https://remarkjs.com) .WordCount : the number of words in the content. -## Writable Page-scoped Variables +## Writable page-scoped variables [.Scratch][scratch] : returns a Scratch to store and manipulate data. In contrast to the [`.Store`][store] method, this scratch is reset on server rebuilds. @@ -184,13 +184,13 @@ https://remarkjs.com) [.Store][store] : returns a Scratch to store and manipulate data. In contrast to the [`.Scratch`][scratch] method, this scratch is not reset on server rebuilds. -## Section Variables and Methods +## Section variables and methods Also see [Sections](/content-management/sections/). {{< readfile file="/content/en/readfiles/sectionvars.md" markdown="true" >}} -## The `.Pages` Variable {#pages} +## The `.Pages` variable {#pages} `.Pages` is an alias to `.Data.Pages`. It is conventional to use the aliased form `.Pages`. @@ -199,7 +199,7 @@ aliased form `.Pages`. {{< getcontent path="readfiles/pages-vs-site-pages.md" >}} -## Page Fragments +## Page fragments {{< new-in "0.111.0" >}} @@ -249,7 +249,7 @@ For this reason, Hugo provides a global `page` function that you can use to acce There are one caveat with this, and this isn't new, but it's worth mentioning here: There are situations in Hugo where you may see a cached value, e.g. when using `partialCached` or in a shortcode. -## Page-level Params +## Page-level params Any other value defined in the front matter in a content file, including taxonomies, will be made available as part of the `.Params` variable. @@ -290,9 +290,9 @@ This template would render as follows: See [Archetypes](/content-management/archetypes/) for consistency of `Params` across pieces of content. {{% /note %}} -### The `.Param` Method +### The `.Param` method -In Hugo, you can declare params in individual pages and globally for your entire website. A common use case is to have a general value for the site param and a more specific value for some of the pages (i.e., a header image): +In Hugo, you can declare parameters in individual pages and globally for your entire website. A common use case is to have a general value for the site parameter and a more specific value for some of the pages (i.e., a header image): ```go-html-template {{ $.Param "header_image" }} @@ -300,7 +300,7 @@ In Hugo, you can declare params in individual pages and globally for your entire The `.Param` method provides a way to resolve a single value according to it's definition in a page parameter (i.e. in the content's front matter) or a site parameter (i.e., in your site configuration). -### Access Nested Fields in Front Matter +### Access nested fields in front matter When front matter contains nested fields like the following: diff --git a/docs/content/en/variables/pages.md b/docs/content/en/variables/pages.md index 15904de95..3917a6558 100644 --- a/docs/content/en/variables/pages.md +++ b/docs/content/en/variables/pages.md @@ -1,7 +1,7 @@ --- -title: Pages Methods +title: Pages methods description: Pages is the core page collection in Hugo and has many useful methods. -categories: [variables and params] +categories: [variables and parameters] keywords: [pages] menu: docs: diff --git a/docs/content/en/variables/shortcodes.md b/docs/content/en/variables/shortcodes.md index 3d4185b45..a03485d6f 100644 --- a/docs/content/en/variables/shortcodes.md +++ b/docs/content/en/variables/shortcodes.md @@ -1,7 +1,7 @@ --- -title: Shortcode Variables +title: Shortcode variables description: Shortcodes can access page variables and also have their own specific built-in variables. -categories: [variables and params] +categories: [variables and parameters] keywords: [shortcodes] menu: docs: @@ -25,7 +25,7 @@ weight: 20 : provides access to the parent shortcode context in nested shortcodes. This can be very useful for inheritance of common shortcode parameters from the root. .Position -: Contains [filename and position](https://godoc.org/github.com/gohugoio/hugo/common/text#Position) for the shortcode in a page. Note that this can be relatively expensive to calculate, and is meant for error reporting. See [Error Handling in Shortcodes](/templates/shortcode-templates/#error-handling-in-shortcodes). +: Contains [file name and position](https://godoc.org/github.com/gohugoio/hugo/common/text#Position) for the shortcode in a page. Note that this can be relatively expensive to calculate, and is meant for error reporting. See [Error Handling in Shortcodes](/templates/shortcode-templates/#error-handling-in-shortcodes). .IsNamedParams : boolean that returns `true` when the shortcode in question uses [named rather than positional parameters][shortcodes] diff --git a/docs/content/en/variables/site.md b/docs/content/en/variables/site.md index 7e587cc79..151e7a12d 100644 --- a/docs/content/en/variables/site.md +++ b/docs/content/en/variables/site.md @@ -1,7 +1,7 @@ --- -title: Site Variables +title: Site variables description: Many, but not all, site-wide variables are defined in your site's configuration. However, Hugo provides a number of built-in variables for convenient access to global values in your templates. -categories: [variables and params] +categories: [variables and parameters] keywords: [global,site] menu: docs: @@ -14,11 +14,11 @@ toc: true The following is a list of site-level (aka "global") variables. Many of these variables are defined in your site's [configuration file][config], whereas others are built into Hugo's core for convenient usage in your templates. -## Get the Site object from a partial +## Get the site object from a partial All the methods below, e.g. `.Site.RegularPages` can also be reached via the global [`site`](/functions/site/) function, e.g. `site.RegularPages`, which can be handy in partials where the `Page` object isn't easily available. -## Site Variables List +## Site variables list .Site.AllPages : array of all pages, regardless of their translation. @@ -42,7 +42,7 @@ All the methods below, e.g. `.Site.RegularPages` can also be reached via the glo : a string representing your tracking code for Google Analytics as defined in the site configuration. .Site.Home -: reference to the homepage's [page object](https://gohugo.io/variables/page/) +: reference to the homepage's [page object](/variables/page/) .Site.IsMultiLingual : whether there are more than one language in this site. See [Multilingual](/content-management/multilingual/) for more information. @@ -92,13 +92,13 @@ All the methods below, e.g. `.Site.RegularPages` can also be reached via the glo .Site.Title : a string representing the title of the site. -## The `.Site.Params` Variable +## The `.Site.Params` variable `.Site.Params` is a container holding the values from the `params` section of your site configuration. ### Example: `.Site.Params` -The following `config.[yaml|toml|json]` defines a site-wide param for `description`: +The following `config.[yaml|toml|json]` defines a site-wide parameter for `description`: {{< code-toggle file="hugo" >}} baseURL = "https://yoursite.example.com/" @@ -114,7 +114,7 @@ You can use `.Site.Params` in a [partial template](/templates/partials/) to call <meta name="description" content="{{ if .IsHome }}{{ $.Site.Params.description }}{{ else }}{{ .Description }}{{ end }}" /> {{< /code >}} -## The `.Site.Pages` Variable {#site-pages} +## The `.Site.Pages` variable {#site-pages} ### `.Site.Pages` compared to `.Pages` diff --git a/docs/content/en/variables/sitemap.md b/docs/content/en/variables/sitemap.md index b0b080d00..80fb11076 100644 --- a/docs/content/en/variables/sitemap.md +++ b/docs/content/en/variables/sitemap.md @@ -1,8 +1,7 @@ --- -title: Sitemap Variables -linktitle: Sitemap Variables +title: Sitemap variables description: -categories: [variables and params] +categories: [variables and parameters] keywords: [sitemap] menu: docs: @@ -20,6 +19,6 @@ A sitemap is a `Page` and therefore has all the [page variables][pagevars] avail : the priority of the page .Sitemap.Filename -: the sitemap filename +: the sitemap file name [pagevars]: /variables/page/ diff --git a/docs/content/en/variables/taxonomy.md b/docs/content/en/variables/taxonomy.md index 63b552328..3f0b799c8 100644 --- a/docs/content/en/variables/taxonomy.md +++ b/docs/content/en/variables/taxonomy.md @@ -1,7 +1,7 @@ --- -title: Taxonomy Variables +title: Taxonomy variables description: Hugo's taxonomy system exposes variables to taxonomy and term templates. -categories: [variables and params] +categories: [variables and parameters] keywords: [taxonomy,term] menu: docs: diff --git a/docs/go.mod b/docs/go.mod index 3c5460fd5..3d585e7b5 100644 --- a/docs/go.mod +++ b/docs/go.mod @@ -2,4 +2,4 @@ module github.com/gohugoio/hugoDocs go 1.16 -require github.com/gohugoio/gohugoioTheme v0.0.0-20230527124826-78bc315d7b8a // indirect +require github.com/gohugoio/gohugoioTheme v0.0.0-20230630055807-9874cd863bc5 // indirect diff --git a/docs/go.sum b/docs/go.sum index 9db956ea8..5d52b96bf 100644 --- a/docs/go.sum +++ b/docs/go.sum @@ -65,3 +65,11 @@ github.com/gohugoio/gohugoioTheme v0.0.0-20230418063032-99f9185b8e11 h1:mDcricMe github.com/gohugoio/gohugoioTheme v0.0.0-20230418063032-99f9185b8e11/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= github.com/gohugoio/gohugoioTheme v0.0.0-20230527124826-78bc315d7b8a h1:ruyA3QZ4Ym0fBLhTW2eoUSvHUaj2xWqaPHIbaI+tbZo= github.com/gohugoio/gohugoioTheme v0.0.0-20230527124826-78bc315d7b8a/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= +github.com/gohugoio/gohugoioTheme v0.0.0-20230615111426-c3725d921127 h1:LaOUdx1uo/Pr8Vr9KbqTwioia9OhNSiZDOHQGNHZiOs= +github.com/gohugoio/gohugoioTheme v0.0.0-20230615111426-c3725d921127/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= +github.com/gohugoio/gohugoioTheme v0.0.0-20230615131407-b3235557d2e6 h1:x/1M3CJRXCNfThsT+EeWrC2B1qFQZSCeOgA44RJJ5ds= +github.com/gohugoio/gohugoioTheme v0.0.0-20230615131407-b3235557d2e6/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= +github.com/gohugoio/gohugoioTheme v0.0.0-20230624091215-084560177ddc h1:BX7s0bvHFjx5Dll+9CBEiphSjWCDmZ1S+vOrB2wjpOg= +github.com/gohugoio/gohugoioTheme v0.0.0-20230624091215-084560177ddc/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= +github.com/gohugoio/gohugoioTheme v0.0.0-20230630055807-9874cd863bc5 h1:5QDXCq7G6Ak13EKF69QIJtH2YhidilBetNDgdoBYsWM= +github.com/gohugoio/gohugoioTheme v0.0.0-20230630055807-9874cd863bc5/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= diff --git a/docs/layouts/shortcodes/module-mounts-note.html b/docs/layouts/shortcodes/module-mounts-note.html index 654aafef4..e8b2a7a7e 100644 --- a/docs/layouts/shortcodes/module-mounts-note.html +++ b/docs/layouts/shortcodes/module-mounts-note.html @@ -1 +1 @@ -Also see [Module Mounts Config](/hugo-modules/configuration/#module-config-mounts) for an alternative way to configure this directory (from Hugo 0.56).
\ No newline at end of file +Also see [Module Mounts Config](/hugo-modules/configuration/#module-configuration-mounts) for an alternative way to configure this directory (from Hugo 0.56). diff --git a/docs/netlify.toml b/docs/netlify.toml index 135cdef64..3df9a72c9 100644 --- a/docs/netlify.toml +++ b/docs/netlify.toml @@ -3,7 +3,7 @@ publish = "public" command = "hugo --gc --minify" [context.production.environment] -HUGO_VERSION = "0.113.0" +HUGO_VERSION = "0.115.4" HUGO_ENV = "production" HUGO_ENABLEGITINFO = "true" @@ -11,20 +11,20 @@ HUGO_ENABLEGITINFO = "true" command = "hugo --gc --minify --enableGitInfo" [context.split1.environment] -HUGO_VERSION = "0.113.0" +HUGO_VERSION = "0.115.4" HUGO_ENV = "production" [context.deploy-preview] command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL" [context.deploy-preview.environment] -HUGO_VERSION = "0.113.0" +HUGO_VERSION = "0.115.4" [context.branch-deploy] command = "hugo --gc --minify -b $DEPLOY_PRIME_URL" [context.branch-deploy.environment] -HUGO_VERSION = "0.113.0" +HUGO_VERSION = "0.115.4" [context.next.environment] HUGO_ENABLEGITINFO = "true" |