mirror of
https://github.com/gohugoio/hugo.git
synced 2026-09-01 19:22:38 +00:00
Compare commits
1276 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e1e677f6da | |||
| fe2d246c73 | |||
| 5b9f488304 | |||
| 8bc390d8de | |||
| f9c70c0f89 | |||
| 57d7dd5bd9 | |||
| fbce84450b | |||
| 27d7aa5f10 | |||
| f8e968b2d1 | |||
| 00b3667f30 | |||
| 217d6ea605 | |||
| f37f57a814 | |||
| b3a113b73a | |||
| 2a4ed1c492 | |||
| 80367ea218 | |||
| 88ec7d88d1 | |||
| ffbf3dd319 | |||
| 0721a9c730 | |||
| d9c1f1eee7 | |||
| bf0dfa3e2d | |||
| d30c6a26d1 | |||
| 50c43c36f1 | |||
| 0043b48658 | |||
| 78e5263ca9 | |||
| e36b0305ca | |||
| 614dd2aa16 | |||
| 59df7db764 | |||
| 8b0d16b8d9 | |||
| 6b4d3263b6 | |||
| 0c223d9c7a | |||
| a61b1497c6 | |||
| a0167d838e | |||
| 63a6da06d8 | |||
| 73894cca56 | |||
| 2071d470e6 | |||
| e7e2a1ca02 | |||
| e7ff5c2d6a | |||
| 608b90da8d | |||
| 894b69dba5 | |||
| 9c017e512e | |||
| 2105e42aca | |||
| 6e692f2d11 | |||
| b3a721559a | |||
| bacc1706cb | |||
| 98c12b7b3d | |||
| 4a79fa0c33 | |||
| 83533a8881 | |||
| a7af63037c | |||
| b6673e5309 | |||
| 56afd943a8 | |||
| 51c9bfbc9e | |||
| cf978c0649 | |||
| 44bf76d0f2 | |||
| 742911146a | |||
| e80453a991 | |||
| 0dd57b907b | |||
| bca567faea | |||
| 0c49370ca0 | |||
| 3410007dca | |||
| 9dab62c559 | |||
| 4e16a6d4fd | |||
| cdf1edd549 | |||
| 0d1e96701f | |||
| b86a605bfb | |||
| bbb11a4a0f | |||
| dd45e6d7e5 | |||
| 4abaec5c04 | |||
| bcd434794a | |||
| 74ffb45fbe | |||
| f53145b274 | |||
| 8d040c966f | |||
| a04abf0dda | |||
| 7615ef0c28 | |||
| be09781af1 | |||
| 69a97823c4 | |||
| a7dc3c082e | |||
| f0ac26c944 | |||
| 3908489ccd | |||
| 640121423c | |||
| 46342ad5e8 | |||
| c700cdc39c | |||
| ef3c4a56d8 | |||
| 364e69ab7f | |||
| e70cf1ace4 | |||
| d5379fd1fe | |||
| 4d1cb50003 | |||
| 798bf60c56 | |||
| 60baec8005 | |||
| 2294b0226d | |||
| 1e18087356 | |||
| 5867cb5a92 | |||
| 7d3dfba84b | |||
| 3392133128 | |||
| 9c5f2befc0 | |||
| 43bf9ed38e | |||
| 4df86a703a | |||
| eaf2f9bce5 | |||
| 76bf2dcdd2 | |||
| ccb3040ad4 | |||
| fe0c270577 | |||
| 5ef45bec63 | |||
| 97c57fe37a | |||
| a8fad86671 | |||
| 34fe5cd34f | |||
| a00edff5b1 | |||
| 35d2eac490 | |||
| 09ed41be71 | |||
| dc3618abcd | |||
| 30d65fd48d | |||
| b3563b40a4 | |||
| a823b1572b | |||
| 28696b5dca | |||
| 2f7e8df5ba | |||
| 1bce8a854b | |||
| bbfebdea43 | |||
| 93717aac5c | |||
| 4fbce78740 | |||
| d8a256c155 | |||
| 446e606a09 | |||
| 5b331a18d7 | |||
| a07293cf97 | |||
| d1212307f2 | |||
| 45c69dd168 | |||
| 7610844004 | |||
| 8b55bfc814 | |||
| f1e1cdab3f | |||
| 8da040342e | |||
| d953e39e63 | |||
| 9798a95670 | |||
| 6b552db75f | |||
| e56ecab157 | |||
| 0a7d1d0ddc | |||
| d18a8cbe15 | |||
| 506e131f28 | |||
| 54141f71dd | |||
| 2079a23dd8 | |||
| 596e0e98e4 | |||
| 7cac19b1e3 | |||
| 8b657a11ee | |||
| 90de511017 | |||
| 36f2a1f676 | |||
| b6fcb3d0bb | |||
| d572071784 | |||
| f0b91852ea | |||
| ed0985404d | |||
| 708bc78770 | |||
| f023dfd763 | |||
| 5b9c2a40f1 | |||
| 3a02807970 | |||
| 52bf8f9095 | |||
| 75dd596e6c | |||
| 618948e4a8 | |||
| c447b7dd6e | |||
| c4e7c37055 | |||
| 06d12ab895 | |||
| ec33732fbe | |||
| faa3472fa2 | |||
| ccc51fe764 | |||
| 723d4656b5 | |||
| a48ac6e945 | |||
| 0614a59b0f | |||
| 696c67b04a | |||
| bb1812b6af | |||
| 8e1bcea82f | |||
| b6635e1baf | |||
| 7cb8107735 | |||
| 38d034df38 | |||
| 6eff9e5015 | |||
| 2fc05dad4e | |||
| fee9ee72a6 | |||
| 20c4311df4 | |||
| 81f04ef4f0 | |||
| 2530087ab1 | |||
| 715d4425ad | |||
| c5d072990a | |||
| 3ce9de7672 | |||
| 68c8e0e23d | |||
| be429d2268 | |||
| 8474b9defe | |||
| de1ca477b8 | |||
| f914774f6b | |||
| 5498a1bd56 | |||
| d3627b1747 | |||
| d72c454f78 | |||
| 97c37732b4 | |||
| 2175ea5b06 | |||
| 661c9787ea | |||
| f6d4801ba4 | |||
| 09612f7af8 | |||
| 88dcbc6efa | |||
| 26725515c8 | |||
| 39df7724ad | |||
| b33bfd40be | |||
| f2faae0805 | |||
| 0d9c0677f6 | |||
| 914e4d8535 | |||
| 93f3a85bf8 | |||
| 70544f9e62 | |||
| d7f364c27e | |||
| 5824e80932 | |||
| b426c20e14 | |||
| 15b6693541 | |||
| 94d998989d | |||
| 802d43cbfd | |||
| 285807ba7a | |||
| ec23aa998a | |||
| 5f5fccbc36 | |||
| 4ddd5361c1 | |||
| a0859dc672 | |||
| 9489272681 | |||
| 0087beefe1 | |||
| 0d0a7596a2 | |||
| 5b40eeede1 | |||
| 04889a5ee6 | |||
| 333646c52d | |||
| e3e1f7a2bb | |||
| ddd5a92240 | |||
| df0a4534cd | |||
| 9c458657da | |||
| 17f53526ca | |||
| 76f332bfdc | |||
| 3e1b579c17 | |||
| 91b61b976d | |||
| 4d4da001a0 | |||
| 39a452a4c7 | |||
| 593a546fc6 | |||
| 0bdc0d62d4 | |||
| 198efc89ca | |||
| e9924e964b | |||
| c0eedfe956 | |||
| 10ad648e2f | |||
| 20555b1630 | |||
| 7dd5cd675a | |||
| 3564f09e3d | |||
| 55a4f6e48e | |||
| ef9b915680 | |||
| 318558f26c | |||
| b15934008f | |||
| af34613f75 | |||
| 0a812beb12 | |||
| 330639d2ae | |||
| 32d82a4496 | |||
| d44bb4ec05 | |||
| 7c125ebb7d | |||
| adf405496e | |||
| d9bc233f1f | |||
| 00d70e5569 | |||
| 068a77151e | |||
| ed5ad12af3 | |||
| 1d7f4413f5 | |||
| 4a48b5f326 | |||
| b8af06f26a | |||
| b581bbd856 | |||
| 223073c6fd | |||
| 39fe42cf6b | |||
| fbf48824ae | |||
| 770df77b22 | |||
| 05a33e314e | |||
| e6d97c4fca | |||
| 5388211c11 | |||
| 6c0f705217 | |||
| aa66478c20 | |||
| 7e08d23eeb | |||
| 0ce6438268 | |||
| e140070c9a | |||
| ca6b26fe65 | |||
| 5572e3496b | |||
| 195a2b3845 | |||
| 364686ecbb | |||
| eda3678742 | |||
| c21e2b3b4d | |||
| cdd6a124c2 | |||
| e3b162ccc6 | |||
| e2aea65170 | |||
| 29ca323a34 | |||
| 1accd3ba88 | |||
| a4b8496210 | |||
| ca5ae50c2b | |||
| 3a2748e0d2 | |||
| 357c9db235 | |||
| 714d4a9a97 | |||
| 44edd9382a | |||
| 8b54843a0d | |||
| 373ca66287 | |||
| c52bb4efbe | |||
| aa690c8e95 | |||
| 34f40044d7 | |||
| 6ba074562c | |||
| c01f98255b | |||
| 8588103316 | |||
| eeaafb4b26 | |||
| fb0c1350d4 | |||
| 673e41bf6a | |||
| 32c0e3fd1f | |||
| 4724a5794e | |||
| f7b2e532e2 | |||
| 448f0306d7 | |||
| 02d2f05e74 | |||
| 6e9fbf8ad6 | |||
| 5461a5e03d | |||
| 51f7cd9bde | |||
| c1c8ecc9d6 | |||
| 091915c75d | |||
| 6472f158a4 | |||
| d4156e6127 | |||
| 2564f46a68 | |||
| 683888ebc8 | |||
| 5d3aabcb32 | |||
| 75deb923d9 | |||
| acbedf6220 | |||
| 48ebd598a9 | |||
| f9cadee8de | |||
| 7212e51347 | |||
| b7513ea6ff | |||
| a7f51703c4 | |||
| 80ebe0578a | |||
| 60184823e5 | |||
| cf10d4ce79 | |||
| d4e5fa6fdf | |||
| 26c18005a2 | |||
| 834d41771b | |||
| f94cd2813d | |||
| d1cf262b74 | |||
| f8e4a0608c | |||
| ce05dfa553 | |||
| 4ab5ed6c21 | |||
| d486396ff5 | |||
| 20358f46c8 | |||
| 5611631539 | |||
| c21b1558ae | |||
| dcee05b2ae | |||
| efae41c186 | |||
| 90362933ee | |||
| 6dec7b3ea6 | |||
| dec744316e | |||
| 9305deca15 | |||
| 9aa70af1a3 | |||
| ac938d9da7 | |||
| 64817cc0d1 | |||
| 26906d8569 | |||
| 608cfe62cf | |||
| fd40fe39bc | |||
| b5030782ae | |||
| 273a68400f | |||
| 7cbafa4ec5 | |||
| a07889d4a3 | |||
| bf4206a02f | |||
| 5caea6f2da | |||
| 09038865c2 | |||
| ffbd2b6c67 | |||
| 2b02a402a0 | |||
| e4ee1b89ad | |||
| 16b71bbbb4 | |||
| c5723a8931 | |||
| 4152ce886b | |||
| 7da9163df9 | |||
| efa9bdcc11 | |||
| eb627ca16d | |||
| 10af906371 | |||
| fbca53ac32 | |||
| fe2b22fe6f | |||
| 19afa5ee6c | |||
| 81a2466b80 | |||
| ebefa47691 | |||
| 48fce6110d | |||
| 22683a3b66 | |||
| 76738347d3 | |||
| a8e05b1196 | |||
| 56cd308184 | |||
| 01c3389857 | |||
| 9ddf52021b | |||
| 5e9b147c2a | |||
| b7fd410245 | |||
| 0743c76795 | |||
| 77159b4b9b | |||
| 215b8939bd | |||
| fed5f20f89 | |||
| 4b4bfa6a9c | |||
| 6fdb0ca6eb | |||
| ba0a661410 | |||
| c40bc27468 | |||
| 24cb0d1f58 | |||
| 5d50c46482 | |||
| d48b986c45 | |||
| dc8659c539 | |||
| 0141a02160 | |||
| 206440eef2 | |||
| 88759eecf7 | |||
| 0d9a5f8023 | |||
| 06772eefcd | |||
| c3d28d2897 | |||
| 39c9ae3108 | |||
| 2468b10eb3 | |||
| cd558958a0 | |||
| 5ef52294f9 | |||
| 37fb2d43e5 | |||
| c0cf1a7e37 | |||
| dde967d8ca | |||
| 16ee856636 | |||
| 257dee5356 | |||
| 4d34a98a28 | |||
| ff7eec2f48 | |||
| b7efbdc12f | |||
| 72bda5ad26 | |||
| 8fe48a6576 | |||
| 39c74b70dc | |||
| 51ee3fc735 | |||
| 88a07b7564 | |||
| 65f9427031 | |||
| e4d328d835 | |||
| ac1ec5c72c | |||
| 9f6b5ad3b4 | |||
| e6e98bf52d | |||
| 6c900380dc | |||
| f2ff77f3ac | |||
| ebf3cef162 | |||
| 970f15cf7a | |||
| d3e829508b | |||
| 1c3c148b38 | |||
| 16ad628114 | |||
| 6d2898b33b | |||
| 1873826651 | |||
| ef933e4a7f | |||
| 40f62a863c | |||
| 1648e327c0 | |||
| 819271cb78 | |||
| 3950b1375c | |||
| 05b888877d | |||
| 85bcac530a | |||
| ddd02b2f6a | |||
| 98ee8c3f7b | |||
| 57c347e4cc | |||
| 969f9311c1 | |||
| fd5d573566 | |||
| 27f9e62bb3 | |||
| 5bfe16ef8d | |||
| 54750b0780 | |||
| 43b5dfabb5 | |||
| 0698f294c6 | |||
| dea06f863e | |||
| 2304614639 | |||
| 21e0515fed | |||
| 1adf40355b | |||
| f0dbf2c88f | |||
| aaee038581 | |||
| 80d02a14ab | |||
| 4502c4e3ae | |||
| fe929114d3 | |||
| d15fda5000 | |||
| 7d5c9fbf44 | |||
| c6c2c689d6 | |||
| b678e90db7 | |||
| c2277fcbc1 | |||
| cb89ae63e9 | |||
| 4f66f790b1 | |||
| a89035bdaa | |||
| 6a3a6f683d | |||
| 93e41a1fb2 | |||
| d65fbfe16c | |||
| effaf6c2c9 | |||
| e35a69216e | |||
| 50506ebeac | |||
| 4c95b70020 | |||
| 79af7143c9 | |||
| dbfc7ea024 | |||
| bfe8009415 | |||
| 977b0e342c | |||
| 8890885a70 | |||
| 8aec5ee2dd | |||
| 7c81c86bdd | |||
| 5d3705df16 | |||
| 7fa2cec906 | |||
| b71f391cd7 | |||
| 6dbae7b671 | |||
| d770130530 | |||
| c846b051f3 | |||
| fa1a9653e5 | |||
| b5bced1db4 | |||
| 7c84e6b3e3 | |||
| 3e77886aad | |||
| a7953e25bb | |||
| 3bbfd99176 | |||
| b8bf01cdc6 | |||
| c2c73c2bd2 | |||
| 218fceac35 | |||
| e467d23374 | |||
| 944090722e | |||
| c7869fd772 | |||
| a6de8dfb42 | |||
| dac34f9bfd | |||
| c31fa378c7 | |||
| c20dee9d7f | |||
| bf76e74432 | |||
| 1cb7ed6ac7 | |||
| 937592cb85 | |||
| 8a60571fd2 | |||
| 6ff2e1dbe7 | |||
| faf2e50685 | |||
| 626874b94c | |||
| 672890339e | |||
| dc7d8a9eac | |||
| 4f00f1c94f | |||
| 9cf93e11f8 | |||
| da4d4164f1 | |||
| df92fc31ca | |||
| b0e21f967b | |||
| 283b866386 | |||
| 35b798247e | |||
| 691c2ea970 | |||
| b319c18969 | |||
| c54df37f6a | |||
| b1b7ac7e75 | |||
| b9127ecca6 | |||
| e8cf8b40df | |||
| 048e07422d | |||
| de8fc8761a | |||
| e5e1bcc271 | |||
| e5aa477491 | |||
| 6258d48b02 | |||
| c42982f76b | |||
| 02effd9dc4 | |||
| f52b040ee1 | |||
| d45b55bdd4 | |||
| bec1ac7b33 | |||
| 9323707b32 | |||
| bafb77172b | |||
| 2c5e4f7640 | |||
| 4c4ce55217 | |||
| 0a768ec95f | |||
| 8d86f1ec6e | |||
| 02e50c0126 | |||
| 42b302fc6b | |||
| 3529152efe | |||
| c50c66879d | |||
| 0ec8fc5490 | |||
| 21054f730a | |||
| df44b1930a | |||
| 600558273e | |||
| b0326a1c0f | |||
| b5c718a4de | |||
| 575ae1b3f9 | |||
| 58802de313 | |||
| 3a2a4c3b07 | |||
| 70739c972e | |||
| 3a82ae7114 | |||
| 5d915e7e96 | |||
| aedb13b219 | |||
| f6c3ca8b2a | |||
| 263daaeabc | |||
| 4ada1cab4d | |||
| df3f2af0a8 | |||
| dea185aa9b | |||
| c21dc16dbe | |||
| 91ffc76b24 | |||
| 0fb31e4a82 | |||
| 734dd1c4d0 | |||
| 542e220cc4 | |||
| 988962e8b5 | |||
| 989c7487eb | |||
| 612c61146d | |||
| a103d58162 | |||
| 6fb4e0718a | |||
| d9049752dc | |||
| 153dccc0e8 | |||
| 0ab4162413 | |||
| cafb784799 | |||
| 5926c6c8d5 | |||
| b8d3651242 | |||
| e9008b91fa | |||
| 7cd69aaae8 | |||
| 077b0fa71f | |||
| 0667d8a0f5 | |||
| 941b4caf57 | |||
| 6cb032b67e | |||
| 2d0650dbd9 | |||
| f3f9763afd | |||
| 09c8c17bf0 | |||
| 0743646f32 | |||
| ce9ee3cf49 | |||
| 0962470850 | |||
| 94c3825e5b | |||
| be3519fac0 | |||
| 0945673f05 | |||
| a2abad9677 | |||
| 924028a9be | |||
| 973393c99e | |||
| 9896cd0030 | |||
| 866176be97 | |||
| 7705e32ec2 | |||
| 0f48631351 | |||
| 64ed64d93f | |||
| 2a75e9704e | |||
| 429b669a29 | |||
| c7d2260420 | |||
| c7acc318b5 | |||
| eaba04e82b | |||
| 435e996c4f | |||
| c8c6f5d05b | |||
| d774b142e8 | |||
| 4e32dc80a2 | |||
| 023992abad | |||
| 27f8d8f963 | |||
| 3c100cc32c | |||
| f6591eca35 | |||
| 8aa90f2b7e | |||
| ccd2f4c32b | |||
| e85b821d3e | |||
| f223f17c76 | |||
| daaf4eb330 | |||
| 80e1fd29ab | |||
| 5b065a27a2 | |||
| 7f682d7802 | |||
| cc38a40f4e | |||
| e2965a3507 | |||
| 6b922750f3 | |||
| 93b04e67f6 | |||
| 804603155f | |||
| 75cf324322 | |||
| 1f61f40328 | |||
| c1f8b188f7 | |||
| 9349a889e2 | |||
| ff4ca99286 | |||
| 455df10752 | |||
| 8375995378 | |||
| ac2eaca06d | |||
| c59bdc20af | |||
| d1bf2f5435 | |||
| 086d6540c3 | |||
| 060f0206ee | |||
| d607f4c7df | |||
| 3749dc76f7 | |||
| e9853642e5 | |||
| 253a618854 | |||
| 284e959fc4 | |||
| df17fae532 | |||
| 50182cd06b | |||
| c1e4309516 | |||
| 8c84048033 | |||
| ad176055d9 | |||
| ce7c267140 | |||
| 4ecf019e2f | |||
| 2b1ad54617 | |||
| bac1ba4655 | |||
| 0d415e453b | |||
| 21b0aa8633 | |||
| 06e90b1237 | |||
| a0eec02bd6 | |||
| 207a574f0c | |||
| cfbae7cea2 | |||
| 4a15051e4c | |||
| 2d11551c53 | |||
| 42f43ad433 | |||
| 28e6e19d0a | |||
| 8fe1070872 | |||
| 2b3b90a6df | |||
| d1b0290fef | |||
| 2b0fad79b7 | |||
| f90b45f7f3 | |||
| 3cc468a82f | |||
| 05c8bccf84 | |||
| b3c2d90ba2 | |||
| 4dcb63c2f6 | |||
| 0a8583a451 | |||
| 0888ddd01f | |||
| ec49dbb8f5 | |||
| 1e8b4d9cde | |||
| 0f6c8439b9 | |||
| c462440dcd | |||
| 66570d2fb3 | |||
| 75044c199f | |||
| 5995eaaa08 | |||
| d1d7702c06 | |||
| 49c2761b28 | |||
| 0586bf0dc3 | |||
| 8d8e9dde51 | |||
| b3a70abe40 | |||
| 7c3dceeaed | |||
| a95426d40c | |||
| 88a320fb2d | |||
| b21d280c67 | |||
| 08b582e187 | |||
| dd1db334ac | |||
| 96e990456b | |||
| 21cb526462 | |||
| 1f326ad914 | |||
| 45df4596bb | |||
| e95f3af933 | |||
| 318a984526 | |||
| eebf00f702 | |||
| 08670e6a47 | |||
| ed23711e2e | |||
| 61197f9f29 | |||
| 74539dea87 | |||
| a89b2f41d6 | |||
| 792b2438ed | |||
| 3b596b85d1 | |||
| 87ca0d0cbe | |||
| bd0176a548 | |||
| 447228a742 | |||
| 8f368114d3 | |||
| 5a7837cdf0 | |||
| 868d0745b3 | |||
| 68e2e63d92 | |||
| ec02b9908c | |||
| 243fbbf0f9 | |||
| 9b8d2ce52b | |||
| 9015aa5b84 | |||
| 57eebbf243 | |||
| ca0c67dc69 | |||
| 817d69487c | |||
| d158f7e339 | |||
| cd36d752a3 | |||
| e8eb618166 | |||
| c438f45629 | |||
| 5def6d9aee | |||
| 3054a46185 | |||
| 3b3e771d61 | |||
| 12876ec991 | |||
| d08e4c87a7 | |||
| b0b4b82165 | |||
| db18fd1582 | |||
| 9413cf8499 | |||
| 74c90553b4 | |||
| 7e196a8294 | |||
| e01c340915 | |||
| 45e5091428 | |||
| 9f3796a31d | |||
| ca6ca4f4fc | |||
| bcc42c0549 | |||
| f3aa93fa48 | |||
| 0525fbddbc | |||
| eae46bdc1f | |||
| 8537cecb00 | |||
| e27beadfe8 | |||
| ca8d187b0d | |||
| 3526afc773 | |||
| 58a183c330 | |||
| 75ba84acbf | |||
| f89eb349e4 | |||
| 78f9bf2444 | |||
| ab70e6f52f | |||
| dd85c29091 | |||
| e69e276ac9 | |||
| e8ca52e93a | |||
| bca2d38e52 | |||
| ed3015c350 | |||
| dd1d655617 | |||
| 082476e713 | |||
| 1ce184b7f1 | |||
| 48870fef2e | |||
| b47652fb29 | |||
| 2c66167431 | |||
| 01f71babfc | |||
| 9d70e78031 | |||
| 9a6dc6c791 | |||
| 7c5a1fd16b | |||
| 4c596483e1 | |||
| 6a23cd65e1 | |||
| 851c16ef3b | |||
| 9ff36c5a8f | |||
| 7bc5d3663f | |||
| bc48b4606a | |||
| 8f8120ba14 | |||
| dcad066025 | |||
| 0bb3b49c00 | |||
| 6cdb8109cf | |||
| 26d23f7f4b | |||
| e904ccffb6 | |||
| 9008ac0b55 | |||
| 302a6ac701 | |||
| b1f2b433bc | |||
| ff28120e53 | |||
| 8f6f13104e | |||
| f310492cb0 | |||
| ce0304a1d1 | |||
| b309fe853e | |||
| dfa34afd86 | |||
| 2e92f36890 | |||
| 0f6b334b67 | |||
| b78f13b041 | |||
| 47587321d9 | |||
| 40fccf2251 | |||
| b56362defd | |||
| 3b2a78ba10 | |||
| fc627d5553 | |||
| 796ef3a335 | |||
| f807953a27 | |||
| cd54042c76 | |||
| 1d6286b094 | |||
| a291f3c5d9 | |||
| 277425bada | |||
| cb8f459127 | |||
| 22bd485072 | |||
| ea75985c7d | |||
| 5b1261c4be | |||
| 7cf7f85ad6 | |||
| df92a6b998 | |||
| aee92f2aee | |||
| 23abad7b1d | |||
| 4b521b4ffb | |||
| cca49ad01d | |||
| f6f0111db6 | |||
| 883431442d | |||
| ad6717bd11 | |||
| f8f128a08a | |||
| 7c84ad56cb | |||
| 217d25f560 | |||
| a84d82121a | |||
| 7a5a52f468 | |||
| f24ffc9c3d | |||
| e1af7cb9d0 | |||
| de82404d35 | |||
| a1d232f4b6 | |||
| 00fc038da7 | |||
| 5af8cc2970 | |||
| fe7ca7d78c | |||
| 13d14ab94d | |||
| dd2ab2820e | |||
| 31035f8ad1 | |||
| 89f8fa586c | |||
| 9edc58a03a | |||
| 8cea428802 | |||
| 0c01fef321 | |||
| 32da9b20bc | |||
| 3574304c68 | |||
| 9c39593dee | |||
| 705104338e | |||
| 868e4798d5 | |||
| 67b4c52466 | |||
| c1e134f1c2 | |||
| 41a3af1a29 | |||
| 78576019cf | |||
| ebc187b480 | |||
| d1bec54293 | |||
| d5ebf64836 | |||
| 9569d116cb | |||
| 38c5db98b5 | |||
| f22d59bb19 | |||
| 1469ce0edf | |||
| 280b2f294e | |||
| 4a2623c899 | |||
| 768370a503 | |||
| 9ae07c4f21 | |||
| 8509727fe8 | |||
| e29ede7055 | |||
| b81fc1be4e | |||
| 6042fc2b83 | |||
| de14ceecc9 | |||
| 56d6c0be5a | |||
| f3c74c9db4 | |||
| e445c35d6a | |||
| f13db9328b | |||
| d35d82060f | |||
| f6fdfcd429 | |||
| 6a519e692b | |||
| cd062623bd | |||
| 69c28985ea | |||
| c1b5a48f4e | |||
| 00d04774f0 | |||
| c9526f6e3f | |||
| df85e5a0aa | |||
| be28d9d943 | |||
| f363faadab | |||
| 6812229bb8 | |||
| d48781badf | |||
| c5287e7817 | |||
| 3f0f7eed68 | |||
| 6959b7fa80 | |||
| 75c61236f1 | |||
| 666ddd2377 | |||
| 0d1d33d7f3 | |||
| f8302768c7 | |||
| afbc18c09a | |||
| e989468341 | |||
| 6c8103144f | |||
| c5e68ba197 | |||
| 91771ee3b6 | |||
| b0b6a8c7ac | |||
| d7ef272a23 | |||
| b557f6249f | |||
| 249cd62541 | |||
| 2e3d5c2df6 | |||
| cf732940a3 | |||
| c83e10a48e | |||
| 50b5d0af29 | |||
| 09379e893e | |||
| 2519b70793 | |||
| ffb1a96e76 | |||
| 37676a25c6 | |||
| 72a66972b6 | |||
| 26af48a596 | |||
| f77a899ddd | |||
| d356720f74 | |||
| 6faf1d01e0 | |||
| 9c1319cdea | |||
| 9410d25e96 | |||
| 171fb883de | |||
| 0f11eb4f12 | |||
| 234fac4a45 | |||
| 311307c9e4 | |||
| 86dcac614b | |||
| 7d31d5f59d | |||
| e03f27ccf8 | |||
| 3027b15176 | |||
| 4424288d9b | |||
| cc3f52b9c1 | |||
| fe2a9fa21d | |||
| f045d7a611 | |||
| b00771ca14 | |||
| c3931ef748 | |||
| 99acbb2eb2 | |||
| 5838420aa1 | |||
| fde47c5eb9 | |||
| 3d09de8910 | |||
| 831e936846 | |||
| 098a0c819a | |||
| 8727475596 | |||
| 6fa7f2ac3e | |||
| c5f40e8b8b | |||
| 58c446f562 | |||
| 5c7234015d | |||
| 3abb2675c5 | |||
| afbd52f78e | |||
| 05c29ad593 | |||
| e59aabcf46 | |||
| a871c87f90 | |||
| 2e1d2ba018 | |||
| a5bd101d27 | |||
| c5a4c07b89 | |||
| 7c9a2dfee2 | |||
| f6ba48f2d0 | |||
| f99730e84e | |||
| 83f19d8d87 | |||
| 923e455731 | |||
| 97d0689580 | |||
| 35abd179e2 | |||
| 8d8fa7222f | |||
| 3f5ddd5242 | |||
| 91e0c2b1fe | |||
| 4679fbee41 | |||
| b08d9f26ae | |||
| 4ecf56b891 | |||
| df824fa31b | |||
| e1618e9d2f | |||
| cb48425f2d | |||
| ef0b9b511c | |||
| 18a29964fa | |||
| 452ffab461 | |||
| 2fec32a2da | |||
| acd720df92 | |||
| 5c6d8c57b9 | |||
| 39933111b9 | |||
| 2843605963 | |||
| 619c16fd03 | |||
| 1a26e35136 | |||
| 5c1204c24b | |||
| 062f6c3383 | |||
| dcf1f96c2d | |||
| 53a5932fa4 | |||
| d7588fac21 | |||
| b8effd8a17 | |||
| b4ebd0eb57 | |||
| 8e68a6487c | |||
| a50133ff38 | |||
| 3bbd02a1ca | |||
| 469d268cc8 | |||
| 30ebf6b823 | |||
| 139be09f17 | |||
| bccf957e36 | |||
| 488966dcb2 | |||
| 570713a478 | |||
| 01c87d2d23 | |||
| 1758db29f5 | |||
| 341dcc4765 | |||
| 9dbb6dc50d | |||
| ca55ea505a | |||
| 5bda0398e7 | |||
| e1729935b5 | |||
| 08b3004fcb | |||
| 217ffa87c9 | |||
| c8f2a57430 | |||
| 42453357aa | |||
| 277d0ae4a5 | |||
| 1ce3bb22f8 | |||
| 83e46555dd | |||
| 50c819cede | |||
| 3d96dfc924 | |||
| 6c6905d5f4 | |||
| 2242712b0c | |||
| e95db67b20 | |||
| 6b34a4e4e8 | |||
| f77279bb00 | |||
| 4974a62c70 | |||
| 5cf1475ecd | |||
| 36adb5fb88 | |||
| 9d603ce88a | |||
| ab7223df8c | |||
| 5e97cf3020 | |||
| 3a412543f6 | |||
| 4e9a5d8bd1 | |||
| 0c66ad8775 | |||
| fb0e17a3ed | |||
| 698019a552 | |||
| ef4dfcec6c | |||
| 0f438d1852 | |||
| bea7b2e202 | |||
| ec9c691216 | |||
| 6a3aced15a | |||
| 5619fe52d3 | |||
| 4c04d7101a | |||
| ddd8c77938 | |||
| 17fb752279 | |||
| 72f14a8202 | |||
| c274e21356 | |||
| 65beca13b0 | |||
| 078fad49e2 | |||
| 3586d77bd5 | |||
| 63d9859c09 | |||
| 002227e05e | |||
| 3a27cefec1 | |||
| ccd83c3040 | |||
| 7b4e4769d0 | |||
| c1a60732ae | |||
| 823334875d | |||
| 2c045ac449 | |||
| 5ec6a61d97 | |||
| c2c694f136 | |||
| 7ecf2a55c1 | |||
| 622d872418 | |||
| b25ba8b095 | |||
| b9aaa0079b | |||
| ac1e3c3cc0 | |||
| 0387deee03 | |||
| 9a2f6c62a6 | |||
| 08d41c3a48 | |||
| 218554e363 | |||
| ead339abbe | |||
| 7fd42af3b1 | |||
| d06ebc98e1 | |||
| dcd9c69aa8 | |||
| 7708d4556d | |||
| 79f8bb625d | |||
| a1e32439fb | |||
| a43b037651 | |||
| 82f770a6f5 | |||
| 493147a73f | |||
| 06caa025a4 | |||
| 8d695ec592 | |||
| 751d4906ef | |||
| 74924dd50d | |||
| ab0d29aa51 | |||
| 740dc2caf1 | |||
| c397c0b238 | |||
| 0bdb9b7da4 | |||
| b29ca44c6e | |||
| d984dde2f5 | |||
| b5b8cc9bd3 | |||
| c2a7c456cc | |||
| e67bee93ce | |||
| 1abc12a949 | |||
| ca74dd233d | |||
| 68b8dd73de | |||
| cd4f36ba57 | |||
| 0a80ead5c9 | |||
| 397080eabe | |||
| 3679fe6712 | |||
| f5308da320 | |||
| e71bef79e5 | |||
| db85299c00 | |||
| 29aa9baecd | |||
| d05b297e61 | |||
| 833a396f6b | |||
| 60f7394bdc | |||
| 0e1fd78fb2 | |||
| c7521b3d67 | |||
| cf7318a057 | |||
| cec9054bb8 | |||
| 93b3898633 | |||
| 9e526b65d3 | |||
| daf5f32cba | |||
| aec0e17ae1 | |||
| c7b701eae3 | |||
| 9f75a51854 | |||
| fd7b315572 | |||
| d6f6945525 | |||
| bfa06fff86 | |||
| 138ffefd6a | |||
| ea852b8dc7 | |||
| d584ca59f0 | |||
| 16cbda979c | |||
| 570d4e4cc4 | |||
| 1b8440af50 | |||
| 52d94fa675 | |||
| 49fe04c0bd | |||
| 311593bff0 | |||
| 5b90b388cb | |||
| fd2fc1d3ce | |||
| 1e06dfd12c | |||
| 0c98d8e9ed | |||
| 97eb55da89 | |||
| 3982854eeb | |||
| c2869aead0 | |||
| e791835e6d | |||
| 35ff685c30 | |||
| 4047ca5c3c | |||
| dac9c0dae6 | |||
| 5b51b3b9fb | |||
| d313bc78a4 | |||
| 29c9a40a8d | |||
| 7555e364d0 | |||
| c69835daba | |||
| fee5519129 | |||
| 209166a261 | |||
| caaf637068 | |||
| cafcd1909f | |||
| 68b424c233 | |||
| 36b374f8ab | |||
| b14b90435a | |||
| 8c3b6f8b62 | |||
| ee7dd2929f | |||
| 6511e2c48f | |||
| 7a681035ce | |||
| 04b4c996ac | |||
| b05a292c21 | |||
| 0f1fb8c7d8 | |||
| 35bb72c83e | |||
| 2805a6f80e | |||
| cea82842f0 | |||
| 153332706a | |||
| 56534beaf6 | |||
| c7aa881d90 | |||
| de7dd70bbc | |||
| 1583d8d094 | |||
| 5b19a26556 | |||
| 0b7229f7b2 | |||
| 4a2eda49cd | |||
| eb519afefd | |||
| ab8e189a2a | |||
| 5505ac0d72 | |||
| b0416e9bef | |||
| f2ab0b2608 | |||
| e64e571b67 | |||
| 98659bf3b8 | |||
| 4bed69629e | |||
| 8d28686edc | |||
| 211b757fee | |||
| 738f9561ab | |||
| 252ea96d1d | |||
| b23b546a30 | |||
| 43891e3994 | |||
| 3037d200cb | |||
| 81e69c416d | |||
| 72ecd0cdc7 | |||
| 18d69d7f8c | |||
| c1a2b7a102 | |||
| 40efc8677a | |||
| 36e0d005ed | |||
| 6674189bc2 | |||
| da0715a0c5 | |||
| d25cd03994 | |||
| 027abcfbb9 | |||
| 9c8ce0d935 | |||
| cdefb5a027 | |||
| de38524cd1 | |||
| 28020f866b | |||
| 47e65c4acd | |||
| a9c5133a77 | |||
| ea6ae769dc | |||
| 5cf0aa2fc0 | |||
| aca0f60448 | |||
| dec9749bbc | |||
| 8a48412c44 | |||
| c00a1fcb7f | |||
| 03a7016104 | |||
| e3ea4b48a2 | |||
| 7f1bcd89b2 | |||
| 85f4935dec | |||
| bfcf95b9de | |||
| c8477c4f6e | |||
| 1a94148d06 | |||
| 2c22a8b79a | |||
| 247574976c | |||
| 354192d2b8 | |||
| 029cdb68f5 | |||
| a2fa3895ee | |||
| 3663828f5e | |||
| 77c60a3440 | |||
| 90af334c21 | |||
| c4f81840f7 | |||
| 88fe0e7c2c | |||
| 5f69d3d654 | |||
| 6807151a22 | |||
| c6d46ff2bd | |||
| c139c6e1ef | |||
| fdab118010 | |||
| 450dc7a411 | |||
| a945412475 | |||
| 617fa2fe65 | |||
| 9b3d0cf5bf | |||
| 24c8226cbf | |||
| c9fc0e786f | |||
| dd732e84f4 | |||
| 033a13e10e | |||
| a509a23255 | |||
| 483fc8fa3d | |||
| 05c07c561a | |||
| 664a97819f | |||
| 50df31406f | |||
| d118d03714 | |||
| 1b50ccd162 | |||
| c4ad8f6498 | |||
| 1058cb17d1 | |||
| 0987e98db3 | |||
| 29e786aac5 | |||
| e764a6e638 | |||
| 67209dbfb3 | |||
| e96624cce8 | |||
| d4b6f9aca3 | |||
| c507229191 | |||
| dbd93f5112 | |||
| 004fcddc80 | |||
| ae4f72b091 | |||
| 6bcb7e83e7 | |||
| 3eb301b57a | |||
| f25ce7fefa | |||
| d770fa59a5 | |||
| 59c6ba4e45 | |||
| 7e765cc1bd | |||
| 24351c58be | |||
| 32d91d616e | |||
| 99e250917d | |||
| 5f84bc02cd | |||
| 50269f2512 | |||
| 4b7c1342fd | |||
| 847ad36e45 | |||
| cc9536ec46 | |||
| 0a2e5424ab | |||
| 627d016cc9 | |||
| 40a92a062d | |||
| c335efdd06 | |||
| 82cc1ac0f8 | |||
| be6cf6a9c6 | |||
| becc627e1e | |||
| bed8197de5 | |||
| beda46d289 | |||
| 53c9e890a2 | |||
| 3ab00e6e64 | |||
| bee46915d0 | |||
| 51cabe6faf | |||
| be44345272 | |||
| beeae6ab69 | |||
| beaa1b3aad | |||
| bec3f40359 | |||
| bed227886b | |||
| cc5d63c37a | |||
| be38acdce7 | |||
| 3ea4df35f2 | |||
| be0903c71a | |||
| 3cee9b7786 | |||
| 2690a8c1ea | |||
| be0314b1d5 | |||
| e4ed9d6b02 | |||
| be45399cba | |||
| be7404e337 | |||
| be535832f7 | |||
| be6dfcc495 | |||
| be964e95a1 | |||
| beffe756a9 | |||
| 2a40475235 | |||
| beaa008c2f | |||
| be381683ff | |||
| 601a2ce124 | |||
| beaa09a7f6 | |||
| 102a3b95ae | |||
| cd06e89be3 | |||
| d4de261508 |
@@ -10,3 +10,4 @@ cover.out
|
||||
*.swo
|
||||
.DS_Store
|
||||
*~
|
||||
vendor/*/
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ArtifactsDest": "GoBuilds/",
|
||||
"OutPath": "{{.Dest}}{{.PS}}{{.AppName}}{{.PS}}{{.Version}}{{.PS}}{{.AppName}}_{{.Version}}_{{.Os}}_{{.Arch}}{{.Ext}}",
|
||||
"BuildConstraints": "linux windows darwin freebsd netbsd openbsd dragonfly",
|
||||
"ConfigVersion": "0.9"
|
||||
}
|
||||
+24
-12
@@ -1,12 +1,24 @@
|
||||
language: go
|
||||
go:
|
||||
- 1.3
|
||||
- 1.4.2
|
||||
- tip
|
||||
script:
|
||||
- go test ./...
|
||||
- go build
|
||||
- ./hugo -s docs/
|
||||
install:
|
||||
- go get github.com/stretchr/testify
|
||||
- go get -v ./...
|
||||
language: go
|
||||
sudo: required
|
||||
go:
|
||||
- 1.6.3
|
||||
- 1.7.1
|
||||
- tip
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
matrix:
|
||||
allow_failures:
|
||||
- go: tip
|
||||
fast_finish: true
|
||||
install:
|
||||
- make govendor
|
||||
script:
|
||||
- make check
|
||||
- go build -race
|
||||
- ./hugo -s docs/
|
||||
- ./hugo --renderToMemory -s docs/
|
||||
before_install:
|
||||
# gem install must be run with sudo on OSX
|
||||
- sudo gem install asciidoctor | gem install asciidoctor
|
||||
- sudo pip install docutils
|
||||
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
# Contributing to Hugo
|
||||
|
||||
We welcome contributions to Hugo of any kind including documentation, themes,
|
||||
organization, tutorials, blog posts, bug reports, issues, feature requests,
|
||||
feature implementations, pull requests, answering questions on the forum,
|
||||
helping to manage issues, etc.
|
||||
|
||||
The Hugo community and maintainers are very active and helpful, and the project benefits greatly from this activity. We created a [step by step guide](https://gohugo.io/tutorials/how-to-contribute-to-hugo/) if you're unfamiliar with GitHub or contributing to open source projects in general.
|
||||
|
||||
[](https://waffle.io/spf13/hugo/metrics)
|
||||
|
||||
## Table of Contents
|
||||
|
||||
* [Asking Support Questions](#asking-support-questions)
|
||||
* [Reporting Issues](#reporting-issues)
|
||||
* [Submitting Patches](#submitting-patches)
|
||||
* [Code Contribution Guidelines](#code-contribution-guidelines)
|
||||
* [Git Commit Message Guidelines](#git-commit-message-guidelines)
|
||||
* [Using Git Remotes](#using-git-remotes)
|
||||
* [Build Hugo with Your Changes](#build-hugo-with-your-changes)
|
||||
* [Add Compile Information to Hugo](#add-compile-information-to-hugo)
|
||||
|
||||
## Asking Support Questions
|
||||
|
||||
We have an active [discussion forum](http://discuss.gohugo.io) where users and developers can ask questions.
|
||||
Please don't use the Github issue tracker to ask questions.
|
||||
|
||||
## Reporting Issues
|
||||
|
||||
If you believe you have found a defect in Hugo or its documentation, use
|
||||
the Github [issue tracker](https://github.com/spf13/hugo/issues) to report the problem to the Hugo maintainers.
|
||||
If you're not sure if it's a bug or not, start by asking in the [discussion forum](http://discuss.gohugo.io).
|
||||
When reporting the issue, please provide the version of Hugo in use (`hugo version`) and your operating system.
|
||||
|
||||
## Submitting Patches
|
||||
|
||||
The Hugo project welcomes all contributors and contributions regardless of skill or experience level.
|
||||
If you are interested in helping with the project, we will help you with your contribution.
|
||||
Hugo is a very active project with many contributions happening daily.
|
||||
Because we want to create the best possible product for our users and the best contribution experience for our developers,
|
||||
we have a set of guidelines which ensure that all contributions are acceptable.
|
||||
The guidelines are not intended as a filter or barrier to participation.
|
||||
If you are unfamiliar with the contribution process, the Hugo team will help you and teach you how to bring your contribution in accordance with the guidelines.
|
||||
|
||||
### Code Contribution Guidelines
|
||||
|
||||
To make the contribution process as seamless as possible, we ask for the following:
|
||||
|
||||
* Go ahead and fork the project and make your changes. We encourage pull requests to allow for review and discussion of code changes.
|
||||
* When you’re ready to create a pull request, be sure to:
|
||||
* Sign the [CLA](https://cla-assistant.io/spf13/hugo).
|
||||
* Have test cases for the new code. If you have questions about how to do this, please ask in your pull request.
|
||||
* Run `go fmt`.
|
||||
* Add documentation if you are adding new features or changing functionality. The docs site lives in `/docs`.
|
||||
* Squash your commits into a single commit. `git rebase -i`. It’s okay to force update your pull request with `git push -f`.
|
||||
* Make sure `go test ./...` passes, and `go build` completes. [Travis CI](https://travis-ci.org/spf13/hugo) (Linux and OS X) and [AppVeyor](https://ci.appveyor.com/project/spf13/hugo/branch/master) (Windows) will catch most things that are missing.
|
||||
* Follow the **Git Commit Message Guidelines** below.
|
||||
|
||||
### Git Commit Message Guidelines
|
||||
|
||||
This [blog article](http://chris.beams.io/posts/git-commit/) is a good resource for learning how to write good commit messages,
|
||||
the most important part being that each commit message should have a title/subject in imperative mood starting with a capital letter and no trailing period:
|
||||
*"Return error on wrong use of the Paginator"*, **NOT** *"returning some error."*
|
||||
Also, if your commit references one or more GitHub issues, always end your commit message body with *See #1234* or *Fixes #1234*.
|
||||
Replace *1234* with the GitHub issue ID. The last example will close the issue when the commit is merged into *master*.
|
||||
Sometimes it makes sense to prefix the commit message with the packagename (or docs folder) all lowercased ending with a colon.
|
||||
That is fine, but the rest of the rules above apply.
|
||||
So it is "tpl: Add emojify template func", not "tpl: add emojify template func.", and "docs: Document emoji", not "doc: document emoji."
|
||||
|
||||
An example:
|
||||
|
||||
```text
|
||||
tpl: Add custom index function
|
||||
|
||||
Add a custom index template function that deviates from the stdlib simply by not
|
||||
returning an "index out of range" error if an array, slice or string index is
|
||||
out of range. Instead, we just return nil values. This should help make the
|
||||
new default function more useful for Hugo users.
|
||||
|
||||
Fixes #1949
|
||||
```
|
||||
|
||||
### Using Git Remotes
|
||||
|
||||
Due to the way Go handles package imports, the best approach for working on a
|
||||
Hugo fork is to use Git Remotes. Here's a simple walk-through for getting
|
||||
started:
|
||||
|
||||
1. Get the latest Hugo sources:
|
||||
|
||||
```
|
||||
go get -u -t github.com/spf13/hugo/...
|
||||
```
|
||||
|
||||
1. Change to the Hugo source directory:
|
||||
|
||||
```
|
||||
cd $GOPATH/src/github.com/spf13/hugo
|
||||
```
|
||||
|
||||
1. Create a new branch for your changes (the branch name is arbitrary):
|
||||
|
||||
```
|
||||
git checkout -b iss1234
|
||||
```
|
||||
|
||||
1. After making your changes, commit them to your new branch:
|
||||
|
||||
```
|
||||
git commit -a -v
|
||||
```
|
||||
|
||||
1. Fork Hugo in Github.
|
||||
|
||||
1. Add your fork as a new remote (the remote name, "fork" in this example, is arbitrary):
|
||||
|
||||
```
|
||||
git remote add fork git://github.com/USERNAME/hugo.git
|
||||
```
|
||||
|
||||
1. Push the changes to your new remote:
|
||||
|
||||
```
|
||||
git push --set-upstream fork iss1234
|
||||
```
|
||||
|
||||
1. You're now ready to submit a PR based upon the new branch in your forked repository.
|
||||
|
||||
### Build Hugo with Your Changes
|
||||
|
||||
```bash
|
||||
cd $GOPATH/src/github.com/spf13/hugo
|
||||
go build
|
||||
mv hugo /usr/local/bin/
|
||||
```
|
||||
|
||||
### Add Compile Information to Hugo
|
||||
|
||||
To add compile information to Hugo, replace the `go build` command with the following *(replace `/path/to/hugo` with the actual path)*:
|
||||
|
||||
go build -ldflags "-X /path/to/hugo/hugolib.CommitHash=`git rev-parse --short HEAD 2>/dev/null` -X github.com/spf13/hugo/hugolib.BuildDate=`date +%FT%T%z`"
|
||||
|
||||
This will result in `hugo version` output that looks similar to:
|
||||
|
||||
Hugo Static Site Generator v0.13-DEV-8042E77 buildDate: 2014-12-25T03:25:57-07:00
|
||||
|
||||
Alternatively, just run `make` — all the “magic” above is already in the `Makefile`. :wink:
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
FROM golang:1.6.2
|
||||
MAINTAINER Sven Dowideit <SvenDowideit@home.org.au>
|
||||
|
||||
ENV GOPATH /go
|
||||
ENV USER root
|
||||
|
||||
# pre-install known dependencies before the source, so we don't redownload them whenever the source changes
|
||||
RUN go get github.com/stretchr/testify/assert \
|
||||
&& go get github.com/kyokomi/emoji \
|
||||
&& go get github.com/bep/inflect \
|
||||
&& go get github.com/BurntSushi/toml \
|
||||
&& go get github.com/PuerkitoBio/purell \
|
||||
&& go get github.com/PuerkitoBio/urlesc \
|
||||
&& go get github.com/dchest/cssmin \
|
||||
&& go get github.com/eknkc/amber \
|
||||
&& go get github.com/gorilla/websocket \
|
||||
&& go get github.com/kardianos/osext \
|
||||
&& go get github.com/miekg/mmark \
|
||||
&& go get github.com/mitchellh/mapstructure \
|
||||
&& go get github.com/russross/blackfriday \
|
||||
&& go get github.com/shurcooL/sanitized_anchor_name \
|
||||
&& go get github.com/spf13/afero \
|
||||
&& go get github.com/spf13/cast \
|
||||
&& go get github.com/spf13/jwalterweatherman \
|
||||
&& go get github.com/spf13/cobra \
|
||||
&& go get github.com/cpuguy83/go-md2man \
|
||||
&& go get github.com/inconshreveable/mousetrap \
|
||||
&& go get github.com/spf13/pflag \
|
||||
&& go get github.com/spf13/fsync \
|
||||
&& go get github.com/spf13/viper \
|
||||
&& go get github.com/kr/pretty \
|
||||
&& go get github.com/kr/text \
|
||||
&& go get github.com/magiconair/properties \
|
||||
&& go get golang.org/x/text/transform \
|
||||
&& go get golang.org/x/text/unicode/norm \
|
||||
&& go get github.com/yosssi/ace \
|
||||
&& go get github.com/spf13/nitro \
|
||||
&& go get github.com/fortytw2/leaktest \
|
||||
&& go get github.com/fsnotify/fsnotify
|
||||
|
||||
COPY . /go/src/github.com/spf13/hugo
|
||||
RUN go get -d -v github.com/spf13/hugo
|
||||
RUN go install github.com/spf13/hugo
|
||||
|
||||
WORKDIR /go/src/github.com/spf13/hugo
|
||||
RUN go get -d -v
|
||||
RUN go build -o hugo main.go
|
||||
RUN go test github.com/spf13/hugo/...
|
||||
|
||||
+179
-52
@@ -1,67 +1,194 @@
|
||||
Simple Public License (SimPL-2.0)
|
||||
=================================
|
||||
Apache License
|
||||
==============
|
||||
|
||||
Preamble
|
||||
--------
|
||||
_Version 2.0, January 2004_
|
||||
_<<http://www.apache.org/licenses/>>_
|
||||
|
||||
This Simple Public License 2.0 (SimPL-2.0 for short) is a plain language
|
||||
implementation of GPL 2.0. The words are different, but the goal is the
|
||||
same - to guarantee for all users the freedom to share and change
|
||||
software. If anyone wonders about the meaning of the SimPL, they should
|
||||
interpret it as consistent with GPL 2.0.
|
||||
### Terms and Conditions for use, reproduction, and distribution
|
||||
|
||||
#### 1. Definitions
|
||||
|
||||
Simple Public License (SimPL) 2.0
|
||||
=================================
|
||||
“License” shall mean the terms and conditions for use, reproduction, and
|
||||
distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
The SimPL applies to the software's source and object code and comes
|
||||
with any rights that I have in it (other than trademarks). You agree to
|
||||
the SimPL by copying, distributing, or making a derivative work of the
|
||||
software.
|
||||
“Licensor” shall mean the copyright owner or entity authorized by the copyright
|
||||
owner that is granting the License.
|
||||
|
||||
You get the royalty free right to:
|
||||
“Legal Entity” shall mean the union of the acting entity and all other entities
|
||||
that control, are controlled by, or are under common control with that entity.
|
||||
For the purposes of this definition, “control” means **(i)** the power, direct or
|
||||
indirect, to cause the direction or management of such entity, whether by
|
||||
contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or **(iii)** beneficial ownership of such entity.
|
||||
|
||||
- Use the software for any purpose;
|
||||
- Make derivative works of it (this is called a "Derived Work");
|
||||
- Copy and distribute it and any Derived Work.
|
||||
“You” (or “Your”) shall mean an individual or Legal Entity exercising
|
||||
permissions granted by this License.
|
||||
|
||||
If you distribute the software or a Derived Work, you must give back to
|
||||
the community by:
|
||||
“Source” form shall mean the preferred form for making modifications, including
|
||||
but not limited to software source code, documentation source, and configuration
|
||||
files.
|
||||
|
||||
- Prominently noting the date of any changes you make;
|
||||
- Leaving other people's copyright notices, warranty disclaimers, and
|
||||
license terms in place;
|
||||
- Providing the source code, build scripts, installation scripts, and
|
||||
interface definitions in a form that is easy to get and best to
|
||||
modify;
|
||||
- Licensing it to everyone under SimPL, or substantially similar terms
|
||||
(such as GPL 2.0), without adding further restrictions to the rights
|
||||
provided;
|
||||
- Conspicuously announcing that it is available under that license.
|
||||
“Object” form shall mean any form resulting from mechanical transformation or
|
||||
translation of a Source form, including but not limited to compiled object code,
|
||||
generated documentation, and conversions to other media types.
|
||||
|
||||
There are some things that you must shoulder:
|
||||
“Work” shall mean the work of authorship, whether in Source or Object form, made
|
||||
available under the License, as indicated by a copyright notice that is included
|
||||
in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
- You get NO WARRANTIES. None of any kind;
|
||||
- If the software damages you in any way, you may only recover direct
|
||||
damages up to the amount you paid for it (that is zero if you did
|
||||
not pay anything). You may not recover any other damages, including
|
||||
those called "consequential damages." (The state or country where
|
||||
you live may not allow you to limit your liability in this way, so
|
||||
this may not apply to you);
|
||||
“Derivative Works” shall mean any work, whether in Source or Object form, that
|
||||
is based on (or derived from) the Work and for which the editorial revisions,
|
||||
annotations, elaborations, or other modifications represent, as a whole, an
|
||||
original work of authorship. For the purposes of this License, Derivative Works
|
||||
shall not include works that remain separable from, or merely link (or bind by
|
||||
name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
The SimPL continues perpetually, except that your license rights end
|
||||
automatically if:
|
||||
“Contribution” shall mean any work of authorship, including the original version
|
||||
of the Work and any modifications or additions to that Work or Derivative Works
|
||||
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
||||
by the copyright owner or by an individual or Legal Entity authorized to submit
|
||||
on behalf of the copyright owner. For the purposes of this definition,
|
||||
“submitted” means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems, and
|
||||
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
||||
the purpose of discussing and improving the Work, but excluding communication
|
||||
that is conspicuously marked or otherwise designated in writing by the copyright
|
||||
owner as “Not a Contribution.”
|
||||
|
||||
- You do not abide by the "give back to the community" terms (your
|
||||
licensees get to keep their rights if they abide);
|
||||
- Anyone prevents you from distributing the software under the terms
|
||||
of the SimPL.
|
||||
“Contributor” shall mean Licensor and any individual or Legal Entity on behalf
|
||||
of whom a Contribution has been received by Licensor and subsequently
|
||||
incorporated within the Work.
|
||||
|
||||
License for the License
|
||||
-----------------------
|
||||
#### 2. Grant of Copyright License
|
||||
|
||||
You may do anything that you want with the SimPL text; it's a license
|
||||
form to use in any way that you find helpful. To avoid confusion,
|
||||
however, if you change the terms in any way then you may not call your
|
||||
license the Simple Public License or the SimPL (but feel free to
|
||||
acknowledge that your license is "based on the Simple Public License").
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the Work and such
|
||||
Derivative Works in Source or Object form.
|
||||
|
||||
#### 3. Grant of Patent License
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable (except as stated in this section) patent license to make, have
|
||||
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
||||
such license applies only to those patent claims licensable by such Contributor
|
||||
that are necessarily infringed by their Contribution(s) alone or by combination
|
||||
of their Contribution(s) with the Work to which such Contribution(s) was
|
||||
submitted. If You institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
||||
Contribution incorporated within the Work constitutes direct or contributory
|
||||
patent infringement, then any patent licenses granted to You under this License
|
||||
for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
#### 4. Redistribution
|
||||
|
||||
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
||||
in any medium, with or without modifications, and in Source or Object form,
|
||||
provided that You meet the following conditions:
|
||||
|
||||
* **(a)** You must give any other recipients of the Work or Derivative Works a copy of
|
||||
this License; and
|
||||
* **(b)** You must cause any modified files to carry prominent notices stating that You
|
||||
changed the files; and
|
||||
* **(c)** You must retain, in the Source form of any Derivative Works that You distribute,
|
||||
all copyright, patent, trademark, and attribution notices from the Source form
|
||||
of the Work, excluding those notices that do not pertain to any part of the
|
||||
Derivative Works; and
|
||||
* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
|
||||
Derivative Works that You distribute must include a readable copy of the
|
||||
attribution notices contained within such NOTICE file, excluding those notices
|
||||
that do not pertain to any part of the Derivative Works, in at least one of the
|
||||
following places: within a NOTICE text file distributed as part of the
|
||||
Derivative Works; within the Source form or documentation, if provided along
|
||||
with the Derivative Works; or, within a display generated by the Derivative
|
||||
Works, if and wherever such third-party notices normally appear. The contents of
|
||||
the NOTICE file are for informational purposes only and do not modify the
|
||||
License. You may add Your own attribution notices within Derivative Works that
|
||||
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
||||
provided that such additional attribution notices cannot be construed as
|
||||
modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide
|
||||
additional or different license terms and conditions for use, reproduction, or
|
||||
distribution of Your modifications, or for any such Derivative Works as a whole,
|
||||
provided Your use, reproduction, and distribution of the Work otherwise complies
|
||||
with the conditions stated in this License.
|
||||
|
||||
#### 5. Submission of Contributions
|
||||
|
||||
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
||||
for inclusion in the Work by You to the Licensor shall be under the terms and
|
||||
conditions of this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
||||
any separate license agreement you may have executed with Licensor regarding
|
||||
such Contributions.
|
||||
|
||||
#### 6. Trademarks
|
||||
|
||||
This License does not grant permission to use the trade names, trademarks,
|
||||
service marks, or product names of the Licensor, except as required for
|
||||
reasonable and customary use in describing the origin of the Work and
|
||||
reproducing the content of the NOTICE file.
|
||||
|
||||
#### 7. Disclaimer of Warranty
|
||||
|
||||
Unless required by applicable law or agreed to in writing, Licensor provides the
|
||||
Work (and each Contributor provides its Contributions) on an “AS IS” BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
||||
including, without limitation, any warranties or conditions of TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
||||
solely responsible for determining the appropriateness of using or
|
||||
redistributing the Work and assume any risks associated with Your exercise of
|
||||
permissions under this License.
|
||||
|
||||
#### 8. Limitation of Liability
|
||||
|
||||
In no event and under no legal theory, whether in tort (including negligence),
|
||||
contract, or otherwise, unless required by applicable law (such as deliberate
|
||||
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special, incidental,
|
||||
or consequential damages of any character arising as a result of this License or
|
||||
out of the use or inability to use the Work (including but not limited to
|
||||
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
||||
any and all other commercial damages or losses), even if such Contributor has
|
||||
been advised of the possibility of such damages.
|
||||
|
||||
#### 9. Accepting Warranty or Additional Liability
|
||||
|
||||
While redistributing the Work or Derivative Works thereof, You may choose to
|
||||
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
||||
other liability obligations and/or rights consistent with this License. However,
|
||||
in accepting such obligations, You may act only on Your own behalf and on Your
|
||||
sole responsibility, not on behalf of any other Contributor, and only if You
|
||||
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason of your
|
||||
accepting any such warranty or additional liability.
|
||||
|
||||
_END OF TERMS AND CONDITIONS_
|
||||
|
||||
### APPENDIX: How to apply the Apache License to your work
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate
|
||||
notice, with the fields enclosed by brackets `[]` replaced with your own
|
||||
identifying information. (Don't include the brackets!) The text should be
|
||||
enclosed in the appropriate comment syntax for the file format. We also
|
||||
recommend that a file or class name and description of purpose be included on
|
||||
the same “printed page” as the copyright notice for easier identification within
|
||||
third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
COMMIT_HASH=`git rev-parse --short HEAD 2>/dev/null`
|
||||
BUILD_DATE=`date +%FT%T%z`
|
||||
LDFLAGS=-ldflags "-X github.com/spf13/hugo/hugolib.CommitHash ${COMMIT_HASH} -X github.com/spf13/hugo/hugolib.BuildDate ${BUILD_DATE}"
|
||||
LDFLAGS=-ldflags "-X github.com/spf13/hugo/hugolib.CommitHash=${COMMIT_HASH} -X github.com/spf13/hugo/hugolib.BuildDate=${BUILD_DATE}"
|
||||
|
||||
all: gitinfo
|
||||
|
||||
@@ -25,3 +25,52 @@ install-gitinfo:
|
||||
no-git-info:
|
||||
go build -o hugo main.go
|
||||
|
||||
docker:
|
||||
docker build -t hugo .
|
||||
docker rm -f hugo-build || true
|
||||
docker run --name hugo-build hugo ls /go/bin
|
||||
docker cp hugo-build:/go/bin/hugo .
|
||||
docker rm hugo-build
|
||||
|
||||
govendor:
|
||||
go get -u github.com/kardianos/govendor
|
||||
go install github.com/kardianos/govendor
|
||||
govendor get github.com/spf13/hugo
|
||||
|
||||
check: fmt vet test test-race
|
||||
|
||||
cyclo:
|
||||
@for d in `govendor list -no-status +local | sed 's/github.com.spf13.hugo/./'` ; do \
|
||||
if [ "`gocyclo -over 20 $$d | tee /dev/stderr`" ]; then \
|
||||
echo "^ cyclomatic complexity exceeds 20, refactor the code!" && echo && exit 1; \
|
||||
fi \
|
||||
done
|
||||
|
||||
fmt:
|
||||
@for d in `govendor list -no-status +local | sed 's/github.com.spf13.hugo/./'` ; do \
|
||||
if [ "`gofmt -l $$d/*.go | tee /dev/stderr`" ]; then \
|
||||
echo "^ improperly formatted go files" && echo && exit 1; \
|
||||
fi \
|
||||
done
|
||||
|
||||
lint:
|
||||
@for d in `govendor list -no-status +local | sed 's/github.com.spf13.hugo/./'` ; do \
|
||||
if [ "`golint $$d | tee /dev/stderr`" ]; then \
|
||||
echo "^ golint errors!" && echo && exit 1; \
|
||||
fi \
|
||||
done
|
||||
|
||||
get:
|
||||
go get -v -t ./...
|
||||
|
||||
test:
|
||||
govendor test +local
|
||||
|
||||
test-race:
|
||||
govendor test -race +local
|
||||
|
||||
vet:
|
||||
@if [ "`govendor vet +local | tee /dev/stderr`" ]; then \
|
||||
echo "^ go vet errors!" && echo && exit 1; \
|
||||
fi
|
||||
|
||||
|
||||
@@ -2,24 +2,34 @@
|
||||
|
||||
A Fast and Flexible Static Site Generator built with love by [spf13](http://spf13.com/) and [friends](https://github.com/spf13/hugo/graphs/contributors) in [Go][].
|
||||
|
||||
[Website](http://gohugo.io) |
|
||||
[Website](https://gohugo.io) |
|
||||
[Forum](https://discuss.gohugo.io) |
|
||||
[Chat](https://gitter.im/spf13/hugo) |
|
||||
[Documentation](http://gohugo.io/overview/introduction/) |
|
||||
[Installation Guide](http://gohugo.io/overview/installing/) |
|
||||
[Developer Chat (no support)](https://gitter.im/spf13/hugo) |
|
||||
[Documentation](https://gohugo.io/overview/introduction/) |
|
||||
[Installation Guide](https://gohugo.io/overview/installing/) |
|
||||
[Contribution Guide](CONTRIBUTING.md) |
|
||||
[Twitter](http://twitter.com/spf13)
|
||||
|
||||
[](https://travis-ci.org/spf13/hugo) [](https://app.wercker.com/project/bykey/1a0de7d703ce3b80527f00f675e1eb32) [](https://ci.appveyor.com/project/spf13/hugo/branch/master) [](https://gitter.im/spf13/hugo?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://godoc.org/github.com/spf13/hugo)
|
||||
[](https://travis-ci.org/spf13/hugo)
|
||||
[](https://ci.appveyor.com/project/spf13/hugo/branch/master)
|
||||
[](https://gitter.im/spf13/hugo?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://goreportcard.com/report/github.com/spf13/hugo)
|
||||
|
||||
## Overview
|
||||
|
||||
Hugo is a static site generator written in [Go][]. It is optimized for speed, easy use and configurability. Hugo takes a directory with content and templates and renders them into a full HTML website.
|
||||
Hugo is a static HTML and CSS website generator written in [Go][].
|
||||
It is optimized for speed, easy use and configurability.
|
||||
Hugo takes a directory with content and templates and renders them into a full HTML website.
|
||||
|
||||
Hugo relies on Markdown files with front matter for meta data. And you can run Hugo from any directory. This works well for shared hosts and other systems where you don’t have a privileged account.
|
||||
Hugo relies on Markdown files with front matter for meta data.
|
||||
And you can run Hugo from any directory.
|
||||
This works well for shared hosts and other systems where you don’t have a privileged account.
|
||||
|
||||
Hugo renders a typical website of moderate size in a fraction of a second. A good rule of thumb is that each piece of content renders in around 1 millisecond.
|
||||
Hugo renders a typical website of moderate size in a fraction of a second.
|
||||
A good rule of thumb is that each piece of content renders in around 1 millisecond.
|
||||
|
||||
Hugo is meant to work well for any kind of website including blogs, tumbles and docs.
|
||||
Hugo is designed to work well for any kind of website including blogs, tumbles and docs.
|
||||
|
||||
#### Supported Architectures
|
||||
|
||||
@@ -27,48 +37,21 @@ Currently, we provide pre-built Hugo binaries for Windows, Linux, FreeBSD, NetBS
|
||||
|
||||
Hugo may also be compiled from source wherever the Go compiler tool chain can run, e.g. for other operating systems including DragonFly BSD, OpenBSD, Plan 9 and Solaris.
|
||||
|
||||
**Complete documentation is available at [Hugo Documentation](http://gohugo.io/).**
|
||||
**Complete documentation is available at [Hugo Documentation][].**
|
||||
|
||||
## Choose How to Install
|
||||
|
||||
If you want to use Hugo as your site generator, simply install the Hugo binaries. The Hugo binaries have no external dependencies.
|
||||
If you want to use Hugo as your site generator, simply install the Hugo binaries.
|
||||
The Hugo binaries have no external dependencies.
|
||||
|
||||
To contribute to the Hugo source code or documentation, you should fork the Hugo GitHub project and clone it to your local machine.
|
||||
To contribute to the Hugo source code or documentation, you should [fork the Hugo GitHub project](https://github.com/spf13/hugo#fork-destination-box) and clone it to your local machine.
|
||||
|
||||
Finally, you can install the Hugo source code with `go`, build the binaries yourself, and run Hugo that way. Building the binaries is an easy task for an experienced `go` getter.
|
||||
Finally, you can install the Hugo source code with `go`, build the binaries yourself, and run Hugo that way.
|
||||
Building the binaries is an easy task for an experienced `go` getter.
|
||||
|
||||
### Install Hugo as Your Site Generator (Binary Install)
|
||||
|
||||
Use the [installation instructions in the Hugo documentation](http://gohugo.io/overview/installing/).
|
||||
|
||||
### Clone the Hugo Project (Contributor)
|
||||
|
||||
1. Make sure your local environment has the following software installed:
|
||||
|
||||
* [Git](http://git-scm.com/)
|
||||
* [Mercurial](http://mercurial.selenic.com/)
|
||||
* [Go][] 1.3+ (Go 1.4+ on Windows, see Go [Issue #8090](https://code.google.com/p/go/issues/detail?id=8090))
|
||||
|
||||
2. Fork the [Hugo project on GitHub](https://github.com/spf13/hugo).
|
||||
|
||||
3. Clone your fork:
|
||||
|
||||
git clone https://github.com/YOURNAME/hugo
|
||||
|
||||
4. Change into the `hugo` directory:
|
||||
|
||||
cd hugo
|
||||
|
||||
5. Install the Hugo project’s package dependencies:
|
||||
|
||||
go get -u -v github.com/spf13/hugo
|
||||
|
||||
6. Use a symbolic link to add your locally cloned Hugo repository to your `$GOPATH`, assuming you prefer doing development work outside of `$GOPATH`:
|
||||
|
||||
rm -rf "$GOPATH/src/github.com/spf13/hugo"
|
||||
ln -s `pwd` "$GOPATH/src/github.com/spf13/hugo"
|
||||
|
||||
Go expects all of your libraries to be found in`$GOPATH`.
|
||||
Use the [installation instructions in the Hugo documentation](https://gohugo.io/overview/installing/).
|
||||
|
||||
### Build and Install the Binaries from Source (Advanced Install)
|
||||
|
||||
@@ -84,57 +67,42 @@ To update Hugo’s dependencies, use `go get` with the `-u` option.
|
||||
|
||||
## Contributing to Hugo
|
||||
|
||||
We welcome contributions to Hugo of any kind including documentation, themes, organization, tutorials, blog posts, bug reports, issues, feature requests, feature implementation, pull requests, answering questions on the forum, helping to manage issues, etc. The Hugo community and maintainers are very active and helpful and the project benefits greatly from this activity.
|
||||
For a complete guide to contributing to Hugo, see the [Contribution Guide](CONTRIBUTING.md).
|
||||
|
||||
We welcome contributions to Hugo of any kind including documentation, themes,
|
||||
organization, tutorials, blog posts, bug reports, issues, feature requests,
|
||||
feature implementations, pull requests, answering questions on the forum,
|
||||
helping to manage issues, etc.
|
||||
|
||||
The Hugo community and maintainers are very active and helpful, and the project benefits greatly from this activity.
|
||||
|
||||
[](https://waffle.io/spf13/hugo/metrics)
|
||||
|
||||
If you have any questions about how to contribute or what to contribute please ask on the [forum](http://discuss.gohugo.io)
|
||||
### Asking Support Questions
|
||||
|
||||
## Code Contribution Guideline
|
||||
We have an active [discussion forum](http://discuss.gohugo.io) where users and developers can ask questions.
|
||||
Please don't use the Github issue tracker to ask questions.
|
||||
|
||||
We welcome your contributions. To make the process as seamless as possible, we ask for the following:
|
||||
### Reporting Issues
|
||||
|
||||
* Go ahead and fork the project and make your changes. We encourage pull requests to discuss code changes.
|
||||
* When you’re ready to create a pull request, be sure to:
|
||||
* Have test cases for the new code. If you have questions about how to do it, please ask in your pull request.
|
||||
* Run `go fmt`
|
||||
* Squash your commits into a single commit. `git rebase -i`. It’s okay to force update your pull request.
|
||||
* This [blog article](http://chris.beams.io/posts/git-commit/) is a good resource for learning how to write good commit messages, the most important part being that each commit message should have a title/subject in imperative mode without trailing period: *"Return error on wrong use of the Paginator"*, **NOT** *"Returning some error."* Also, if your commit references one or more GitHub issues, always end your commit message body with *See #1234* or *Fixes #1234*. Replace *1234* with the GitHub issue ID. The last example will close the issue when the commit is merged into *master*.
|
||||
* Make sure `go test ./...` passes, and `go build` completes. Our [Travis CI loop](https://travis-ci.org/spf13/hugo) (Linux) and [AppVeyor](https://ci.appveyor.com/project/spf13/hugo/branch/master) (Windows) will catch most things that are missing.
|
||||
If you believe you have found a defect in Hugo or its documentation, use
|
||||
the Github issue tracker to report the problem to the Hugo maintainers.
|
||||
If you're not sure if it's a bug or not, start by asking in the [discussion forum](http://discuss.gohugo.io).
|
||||
When reporting the issue, please provide the version of Hugo in use (`hugo version`).
|
||||
|
||||
### Building Hugo with Your Changes
|
||||
### Submitting Patches
|
||||
|
||||
cd /path/to/hugo
|
||||
go build -o hugo main.go
|
||||
mv hugo /usr/local/bin/
|
||||
The Hugo project welcomes all contributors and contributions regardless of skill or experience level.
|
||||
If you are interested in helping with the project, we will help you with your contribution.
|
||||
Hugo is a very active project with many contributions happening daily.
|
||||
Because we want to create the best possible product for our users and the best contribution experience for our developers,
|
||||
we have a set of guidelines which ensure that all contributions are acceptable.
|
||||
The guidelines are not intended as a filter or barrier to participation.
|
||||
If you are unfamiliar with the contribution process, the Hugo team will help you and teach you how to bring your contribution in accordance with the guidelines.
|
||||
|
||||
### Adding compile information to Hugo
|
||||
|
||||
When Hugo is built using the above steps, the `version` sub-command will include the `mdate` of the Hugo executable, similar to the following:
|
||||
|
||||
Hugo Static Site Generator v0.13-DEV buildDate: 2014-12-24T04:46:03-07:00
|
||||
|
||||
Instead, it is possible to have the `version` sub-command return information about the git commit used and time of compilation using `build` flags.
|
||||
|
||||
To do this, replace the `go build` command with the following *(replace `/path/to/hugo` with the actual path)*:
|
||||
|
||||
go build -ldflags "-X /path/to/hugo/hugolib.CommitHash `git rev-parse --short HEAD 2>/dev/null` -X github.com/spf13/hugo/hugolib.BuildDate `date +%FT%T%z`"
|
||||
|
||||
This will result in `hugo version` output that looks similar to:
|
||||
|
||||
Hugo Static Site Generator v0.13-DEV-8042E77 buildDate: 2014-12-25T03:25:57-07:00
|
||||
|
||||
Alternatively, just run `make` — all the “magic” above is already in the `Makefile`. :wink:
|
||||
|
||||
### Running Hugo
|
||||
|
||||
cd /path/to/hugo
|
||||
go install github.com/spf13/hugo/hugolib
|
||||
go run main.go
|
||||
|
||||
**Complete documentation is available at [Hugo Documentation](http://gohugo.io/).**
|
||||
For a complete guide to contributing code to Hugo, see the [Contribution Guide](CONTRIBUTING.md).
|
||||
|
||||
[](https://github.com/igrigorik/ga-beacon)
|
||||
[](https://bitdeli.com/free "Bitdeli Badge")
|
||||
|
||||
[Go]: http://golang.org/
|
||||
[Go]: https://golang.org/
|
||||
[Hugo Documentation]: https://gohugo.io/overview/introduction/
|
||||
|
||||
@@ -7,21 +7,29 @@
|
||||
# - Do the same for master
|
||||
# - then compare the two runs with benchcmp
|
||||
|
||||
if [ $# -ne 2 ]
|
||||
benchFilter=".*"
|
||||
|
||||
if (( $# < 2 ));
|
||||
then
|
||||
echo "USAGE: ./bench.sh <git-branch> <package-to-bench>"
|
||||
echo "USAGE: ./bench.sh <git-branch> <package-to-bench> (and <benchmark filter> (regexp, optional))"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ $# -eq 3 ]; then
|
||||
benchFilter=$3
|
||||
fi
|
||||
|
||||
|
||||
BRANCH=$1
|
||||
PACKAGE=$2
|
||||
|
||||
git checkout $BRANCH
|
||||
go test -test.run=NONE -bench=".*" -test.benchmem=true ./$PACKAGE > /tmp/bench-$PACKAGE-$BRANCH.txt
|
||||
go test -test.run=NONE -bench="$benchFilter" -test.benchmem=true ./$PACKAGE > /tmp/bench-$PACKAGE-$BRANCH.txt
|
||||
|
||||
git checkout master
|
||||
go test -test.run=NONE -bench=".*" -test.benchmem=true ./$PACKAGE > /tmp/bench-$PACKAGE-master.txt
|
||||
go test -test.run=NONE -bench="$benchFilter" -test.benchmem=true ./$PACKAGE > /tmp/bench-$PACKAGE-master.txt
|
||||
|
||||
|
||||
benchcmp /tmp/bench-$PACKAGE-master.txt /tmp/bench-$PACKAGE-$BRANCH.txt
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright © 2013-14 Steve Francia <spf@spf13.com>.
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Simple Public License, Version 2.0 (the "License");
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://opensource.org/licenses/Simple-2.0
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@@ -11,6 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Package bufferpool provides a pool of bytes buffers.
|
||||
package bufferpool
|
||||
|
||||
import (
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// Copyright 2016-present The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package bufferpool
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBufferPool(t *testing.T) {
|
||||
buff := GetBuffer()
|
||||
buff.WriteString("do be do be do")
|
||||
assert.Equal(t, "do be do be do", buff.String())
|
||||
PutBuffer(buff)
|
||||
assert.Equal(t, 0, buff.Len())
|
||||
}
|
||||
+32
-23
@@ -1,9 +1,9 @@
|
||||
// Copyright © 2013 Steve Francia <spf@spf13.com>.
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Simple Public License, Version 2.0 (the "License");
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://opensource.org/licenses/Simple-2.0
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@@ -14,43 +14,50 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"os"
|
||||
"runtime/pprof"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var cpuProfilefile string
|
||||
var memProfilefile string
|
||||
var benchmarkTimes int
|
||||
var (
|
||||
benchmarkTimes int
|
||||
cpuProfilefile string
|
||||
memProfilefile string
|
||||
)
|
||||
|
||||
var benchmark = &cobra.Command{
|
||||
var benchmarkCmd = &cobra.Command{
|
||||
Use: "benchmark",
|
||||
Short: "Benchmark hugo by building a site a number of times",
|
||||
Long: `Hugo can build a site many times over and analyze the
|
||||
running process creating a benchmark.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
InitializeConfig()
|
||||
bench(cmd, args)
|
||||
},
|
||||
Short: "Benchmark Hugo by building a site a number of times.",
|
||||
Long: `Hugo can build a site many times over and analyze the running process
|
||||
creating a benchmark.`,
|
||||
}
|
||||
|
||||
func init() {
|
||||
benchmark.Flags().StringVar(&cpuProfilefile, "cpuprofile", "", "path/filename for the CPU profile file")
|
||||
benchmark.Flags().StringVar(&memProfilefile, "memprofile", "", "path/filename for the memory profile file")
|
||||
initHugoBuilderFlags(benchmarkCmd)
|
||||
initBenchmarkBuildingFlags(benchmarkCmd)
|
||||
|
||||
benchmark.Flags().IntVarP(&benchmarkTimes, "count", "n", 13, "number of times to build the site")
|
||||
benchmarkCmd.Flags().StringVar(&cpuProfilefile, "cpuprofile", "", "path/filename for the CPU profile file")
|
||||
benchmarkCmd.Flags().StringVar(&memProfilefile, "memprofile", "", "path/filename for the memory profile file")
|
||||
|
||||
benchmarkCmd.Flags().IntVarP(&benchmarkTimes, "count", "n", 13, "number of times to build the site")
|
||||
|
||||
benchmarkCmd.RunE = benchmark
|
||||
}
|
||||
|
||||
func bench(cmd *cobra.Command, args []string) {
|
||||
func benchmark(cmd *cobra.Command, args []string) error {
|
||||
if err := InitializeConfig(benchmarkCmd); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if memProfilefile != "" {
|
||||
f, err := os.Create(memProfilefile)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return err
|
||||
}
|
||||
for i := 0; i < benchmarkTimes; i++ {
|
||||
_ = buildSite()
|
||||
_ = resetAndbuildSites(false)
|
||||
}
|
||||
pprof.WriteHeapProfile(f)
|
||||
f.Close()
|
||||
@@ -62,14 +69,16 @@ func bench(cmd *cobra.Command, args []string) {
|
||||
f, err := os.Create(cpuProfilefile)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return err
|
||||
}
|
||||
|
||||
pprof.StartCPUProfile(f)
|
||||
defer pprof.StopCPUProfile()
|
||||
for i := 0; i < benchmarkTimes; i++ {
|
||||
_ = buildSite()
|
||||
_ = resetAndbuildSites(false)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
+23
-12
@@ -1,9 +1,9 @@
|
||||
// Copyright © 2013 Steve Francia <spf@spf13.com>.
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Simple Public License, Version 2.0 (the "License");
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://opensource.org/licenses/Simple-2.0
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@@ -15,17 +15,28 @@ package commands
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/hugo/hugolib"
|
||||
)
|
||||
|
||||
var check = &cobra.Command{
|
||||
var checkCmd = &cobra.Command{
|
||||
Use: "check",
|
||||
Short: "Check content in the source directory",
|
||||
Long: `Hugo will perform some basic analysis on the
|
||||
content provided and will give feedback.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
InitializeConfig()
|
||||
site := hugolib.Site{}
|
||||
site.Analyze()
|
||||
},
|
||||
Long: `Hugo will perform some basic analysis on the content provided
|
||||
and will give feedback.`,
|
||||
}
|
||||
|
||||
func init() {
|
||||
initHugoBuilderFlags(checkCmd)
|
||||
checkCmd.RunE = check
|
||||
}
|
||||
|
||||
func check(cmd *cobra.Command, args []string) error {
|
||||
if err := InitializeConfig(checkCmd); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := initSites(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return Hugo.Analyze()
|
||||
}
|
||||
|
||||
+44
-33
@@ -1,9 +1,9 @@
|
||||
// Copyright © 2013 Steve Francia <spf@spf13.com>.
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Simple Public License, Version 2.0 (the "License");
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://opensource.org/licenses/Simple-2.0
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@@ -32,47 +32,40 @@ var unsafe bool
|
||||
|
||||
var convertCmd = &cobra.Command{
|
||||
Use: "convert",
|
||||
Short: "Convert will modify your content to different formats",
|
||||
Long: `Convert will modify your content to different formats`,
|
||||
Run: nil,
|
||||
Short: "Convert your content to different formats",
|
||||
Long: `Convert your content (e.g. front matter) to different formats.
|
||||
|
||||
See convert's subcommands toJSON, toTOML and toYAML for more information.`,
|
||||
RunE: nil,
|
||||
}
|
||||
|
||||
var toJSONCmd = &cobra.Command{
|
||||
Use: "toJSON",
|
||||
Short: "Convert front matter to JSON",
|
||||
Long: `toJSON will convert all front matter in the content
|
||||
directory to use JSON for the front matter`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
err := convertContents(rune([]byte(parser.JSON_LEAD)[0]))
|
||||
if err != nil {
|
||||
jww.ERROR.Println(err)
|
||||
}
|
||||
Long: `toJSON converts all front matter in the content directory
|
||||
to use JSON for the front matter.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return convertContents(rune([]byte(parser.JSONLead)[0]))
|
||||
},
|
||||
}
|
||||
|
||||
var toTOMLCmd = &cobra.Command{
|
||||
Use: "toTOML",
|
||||
Short: "Convert front matter to TOML",
|
||||
Long: `toTOML will convert all front matter in the content
|
||||
directory to use TOML for the front matter`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
err := convertContents(rune([]byte(parser.TOML_LEAD)[0]))
|
||||
if err != nil {
|
||||
jww.ERROR.Println(err)
|
||||
}
|
||||
Long: `toTOML converts all front matter in the content directory
|
||||
to use TOML for the front matter.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return convertContents(rune([]byte(parser.TOMLLead)[0]))
|
||||
},
|
||||
}
|
||||
|
||||
var toYAMLCmd = &cobra.Command{
|
||||
Use: "toYAML",
|
||||
Short: "Convert front matter to YAML",
|
||||
Long: `toYAML will convert all front matter in the content
|
||||
directory to use YAML for the front matter`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
err := convertContents(rune([]byte(parser.YAML_LEAD)[0]))
|
||||
if err != nil {
|
||||
jww.ERROR.Println(err)
|
||||
}
|
||||
Long: `toYAML converts all front matter in the content directory
|
||||
to use YAML for the front matter.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return convertContents(rune([]byte(parser.YAMLLead)[0]))
|
||||
},
|
||||
}
|
||||
|
||||
@@ -81,14 +74,25 @@ func init() {
|
||||
convertCmd.AddCommand(toTOMLCmd)
|
||||
convertCmd.AddCommand(toYAMLCmd)
|
||||
convertCmd.PersistentFlags().StringVarP(&outputDir, "output", "o", "", "filesystem path to write files to")
|
||||
convertCmd.PersistentFlags().StringVarP(&source, "source", "s", "", "filesystem path to read files relative from")
|
||||
convertCmd.PersistentFlags().BoolVar(&unsafe, "unsafe", false, "enable less safe operations, please backup first")
|
||||
convertCmd.PersistentFlags().SetAnnotation("source", cobra.BashCompSubdirsInDir, []string{})
|
||||
}
|
||||
|
||||
func convertContents(mark rune) (err error) {
|
||||
InitializeConfig()
|
||||
site := &hugolib.Site{}
|
||||
if err := InitializeConfig(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := site.Initialise(); err != nil {
|
||||
h, err := hugolib.NewHugoSitesFromConfiguration()
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
site := h.Sites[0]
|
||||
|
||||
if err = site.Initialise(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -132,13 +136,20 @@ func convertContents(mark rune) (err error) {
|
||||
|
||||
page.SetDir(filepath.Join(helpers.AbsPathify(viper.GetString("ContentDir")), file.Dir()))
|
||||
page.SetSourceContent(psr.Content())
|
||||
page.SetSourceMetaData(metadata, mark)
|
||||
if err = page.SetSourceMetaData(metadata, mark); err != nil {
|
||||
jww.ERROR.Printf("Failed to set source metadata for file %q: %s. For more info see For more info see https://github.com/spf13/hugo/issues/2458", page.FullFilePath(), err)
|
||||
continue
|
||||
}
|
||||
|
||||
if outputDir != "" {
|
||||
page.SaveSourceAs(filepath.Join(outputDir, page.FullFilePath()))
|
||||
if err = page.SaveSourceAs(filepath.Join(outputDir, page.FullFilePath())); err != nil {
|
||||
return fmt.Errorf("Failed to save file %q: %s", page.FullFilePath(), err)
|
||||
}
|
||||
} else {
|
||||
if unsafe {
|
||||
page.SaveSource()
|
||||
if err = page.SaveSource(); err != nil {
|
||||
return fmt.Errorf("Failed to save file %q: %s", page.FullFilePath(), err)
|
||||
}
|
||||
} else {
|
||||
jww.FEEDBACK.Println("Unsafe operation not allowed, use --unsafe or set a different output path")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// Copyright 2016 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var envCmd = &cobra.Command{
|
||||
Use: "env",
|
||||
Short: "Print Hugo version and environment info",
|
||||
Long: `Print Hugo version and environment info. This is useful in Hugo bug reports.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
printHugoVersion()
|
||||
fmt.Printf("GOOS=%q\n", runtime.GOOS)
|
||||
fmt.Printf("GOARCH=%q\n", runtime.GOARCH)
|
||||
fmt.Printf("GOVERSION=%q\n", runtime.Version())
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var genCmd = &cobra.Command{
|
||||
Use: "gen",
|
||||
Short: "A collection of several useful generators.",
|
||||
}
|
||||
+42
-17
@@ -1,3 +1,16 @@
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
@@ -11,30 +24,40 @@ var autocompleteTarget string
|
||||
var autocompleteType string
|
||||
|
||||
var genautocompleteCmd = &cobra.Command{
|
||||
Use: "genautocomplete",
|
||||
Use: "autocomplete",
|
||||
Short: "Generate shell autocompletion script for Hugo",
|
||||
Long: `Generates a shell autocompletion script for Hugo.
|
||||
|
||||
NOTE: The current version supports Bash only. This should work for *nix systems with Bash installed.
|
||||
|
||||
By default the file is written directly to /etc/bash_completion.d for convenience and the command may need superuser rights, e.g:
|
||||
|
||||
sudo hugo genautocomplete
|
||||
|
||||
Add --completionfile=/path/to/file flag to set alternative file-path and name.
|
||||
|
||||
Logout and in again to reload the completion scripts or just source them in directly:
|
||||
|
||||
. /etc/bash_completion
|
||||
`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
|
||||
NOTE: The current version supports Bash only.
|
||||
This should work for *nix systems with Bash installed.
|
||||
|
||||
By default, the file is written directly to /etc/bash_completion.d
|
||||
for convenience, and the command may need superuser rights, e.g.:
|
||||
|
||||
$ sudo hugo gen autocomplete
|
||||
|
||||
Add ` + "`--completionfile=/path/to/file`" + ` flag to set alternative
|
||||
file-path and name.
|
||||
|
||||
Logout and in again to reload the completion scripts,
|
||||
or just source them in directly:
|
||||
|
||||
$ . /etc/bash_completion`,
|
||||
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if autocompleteType != "bash" {
|
||||
jww.FATAL.Fatalln("Only Bash is supported for now")
|
||||
return newUserError("Only Bash is supported for now")
|
||||
}
|
||||
|
||||
err := cmd.Root().GenBashCompletionFile(autocompleteTarget)
|
||||
|
||||
if err != nil {
|
||||
jww.FATAL.Fatalln("Failed to generate shell completion file:", err)
|
||||
return err
|
||||
}
|
||||
|
||||
jww.FEEDBACK.Println("Bash completion file for Hugo saved to", autocompleteTarget)
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
@@ -42,4 +65,6 @@ func init() {
|
||||
genautocompleteCmd.PersistentFlags().StringVarP(&autocompleteTarget, "completionfile", "", "/etc/bash_completion.d/hugo.sh", "Autocompletion file")
|
||||
genautocompleteCmd.PersistentFlags().StringVarP(&autocompleteType, "type", "", "bash", "Autocompletion type (currently only bash supported)")
|
||||
|
||||
// For bash-completion
|
||||
genautocompleteCmd.PersistentFlags().SetAnnotation("completionfile", cobra.BashCompFilenameExt, []string{})
|
||||
}
|
||||
|
||||
+38
-13
@@ -1,14 +1,30 @@
|
||||
// Copyright 2016 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/hugo/helpers"
|
||||
"github.com/spf13/hugo/hugofs"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/cobra/doc"
|
||||
"github.com/spf13/hugo/helpers"
|
||||
"github.com/spf13/hugo/hugofs"
|
||||
jww "github.com/spf13/jwalterweatherman"
|
||||
)
|
||||
|
||||
const gendocFrontmatterTemplate = `---
|
||||
@@ -21,21 +37,23 @@ url: %s
|
||||
|
||||
var gendocdir string
|
||||
var gendocCmd = &cobra.Command{
|
||||
Use: "gendoc",
|
||||
Use: "doc",
|
||||
Short: "Generate Markdown documentation for the Hugo CLI.",
|
||||
Long: `Generate Markdown documentation for the Hugo CLI.
|
||||
|
||||
This command is, mostly, used to create up-to-date documentation for gohugo.io.
|
||||
|
||||
It creates one Markdown file per command with front matter suitable for rendering in Hugo.
|
||||
`,
|
||||
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
This command is, mostly, used to create up-to-date documentation
|
||||
of Hugo's command-line interface for http://gohugo.io/.
|
||||
|
||||
It creates one Markdown file per command with front matter suitable
|
||||
for rendering in Hugo.`,
|
||||
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if !strings.HasSuffix(gendocdir, helpers.FilePathSeparator) {
|
||||
gendocdir += helpers.FilePathSeparator
|
||||
}
|
||||
if found, _ := helpers.Exists(gendocdir, hugofs.OsFs); !found {
|
||||
hugofs.OsFs.Mkdir(gendocdir, 0777)
|
||||
if found, _ := helpers.Exists(gendocdir, hugofs.Os()); !found {
|
||||
jww.FEEDBACK.Println("Directory", gendocdir, "does not exist, creating...")
|
||||
hugofs.Os().MkdirAll(gendocdir, 0777)
|
||||
}
|
||||
now := time.Now().Format(time.RFC3339)
|
||||
prepender := func(filename string) string {
|
||||
@@ -50,10 +68,17 @@ var gendocCmd = &cobra.Command{
|
||||
return "/commands/" + strings.ToLower(base) + "/"
|
||||
}
|
||||
|
||||
cobra.GenMarkdownTreeCustom(cmd.Root(), gendocdir, prepender, linkHandler)
|
||||
jww.FEEDBACK.Println("Generating Hugo command-line documentation in", gendocdir, "...")
|
||||
doc.GenMarkdownTreeCustom(cmd.Root(), gendocdir, prepender, linkHandler)
|
||||
jww.FEEDBACK.Println("Done.")
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
gendocCmd.PersistentFlags().StringVar(&gendocdir, "dir", "/tmp/hugodoc/", "the directory to write the doc.")
|
||||
|
||||
// For bash-completion
|
||||
gendocCmd.PersistentFlags().SetAnnotation("dir", cobra.BashCompSubdirsInDir, []string{})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
// Copyright 2016 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/cobra/doc"
|
||||
"github.com/spf13/hugo/helpers"
|
||||
"github.com/spf13/hugo/hugofs"
|
||||
jww "github.com/spf13/jwalterweatherman"
|
||||
)
|
||||
|
||||
var genmandir string
|
||||
var genmanCmd = &cobra.Command{
|
||||
Use: "man",
|
||||
Short: "Generate man pages for the Hugo CLI",
|
||||
Long: `This command automatically generates up-to-date man pages of Hugo's
|
||||
command-line interface. By default, it creates the man page files
|
||||
in the "man" directory under the current directory.`,
|
||||
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
header := &doc.GenManHeader{
|
||||
Section: "1",
|
||||
Manual: "Hugo Manual",
|
||||
Source: fmt.Sprintf("Hugo %s", helpers.HugoVersion()),
|
||||
}
|
||||
if !strings.HasSuffix(genmandir, helpers.FilePathSeparator) {
|
||||
genmandir += helpers.FilePathSeparator
|
||||
}
|
||||
if found, _ := helpers.Exists(genmandir, hugofs.Os()); !found {
|
||||
jww.FEEDBACK.Println("Directory", genmandir, "does not exist, creating...")
|
||||
hugofs.Os().MkdirAll(genmandir, 0777)
|
||||
}
|
||||
cmd.Root().DisableAutoGenTag = true
|
||||
|
||||
jww.FEEDBACK.Println("Generating Hugo man pages in", genmandir, "...")
|
||||
doc.GenManTree(cmd.Root(), header, genmandir)
|
||||
|
||||
jww.FEEDBACK.Println("Done.")
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
genmanCmd.PersistentFlags().StringVar(&genmandir, "dir", "man/", "the directory to write the man pages.")
|
||||
|
||||
// For bash-completion
|
||||
genmanCmd.PersistentFlags().SetAnnotation("dir", cobra.BashCompSubdirsInDir, []string{})
|
||||
}
|
||||
+686
-234
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,27 @@
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package commands
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
|
||||
func init() {
|
||||
// This message to show to Windows users if Hugo is opened from explorer.exe
|
||||
cobra.MousetrapHelpText = `
|
||||
|
||||
Hugo is a command-line tool for generating static website.
|
||||
|
||||
You need to open cmd.exe and run Hugo from there.
|
||||
|
||||
Visit http://gohugo.io/ for more information.`
|
||||
}
|
||||
@@ -0,0 +1,532 @@
|
||||
// Copyright 2016 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cast"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/hugo/helpers"
|
||||
"github.com/spf13/hugo/hugofs"
|
||||
"github.com/spf13/hugo/hugolib"
|
||||
"github.com/spf13/hugo/parser"
|
||||
jww "github.com/spf13/jwalterweatherman"
|
||||
)
|
||||
|
||||
func init() {
|
||||
importCmd.AddCommand(importJekyllCmd)
|
||||
}
|
||||
|
||||
var importCmd = &cobra.Command{
|
||||
Use: "import",
|
||||
Short: "Import your site from others.",
|
||||
Long: `Import your site from other web site generators like Jekyll.
|
||||
|
||||
Import requires a subcommand, e.g. ` + "`hugo import jekyll jekyll_root_path target_path`.",
|
||||
RunE: nil,
|
||||
}
|
||||
|
||||
var importJekyllCmd = &cobra.Command{
|
||||
Use: "jekyll",
|
||||
Short: "hugo import from Jekyll",
|
||||
Long: `hugo import from Jekyll.
|
||||
|
||||
Import from Jekyll requires two paths, e.g. ` + "`hugo import jekyll jekyll_root_path target_path`.",
|
||||
RunE: importFromJekyll,
|
||||
}
|
||||
|
||||
func init() {
|
||||
importJekyllCmd.Flags().Bool("force", false, "Allow import into non-empty target directory")
|
||||
}
|
||||
|
||||
func importFromJekyll(cmd *cobra.Command, args []string) error {
|
||||
jww.SetLogThreshold(jww.LevelTrace)
|
||||
jww.SetStdoutThreshold(jww.LevelWarn)
|
||||
|
||||
if len(args) < 2 {
|
||||
return newUserError(`Import from Jekyll requires two paths, e.g. ` + "`hugo import jekyll jekyll_root_path target_path`.")
|
||||
}
|
||||
|
||||
jekyllRoot, err := filepath.Abs(filepath.Clean(args[0]))
|
||||
if err != nil {
|
||||
return newUserError("Path error:", args[0])
|
||||
}
|
||||
|
||||
targetDir, err := filepath.Abs(filepath.Clean(args[1]))
|
||||
if err != nil {
|
||||
return newUserError("Path error:", args[1])
|
||||
}
|
||||
|
||||
jww.INFO.Println("Import Jekyll from:", jekyllRoot, "to:", targetDir)
|
||||
|
||||
if strings.HasPrefix(filepath.Dir(targetDir), jekyllRoot) {
|
||||
return newUserError("Target path should not be inside the Jekyll root, aborting.")
|
||||
}
|
||||
|
||||
forceImport, _ := cmd.Flags().GetBool("force")
|
||||
if err := createSiteFromJekyll(jekyllRoot, targetDir, forceImport); err != nil {
|
||||
return newUserError(err)
|
||||
}
|
||||
|
||||
fmt.Println("Importing...")
|
||||
|
||||
fileCount := 0
|
||||
callback := func(path string, fi os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if fi.IsDir() {
|
||||
return nil
|
||||
}
|
||||
|
||||
relPath, err := filepath.Rel(jekyllRoot, path)
|
||||
if err != nil {
|
||||
return newUserError("Get rel path error:", path)
|
||||
}
|
||||
|
||||
relPath = filepath.ToSlash(relPath)
|
||||
draft := false
|
||||
|
||||
switch {
|
||||
case strings.HasPrefix(relPath, "_posts/"):
|
||||
relPath = "content/post" + relPath[len("_posts"):]
|
||||
case strings.HasPrefix(relPath, "_drafts/"):
|
||||
relPath = "content/draft" + relPath[len("_drafts"):]
|
||||
draft = true
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
||||
fileCount++
|
||||
return convertJekyllPost(path, relPath, targetDir, draft)
|
||||
}
|
||||
|
||||
err = helpers.SymbolicWalk(hugofs.Os(), jekyllRoot, callback)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println("Congratulations!", fileCount, "post(s) imported!")
|
||||
fmt.Println("Now, start Hugo by yourself:\n" +
|
||||
"$ git clone https://github.com/spf13/herring-cove.git " + args[1] + "/themes/herring-cove")
|
||||
fmt.Println("$ cd " + args[1] + "\n$ hugo server --theme=herring-cove")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO: Consider calling doNewSite() instead?
|
||||
func createSiteFromJekyll(jekyllRoot, targetDir string, force bool) error {
|
||||
fs := hugofs.Source()
|
||||
if exists, _ := helpers.Exists(targetDir, fs); exists {
|
||||
if isDir, _ := helpers.IsDir(targetDir, fs); !isDir {
|
||||
return errors.New("Target path \"" + targetDir + "\" already exists but not a directory")
|
||||
}
|
||||
|
||||
isEmpty, _ := helpers.IsEmpty(targetDir, fs)
|
||||
|
||||
if !isEmpty && !force {
|
||||
return errors.New("Target path \"" + targetDir + "\" already exists and is not empty")
|
||||
}
|
||||
}
|
||||
|
||||
jekyllConfig := loadJekyllConfig(jekyllRoot)
|
||||
|
||||
// Crude test to make sure at least one of _drafts/ and _posts/ exists
|
||||
// and is not empty.
|
||||
hasPostsOrDrafts := false
|
||||
postsDir := filepath.Join(jekyllRoot, "_posts")
|
||||
draftsDir := filepath.Join(jekyllRoot, "_drafts")
|
||||
for _, d := range []string{postsDir, draftsDir} {
|
||||
if exists, _ := helpers.Exists(d, fs); exists {
|
||||
if isDir, _ := helpers.IsDir(d, fs); isDir {
|
||||
if isEmpty, _ := helpers.IsEmpty(d, fs); !isEmpty {
|
||||
hasPostsOrDrafts = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if !hasPostsOrDrafts {
|
||||
return errors.New("Your Jekyll root contains neither posts nor drafts, aborting.")
|
||||
}
|
||||
|
||||
mkdir(targetDir, "layouts")
|
||||
mkdir(targetDir, "content")
|
||||
mkdir(targetDir, "archetypes")
|
||||
mkdir(targetDir, "static")
|
||||
mkdir(targetDir, "data")
|
||||
mkdir(targetDir, "themes")
|
||||
|
||||
createConfigFromJekyll(targetDir, "yaml", jekyllConfig)
|
||||
|
||||
copyJekyllFilesAndFolders(jekyllRoot, filepath.Join(targetDir, "static"))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func loadJekyllConfig(jekyllRoot string) map[string]interface{} {
|
||||
fs := hugofs.Source()
|
||||
path := filepath.Join(jekyllRoot, "_config.yml")
|
||||
|
||||
exists, err := helpers.Exists(path, fs)
|
||||
|
||||
if err != nil || !exists {
|
||||
jww.WARN.Println("_config.yaml not found: Is the specified Jekyll root correct?")
|
||||
return nil
|
||||
}
|
||||
|
||||
f, err := fs.Open(path)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
defer f.Close()
|
||||
|
||||
b, err := ioutil.ReadAll(f)
|
||||
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
c, err := parser.HandleYAMLMetaData(b)
|
||||
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return c.(map[string]interface{})
|
||||
}
|
||||
|
||||
func createConfigFromJekyll(inpath string, kind string, jekyllConfig map[string]interface{}) (err error) {
|
||||
title := "My New Hugo Site"
|
||||
baseurl := "http://replace-this-with-your-hugo-site.com/"
|
||||
|
||||
for key, value := range jekyllConfig {
|
||||
lowerKey := strings.ToLower(key)
|
||||
|
||||
switch lowerKey {
|
||||
case "title":
|
||||
if str, ok := value.(string); ok {
|
||||
title = str
|
||||
}
|
||||
|
||||
case "url":
|
||||
if str, ok := value.(string); ok {
|
||||
baseurl = str
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in := map[string]interface{}{
|
||||
"baseurl": baseurl,
|
||||
"title": title,
|
||||
"languageCode": "en-us",
|
||||
"disablePathToLower": true,
|
||||
}
|
||||
kind = parser.FormatSanitize(kind)
|
||||
|
||||
by, err := parser.InterfaceToConfig(in, parser.FormatToLeadRune(kind))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = helpers.WriteToDisk(filepath.Join(inpath, "config."+kind), bytes.NewReader(by), hugofs.Source())
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func copyFile(source string, dest string) error {
|
||||
sf, err := os.Open(source)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer sf.Close()
|
||||
df, err := os.Create(dest)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer df.Close()
|
||||
_, err = io.Copy(df, sf)
|
||||
if err == nil {
|
||||
si, err := os.Stat(source)
|
||||
if err != nil {
|
||||
err = os.Chmod(dest, si.Mode())
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func copyDir(source string, dest string) error {
|
||||
fi, err := os.Stat(source)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !fi.IsDir() {
|
||||
return errors.New(source + " is not a directory")
|
||||
}
|
||||
err = os.MkdirAll(dest, fi.Mode())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
entries, err := ioutil.ReadDir(source)
|
||||
for _, entry := range entries {
|
||||
sfp := filepath.Join(source, entry.Name())
|
||||
dfp := filepath.Join(dest, entry.Name())
|
||||
if entry.IsDir() {
|
||||
err = copyDir(sfp, dfp)
|
||||
if err != nil {
|
||||
jww.ERROR.Println(err)
|
||||
}
|
||||
} else {
|
||||
err = copyFile(sfp, dfp)
|
||||
if err != nil {
|
||||
jww.ERROR.Println(err)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func copyJekyllFilesAndFolders(jekyllRoot string, dest string) error {
|
||||
fi, err := os.Stat(jekyllRoot)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !fi.IsDir() {
|
||||
return errors.New(jekyllRoot + " is not a directory")
|
||||
}
|
||||
err = os.MkdirAll(dest, fi.Mode())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
entries, err := ioutil.ReadDir(jekyllRoot)
|
||||
for _, entry := range entries {
|
||||
sfp := filepath.Join(jekyllRoot, entry.Name())
|
||||
dfp := filepath.Join(dest, entry.Name())
|
||||
if entry.IsDir() {
|
||||
if entry.Name()[0] != '_' && entry.Name()[0] != '.' {
|
||||
err = copyDir(sfp, dfp)
|
||||
if err != nil {
|
||||
jww.ERROR.Println(err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
lowerEntryName := strings.ToLower(entry.Name())
|
||||
exceptSuffix := []string{".md", ".markdown", ".html", ".htm",
|
||||
".xml", ".textile", "rakefile", "gemfile", ".lock"}
|
||||
isExcept := false
|
||||
for _, suffix := range exceptSuffix {
|
||||
if strings.HasSuffix(lowerEntryName, suffix) {
|
||||
isExcept = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !isExcept && entry.Name()[0] != '.' && entry.Name()[0] != '_' {
|
||||
err = copyFile(sfp, dfp)
|
||||
if err != nil {
|
||||
jww.ERROR.Println(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func parseJekyllFilename(filename string) (time.Time, string, error) {
|
||||
re := regexp.MustCompile(`(\d+-\d+-\d+)-(.+)\..*`)
|
||||
r := re.FindAllStringSubmatch(filename, -1)
|
||||
if len(r) == 0 {
|
||||
return time.Now(), "", errors.New("filename not match")
|
||||
}
|
||||
|
||||
postDate, err := time.Parse("2006-01-02", r[0][1])
|
||||
if err != nil {
|
||||
return time.Now(), "", err
|
||||
}
|
||||
|
||||
postName := r[0][2]
|
||||
|
||||
return postDate, postName, nil
|
||||
}
|
||||
|
||||
func convertJekyllPost(path, relPath, targetDir string, draft bool) error {
|
||||
jww.TRACE.Println("Converting", path)
|
||||
|
||||
filename := filepath.Base(path)
|
||||
postDate, postName, err := parseJekyllFilename(filename)
|
||||
if err != nil {
|
||||
jww.WARN.Printf("Failed to parse filename '%s': %s. Skipping.", filename, err)
|
||||
return nil
|
||||
}
|
||||
|
||||
jww.TRACE.Println(filename, postDate, postName)
|
||||
|
||||
targetFile := filepath.Join(targetDir, relPath)
|
||||
targetParentDir := filepath.Dir(targetFile)
|
||||
os.MkdirAll(targetParentDir, 0777)
|
||||
|
||||
contentBytes, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
jww.ERROR.Println("Read file error:", path)
|
||||
return err
|
||||
}
|
||||
|
||||
psr, err := parser.ReadFrom(bytes.NewReader(contentBytes))
|
||||
if err != nil {
|
||||
jww.ERROR.Println("Parse file error:", path)
|
||||
return err
|
||||
}
|
||||
|
||||
metadata, err := psr.Metadata()
|
||||
if err != nil {
|
||||
jww.ERROR.Println("Processing file error:", path)
|
||||
return err
|
||||
}
|
||||
|
||||
newmetadata, err := convertJekyllMetaData(metadata, postName, postDate, draft)
|
||||
if err != nil {
|
||||
jww.ERROR.Println("Convert metadata error:", path)
|
||||
return err
|
||||
}
|
||||
|
||||
jww.TRACE.Println(newmetadata)
|
||||
content := convertJekyllContent(newmetadata, string(psr.Content()))
|
||||
|
||||
page, err := hugolib.NewPage(filename)
|
||||
if err != nil {
|
||||
jww.ERROR.Println("New page error", filename)
|
||||
return err
|
||||
}
|
||||
|
||||
page.SetDir(targetParentDir)
|
||||
page.SetSourceContent([]byte(content))
|
||||
page.SetSourceMetaData(newmetadata, parser.FormatToLeadRune("yaml"))
|
||||
page.SaveSourceAs(targetFile)
|
||||
|
||||
jww.TRACE.Println("Target file:", targetFile)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func convertJekyllMetaData(m interface{}, postName string, postDate time.Time, draft bool) (interface{}, error) {
|
||||
url := postDate.Format("/2006/01/02/") + postName + "/"
|
||||
|
||||
metadata, err := cast.ToStringMapE(m)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if draft {
|
||||
metadata["draft"] = true
|
||||
}
|
||||
|
||||
for key, value := range metadata {
|
||||
lowerKey := strings.ToLower(key)
|
||||
|
||||
switch lowerKey {
|
||||
case "layout":
|
||||
delete(metadata, key)
|
||||
case "permalink":
|
||||
if str, ok := value.(string); ok {
|
||||
url = str
|
||||
}
|
||||
delete(metadata, key)
|
||||
case "category":
|
||||
if str, ok := value.(string); ok {
|
||||
metadata["categories"] = []string{str}
|
||||
}
|
||||
delete(metadata, key)
|
||||
case "excerpt_separator":
|
||||
if key != lowerKey {
|
||||
delete(metadata, key)
|
||||
metadata[lowerKey] = value
|
||||
}
|
||||
case "date":
|
||||
if str, ok := value.(string); ok {
|
||||
re := regexp.MustCompile(`(\d+):(\d+):(\d+)`)
|
||||
r := re.FindAllStringSubmatch(str, -1)
|
||||
if len(r) > 0 {
|
||||
hour, _ := strconv.Atoi(r[0][1])
|
||||
minute, _ := strconv.Atoi(r[0][2])
|
||||
second, _ := strconv.Atoi(r[0][3])
|
||||
postDate = time.Date(postDate.Year(), postDate.Month(), postDate.Day(), hour, minute, second, 0, time.UTC)
|
||||
}
|
||||
}
|
||||
delete(metadata, key)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
metadata["url"] = url
|
||||
metadata["date"] = postDate.Format(time.RFC3339)
|
||||
|
||||
return metadata, nil
|
||||
}
|
||||
|
||||
func convertJekyllContent(m interface{}, content string) string {
|
||||
metadata, _ := cast.ToStringMapE(m)
|
||||
|
||||
lines := strings.Split(content, "\n")
|
||||
var resultLines []string
|
||||
for _, line := range lines {
|
||||
resultLines = append(resultLines, strings.Trim(line, "\r\n"))
|
||||
}
|
||||
|
||||
content = strings.Join(resultLines, "\n")
|
||||
|
||||
excerptSep := "<!--more-->"
|
||||
if value, ok := metadata["excerpt_separator"]; ok {
|
||||
if str, strOk := value.(string); strOk {
|
||||
content = strings.Replace(content, strings.TrimSpace(str), excerptSep, -1)
|
||||
}
|
||||
}
|
||||
|
||||
replaceList := []struct {
|
||||
re *regexp.Regexp
|
||||
replace string
|
||||
}{
|
||||
{regexp.MustCompile("<!-- more -->"), "<!--more-->"},
|
||||
{regexp.MustCompile(`\{%\s*raw\s*%\}\s*(.*?)\s*\{%\s*endraw\s*%\}`), "$1"},
|
||||
{regexp.MustCompile(`{%\s*highlight\s*(.*?)\s*%}`), "{{< highlight $1 >}}"},
|
||||
{regexp.MustCompile(`{%\s*endhighlight\s*%}`), "{{< / highlight >}}"},
|
||||
}
|
||||
|
||||
for _, replace := range replaceList {
|
||||
content = replace.re.ReplaceAllString(content, replace.replace)
|
||||
}
|
||||
|
||||
return content
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestParseJekyllFilename(t *testing.T) {
|
||||
filenameArray := []string{
|
||||
"2015-01-02-test.md",
|
||||
"2012-03-15-中文.markup",
|
||||
}
|
||||
|
||||
expectResult := []struct {
|
||||
postDate time.Time
|
||||
postName string
|
||||
}{
|
||||
{time.Date(2015, time.January, 2, 0, 0, 0, 0, time.UTC), "test"},
|
||||
{time.Date(2012, time.March, 15, 0, 0, 0, 0, time.UTC), "中文"},
|
||||
}
|
||||
|
||||
for i, filename := range filenameArray {
|
||||
postDate, postName, err := parseJekyllFilename(filename)
|
||||
assert.Equal(t, err, nil)
|
||||
assert.Equal(t, expectResult[i].postDate.Format("2006-01-02"), postDate.Format("2006-01-02"))
|
||||
assert.Equal(t, expectResult[i].postName, postName)
|
||||
}
|
||||
}
|
||||
|
||||
func TestConvertJekyllMetadata(t *testing.T) {
|
||||
testDataList := []struct {
|
||||
metadata interface{}
|
||||
postName string
|
||||
postDate time.Time
|
||||
draft bool
|
||||
expect string
|
||||
}{
|
||||
{map[interface{}]interface{}{}, "testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
|
||||
`{"date":"2015-10-01T00:00:00Z","url":"/2015/10/01/testPost/"}`},
|
||||
{map[interface{}]interface{}{}, "testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), true,
|
||||
`{"date":"2015-10-01T00:00:00Z","draft":true,"url":"/2015/10/01/testPost/"}`},
|
||||
{map[interface{}]interface{}{"Permalink": "/permalink.html", "layout": "post"},
|
||||
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
|
||||
`{"date":"2015-10-01T00:00:00Z","url":"/permalink.html"}`},
|
||||
{map[interface{}]interface{}{"permalink": "/permalink.html"},
|
||||
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
|
||||
`{"date":"2015-10-01T00:00:00Z","url":"/permalink.html"}`},
|
||||
{map[interface{}]interface{}{"category": nil, "permalink": 123},
|
||||
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
|
||||
`{"date":"2015-10-01T00:00:00Z","url":"/2015/10/01/testPost/"}`},
|
||||
{map[interface{}]interface{}{"Excerpt_Separator": "sep"},
|
||||
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
|
||||
`{"date":"2015-10-01T00:00:00Z","excerpt_separator":"sep","url":"/2015/10/01/testPost/"}`},
|
||||
{map[interface{}]interface{}{"category": "book", "layout": "post", "Others": "Goods", "Date": "2015-10-01 12:13:11"},
|
||||
"testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false,
|
||||
`{"Others":"Goods","categories":["book"],"date":"2015-10-01T12:13:11Z","url":"/2015/10/01/testPost/"}`},
|
||||
}
|
||||
|
||||
for _, data := range testDataList {
|
||||
result, err := convertJekyllMetaData(data.metadata, data.postName, data.postDate, data.draft)
|
||||
assert.Equal(t, nil, err)
|
||||
jsonResult, err := json.Marshal(result)
|
||||
assert.Equal(t, nil, err)
|
||||
assert.Equal(t, data.expect, string(jsonResult))
|
||||
}
|
||||
}
|
||||
|
||||
func TestConvertJekyllContent(t *testing.T) {
|
||||
testDataList := []struct {
|
||||
metadata interface{}
|
||||
content string
|
||||
expect string
|
||||
}{
|
||||
{map[interface{}]interface{}{},
|
||||
`Test content\n<!-- more -->\npart2 content`, `Test content\n<!--more-->\npart2 content`},
|
||||
{map[interface{}]interface{}{"excerpt_separator": "<!--sep-->"},
|
||||
`Test content\n<!--sep-->\npart2 content`, `Test content\n<!--more-->\npart2 content`},
|
||||
{map[interface{}]interface{}{}, "{% raw %}text{% endraw %}", "text"},
|
||||
{map[interface{}]interface{}{}, "{%raw%} text2 {%endraw %}", "text2"},
|
||||
{map[interface{}]interface{}{},
|
||||
"{% highlight go %}\nvar s int\n{% endhighlight %}",
|
||||
"{{< highlight go >}}\nvar s int\n{{< / highlight >}}"},
|
||||
}
|
||||
|
||||
for _, data := range testDataList {
|
||||
result := convertJekyllContent(data.metadata, data.content)
|
||||
assert.Equal(t, data.expect, result)
|
||||
}
|
||||
}
|
||||
+26
-10
@@ -1,10 +1,23 @@
|
||||
// +build darwin
|
||||
// Copyright © 2013 Steve Francia <spf@spf13.com>.
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Simple Public License, Version 2.0 (the "License");
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://opensource.org/licenses/Simple-2.0
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// +build darwin
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@@ -22,20 +35,21 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
check.AddCommand(limit)
|
||||
checkCmd.AddCommand(limit)
|
||||
}
|
||||
|
||||
var limit = &cobra.Command{
|
||||
Use: "ulimit",
|
||||
Short: "Check system ulimit settings",
|
||||
Long: `Hugo will inspect the current ulimit settings on the system.
|
||||
This is primarily to ensure that Hugo can watch enough files on some OSs`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
This is primarily to ensure that Hugo can watch enough files on some OSs`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
var rLimit syscall.Rlimit
|
||||
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit)
|
||||
if err != nil {
|
||||
jww.ERROR.Println("Error Getting Rlimit ", err)
|
||||
return newSystemError("Error Getting Rlimit ", err)
|
||||
}
|
||||
|
||||
jww.FEEDBACK.Println("Current rLimit:", rLimit)
|
||||
|
||||
jww.FEEDBACK.Println("Attempting to increase limit")
|
||||
@@ -43,13 +57,15 @@ var limit = &cobra.Command{
|
||||
rLimit.Cur = 999999
|
||||
err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit)
|
||||
if err != nil {
|
||||
jww.ERROR.Println("Error Setting rLimit ", err)
|
||||
return newSystemError("Error Setting rLimit ", err)
|
||||
}
|
||||
err = syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit)
|
||||
if err != nil {
|
||||
jww.ERROR.Println("Error Getting rLimit ", err)
|
||||
return newSystemError("Error Getting rLimit ", err)
|
||||
}
|
||||
jww.FEEDBACK.Println("rLimit after change:", rLimit)
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,23 @@
|
||||
// +build !darwin
|
||||
// Copyright © 2013 Steve Francia <spf@spf13.com>.
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Simple Public License, Version 2.0 (the "License");
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://opensource.org/licenses/Simple-2.0
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// +build !darwin
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
||||
+84
-25
@@ -1,9 +1,9 @@
|
||||
// Copyright © 2014 Steve Francia <spf@spf13.com>.
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Simple Public License, Version 2.0 (the "License");
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://opensource.org/licenses/Simple-2.0
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@@ -25,61 +25,120 @@ import (
|
||||
func init() {
|
||||
listCmd.AddCommand(listDraftsCmd)
|
||||
listCmd.AddCommand(listFutureCmd)
|
||||
listCmd.AddCommand(listExpiredCmd)
|
||||
listCmd.PersistentFlags().StringVarP(&source, "source", "s", "", "filesystem path to read files relative from")
|
||||
listCmd.PersistentFlags().SetAnnotation("source", cobra.BashCompSubdirsInDir, []string{})
|
||||
}
|
||||
|
||||
var listCmd = &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "Listing out various types of content",
|
||||
Long: `Listing out various types of content. List requires a subcommand, eg. hugo list drafts`,
|
||||
Run: nil,
|
||||
Long: `Listing out various types of content.
|
||||
|
||||
List requires a subcommand, e.g. ` + "`hugo list drafts`.",
|
||||
RunE: nil,
|
||||
}
|
||||
|
||||
var listDraftsCmd = &cobra.Command{
|
||||
Use: "drafts",
|
||||
Short: "List all drafts",
|
||||
Long: `List all of the drafts in your content directory`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
Long: `List all of the drafts in your content directory.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
||||
InitializeConfig()
|
||||
viper.Set("BuildDrafts", true)
|
||||
|
||||
site := &hugolib.Site{}
|
||||
|
||||
if err := site.Process(); err != nil {
|
||||
fmt.Println("Error Processing Source Content", err)
|
||||
if err := InitializeConfig(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, p := range site.Pages {
|
||||
viper.Set("BuildDrafts", true)
|
||||
|
||||
sites, err := hugolib.NewHugoSitesFromConfiguration()
|
||||
|
||||
if err != nil {
|
||||
return newSystemError("Error creating sites", err)
|
||||
}
|
||||
|
||||
if err := sites.Build(hugolib.BuildCfg{SkipRender: true}); err != nil {
|
||||
return newSystemError("Error Processing Source Content", err)
|
||||
}
|
||||
|
||||
for _, p := range sites.Pages() {
|
||||
if p.IsDraft() {
|
||||
fmt.Println(filepath.Join(p.File.Dir(), p.File.LogicalName()))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
var listFutureCmd = &cobra.Command{
|
||||
Use: "future",
|
||||
Short: "List all posts dated in the future",
|
||||
Long: `List all of the posts in your content directory who will be posted in the future`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
Long: `List all of the posts in your content directory which will be
|
||||
posted in the future.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
||||
InitializeConfig()
|
||||
viper.Set("BuildFuture", true)
|
||||
|
||||
site := &hugolib.Site{}
|
||||
|
||||
if err := site.Process(); err != nil {
|
||||
fmt.Println("Error Processing Source Content", err)
|
||||
if err := InitializeConfig(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, p := range site.Pages {
|
||||
viper.Set("BuildFuture", true)
|
||||
|
||||
sites, err := hugolib.NewHugoSitesFromConfiguration()
|
||||
|
||||
if err != nil {
|
||||
return newSystemError("Error creating sites", err)
|
||||
}
|
||||
|
||||
if err := sites.Build(hugolib.BuildCfg{SkipRender: true}); err != nil {
|
||||
return newSystemError("Error Processing Source Content", err)
|
||||
}
|
||||
|
||||
for _, p := range sites.Pages() {
|
||||
if p.IsFuture() {
|
||||
fmt.Println(filepath.Join(p.File.Dir(), p.File.LogicalName()))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
var listExpiredCmd = &cobra.Command{
|
||||
Use: "expired",
|
||||
Short: "List all posts already expired",
|
||||
Long: `List all of the posts in your content directory which has already
|
||||
expired.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
||||
if err := InitializeConfig(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
viper.Set("BuildExpired", true)
|
||||
|
||||
sites, err := hugolib.NewHugoSitesFromConfiguration()
|
||||
|
||||
if err != nil {
|
||||
return newSystemError("Error creating sites", err)
|
||||
}
|
||||
|
||||
if err := sites.Build(hugolib.BuildCfg{SkipRender: true}); err != nil {
|
||||
return newSystemError("Error Processing Source Content", err)
|
||||
}
|
||||
|
||||
for _, p := range sites.Pages() {
|
||||
if p.IsExpired() {
|
||||
fmt.Println(filepath.Join(p.File.Dir(), p.File.LogicalName()))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
+43
-32
@@ -1,9 +1,9 @@
|
||||
// Copyright © 2013-15 Steve Francia <spf@spf13.com>.
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Simple Public License, Version 2.0 (the "License");
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://opensource.org/licenses/Simple-2.0
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@@ -15,39 +15,50 @@ package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"reflect"
|
||||
"sort"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var config = &cobra.Command{
|
||||
var configCmd = &cobra.Command{
|
||||
Use: "config",
|
||||
Short: "Print the site configuration",
|
||||
Long: `Print the site configuration, both default and custom settings`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
InitializeConfig()
|
||||
allSettings := viper.AllSettings()
|
||||
|
||||
var separator string
|
||||
if allSettings["metadataformat"] == "toml" {
|
||||
separator = " = "
|
||||
} else {
|
||||
separator = ": "
|
||||
}
|
||||
|
||||
var keys []string
|
||||
for k := range allSettings {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
sort.Strings(keys)
|
||||
for _, k := range keys {
|
||||
kv := reflect.ValueOf(allSettings[k])
|
||||
if kv.Kind() == reflect.String {
|
||||
fmt.Printf("%s%s\"%+v\"\n", k, separator, allSettings[k])
|
||||
} else {
|
||||
fmt.Printf("%s%s%+v\n", k, separator, allSettings[k])
|
||||
}
|
||||
}
|
||||
},
|
||||
Long: `Print the site configuration, both default and custom settings.`,
|
||||
}
|
||||
|
||||
func init() {
|
||||
configCmd.RunE = config
|
||||
}
|
||||
|
||||
func config(cmd *cobra.Command, args []string) error {
|
||||
if err := InitializeConfig(configCmd); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
allSettings := viper.AllSettings()
|
||||
|
||||
var separator string
|
||||
if allSettings["metadataformat"] == "toml" {
|
||||
separator = " = "
|
||||
} else {
|
||||
separator = ": "
|
||||
}
|
||||
|
||||
var keys []string
|
||||
for k := range allSettings {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
sort.Strings(keys)
|
||||
for _, k := range keys {
|
||||
kv := reflect.ValueOf(allSettings[k])
|
||||
if kv.Kind() == reflect.String {
|
||||
fmt.Printf("%s%s\"%+v\"\n", k, separator, allSettings[k])
|
||||
} else {
|
||||
fmt.Printf("%s%s%+v\n", k, separator, allSettings[k])
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
+122
-65
@@ -1,9 +1,9 @@
|
||||
// Copyright © 2014-2015 Steve Francia <spf@spf13.com>.
|
||||
// Copyright 2016 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Simple Public License, Version 2.0 (the "License");
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://opensource.org/licenses/Simple-2.0
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@@ -15,6 +15,7 @@ package commands
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -29,18 +30,24 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var siteType string
|
||||
var configFormat string
|
||||
var contentType string
|
||||
var contentFormat string
|
||||
var contentFrontMatter string
|
||||
var (
|
||||
configFormat string
|
||||
contentEditor string
|
||||
contentType string
|
||||
)
|
||||
|
||||
func init() {
|
||||
newSiteCmd.Flags().StringVarP(&configFormat, "format", "f", "toml", "config & frontmatter format")
|
||||
newSiteCmd.Flags().Bool("force", false, "Init inside non-empty directory")
|
||||
newCmd.Flags().StringVarP(&configFormat, "format", "f", "toml", "frontmatter format")
|
||||
newCmd.Flags().StringVarP(&contentType, "kind", "k", "", "Content type to create")
|
||||
newCmd.PersistentFlags().StringVarP(&source, "source", "s", "", "filesystem path to read files relative from")
|
||||
newCmd.PersistentFlags().SetAnnotation("source", cobra.BashCompSubdirsInDir, []string{})
|
||||
newCmd.Flags().StringVar(&contentEditor, "editor", "", "edit new content with this editor, if provided")
|
||||
|
||||
newCmd.AddCommand(newSiteCmd)
|
||||
newCmd.AddCommand(newThemeCmd)
|
||||
|
||||
}
|
||||
|
||||
var newCmd = &cobra.Command{
|
||||
@@ -48,10 +55,12 @@ var newCmd = &cobra.Command{
|
||||
Short: "Create new content for your site",
|
||||
Long: `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.
|
||||
`,
|
||||
Run: NewContent,
|
||||
|
||||
You can also specify the kind with ` + "`-k KIND`" + `.
|
||||
|
||||
If archetypes are provided in your theme or site, they will be used.`,
|
||||
|
||||
RunE: NewContent,
|
||||
}
|
||||
|
||||
var newSiteCmd = &cobra.Command{
|
||||
@@ -59,9 +68,8 @@ var newSiteCmd = &cobra.Command{
|
||||
Short: "Create a new site (skeleton)",
|
||||
Long: `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.
|
||||
`,
|
||||
Run: NewSite,
|
||||
Use ` + "`hugo new [contentPath]`" + ` to create new content.`,
|
||||
RunE: NewSite,
|
||||
}
|
||||
|
||||
var newThemeCmd = &cobra.Command{
|
||||
@@ -70,22 +78,26 @@ var newThemeCmd = &cobra.Command{
|
||||
Long: `Create a new theme (skeleton) called [name] in the current directory.
|
||||
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
|
||||
as you see fit.
|
||||
`,
|
||||
Run: NewTheme,
|
||||
as you see fit.`,
|
||||
RunE: NewTheme,
|
||||
}
|
||||
|
||||
// NewContent adds new content to a Hugo site.
|
||||
func NewContent(cmd *cobra.Command, args []string) {
|
||||
InitializeConfig()
|
||||
func NewContent(cmd *cobra.Command, args []string) error {
|
||||
if err := InitializeConfig(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cmd.Flags().Lookup("format").Changed {
|
||||
if flagChanged(cmd.Flags(), "format") {
|
||||
viper.Set("MetaDataFormat", configFormat)
|
||||
}
|
||||
|
||||
if flagChanged(cmd.Flags(), "editor") {
|
||||
viper.Set("NewContentEditor", contentEditor)
|
||||
}
|
||||
|
||||
if len(args) < 1 {
|
||||
cmd.Usage()
|
||||
jww.FATAL.Fatalln("path needs to be provided")
|
||||
return newUserError("path needs to be provided")
|
||||
}
|
||||
|
||||
createpath := args[0]
|
||||
@@ -98,63 +110,100 @@ func NewContent(cmd *cobra.Command, args []string) {
|
||||
kind = contentType
|
||||
}
|
||||
|
||||
err := create.NewContent(kind, createpath)
|
||||
if err != nil {
|
||||
jww.ERROR.Println(err)
|
||||
}
|
||||
return create.NewContent(hugofs.Source(), kind, createpath)
|
||||
}
|
||||
|
||||
// NewSite creates a new hugo site and initializes a structured Hugo directory.
|
||||
func NewSite(cmd *cobra.Command, args []string) {
|
||||
func doNewSite(basepath string, force bool) error {
|
||||
dirs := []string{
|
||||
filepath.Join(basepath, "layouts"),
|
||||
filepath.Join(basepath, "content"),
|
||||
filepath.Join(basepath, "archetypes"),
|
||||
filepath.Join(basepath, "static"),
|
||||
filepath.Join(basepath, "data"),
|
||||
filepath.Join(basepath, "themes"),
|
||||
}
|
||||
|
||||
if exists, _ := helpers.Exists(basepath, hugofs.Source()); exists {
|
||||
if isDir, _ := helpers.IsDir(basepath, hugofs.Source()); !isDir {
|
||||
return errors.New(basepath + " already exists but not a directory")
|
||||
}
|
||||
|
||||
isEmpty, _ := helpers.IsEmpty(basepath, hugofs.Source())
|
||||
|
||||
switch {
|
||||
case !isEmpty && !force:
|
||||
return errors.New(basepath + " already exists and is not empty")
|
||||
|
||||
case !isEmpty && force:
|
||||
all := append(dirs, filepath.Join(basepath, "config."+configFormat))
|
||||
for _, path := range all {
|
||||
if exists, _ := helpers.Exists(path, hugofs.Source()); exists {
|
||||
return errors.New(path + " already exists")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, dir := range dirs {
|
||||
hugofs.Source().MkdirAll(dir, 0777)
|
||||
}
|
||||
|
||||
createConfig(basepath, configFormat)
|
||||
|
||||
jww.FEEDBACK.Printf("Congratulations! Your new Hugo site is created in %q.\n\n", basepath)
|
||||
jww.FEEDBACK.Println(`Just a few more steps and you're ready to go:
|
||||
|
||||
1. Download a theme into the same-named folder.
|
||||
Choose a theme from https://themes.gohugo.io/, or
|
||||
create your own with the "hugo new theme <THEMENAME>" command.
|
||||
2. Perhaps you want to add some content. You can add single files
|
||||
with "hugo new <SECTIONNAME>/<FILENAME>.<FORMAT>".
|
||||
3. Start the built-in live server via "hugo server".
|
||||
|
||||
Visit https://gohugo.io/ for quickstart guide and full documentation.`)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewSite creates a new Hugo site and initializes a structured Hugo directory.
|
||||
func NewSite(cmd *cobra.Command, args []string) error {
|
||||
if len(args) < 1 {
|
||||
cmd.Usage()
|
||||
jww.FATAL.Fatalln("path needs to be provided")
|
||||
return newUserError("path needs to be provided")
|
||||
}
|
||||
|
||||
createpath, err := filepath.Abs(filepath.Clean(args[0]))
|
||||
if err != nil {
|
||||
cmd.Usage()
|
||||
jww.FATAL.Fatalln(err)
|
||||
return newUserError(err)
|
||||
}
|
||||
|
||||
if x, _ := helpers.Exists(createpath, hugofs.SourceFs); x {
|
||||
y, _ := helpers.IsDir(createpath, hugofs.SourceFs)
|
||||
if z, _ := helpers.IsEmpty(createpath, hugofs.SourceFs); y && z {
|
||||
jww.INFO.Println(createpath, "already exists and is empty")
|
||||
} else {
|
||||
jww.FATAL.Fatalln(createpath, "already exists and is not empty")
|
||||
}
|
||||
}
|
||||
forceNew, _ := cmd.Flags().GetBool("force")
|
||||
|
||||
mkdir(createpath, "layouts")
|
||||
mkdir(createpath, "content")
|
||||
mkdir(createpath, "archetypes")
|
||||
mkdir(createpath, "static")
|
||||
mkdir(createpath, "data")
|
||||
|
||||
createConfig(createpath, configFormat)
|
||||
return doNewSite(createpath, forceNew)
|
||||
}
|
||||
|
||||
// NewTheme creates a new Hugo theme.
|
||||
func NewTheme(cmd *cobra.Command, args []string) {
|
||||
InitializeConfig()
|
||||
|
||||
if len(args) < 1 {
|
||||
cmd.Usage()
|
||||
jww.FATAL.Fatalln("theme name needs to be provided")
|
||||
func NewTheme(cmd *cobra.Command, args []string) error {
|
||||
if err := InitializeConfig(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
createpath := helpers.AbsPathify(filepath.Join("themes", args[0]))
|
||||
if len(args) < 1 {
|
||||
|
||||
return newUserError("theme name needs to be provided")
|
||||
}
|
||||
|
||||
createpath := helpers.AbsPathify(filepath.Join(viper.GetString("themesDir"), args[0]))
|
||||
jww.INFO.Println("creating theme at", createpath)
|
||||
|
||||
if x, _ := helpers.Exists(createpath, hugofs.SourceFs); x {
|
||||
jww.FATAL.Fatalln(createpath, "already exists")
|
||||
if x, _ := helpers.Exists(createpath, hugofs.Source()); x {
|
||||
return newUserError(createpath, "already exists")
|
||||
}
|
||||
|
||||
mkdir(createpath, "layouts", "_default")
|
||||
mkdir(createpath, "layouts", "partials")
|
||||
|
||||
touchFile(createpath, "layouts", "index.html")
|
||||
touchFile(createpath, "layouts", "404.html")
|
||||
touchFile(createpath, "layouts", "_default", "list.html")
|
||||
touchFile(createpath, "layouts", "_default", "single.html")
|
||||
|
||||
@@ -162,7 +211,13 @@ func NewTheme(cmd *cobra.Command, args []string) {
|
||||
touchFile(createpath, "layouts", "partials", "footer.html")
|
||||
|
||||
mkdir(createpath, "archetypes")
|
||||
touchFile(createpath, "archetypes", "default.md")
|
||||
|
||||
archDefault := []byte("+++\n+++\n")
|
||||
|
||||
err := helpers.WriteToDisk(filepath.Join(createpath, "archetypes", "default.md"), bytes.NewReader(archDefault), hugofs.Source())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mkdir(createpath, "static", "js")
|
||||
mkdir(createpath, "static", "css")
|
||||
@@ -189,12 +244,14 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
`)
|
||||
|
||||
err := helpers.WriteToDisk(filepath.Join(createpath, "LICENSE.md"), bytes.NewReader(by), hugofs.SourceFs)
|
||||
err = helpers.WriteToDisk(filepath.Join(createpath, "LICENSE.md"), bytes.NewReader(by), hugofs.Source())
|
||||
if err != nil {
|
||||
jww.FATAL.Fatalln(err)
|
||||
return err
|
||||
}
|
||||
|
||||
createThemeMD(createpath)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func mkdir(x ...string) {
|
||||
@@ -209,7 +266,7 @@ func mkdir(x ...string) {
|
||||
func touchFile(x ...string) {
|
||||
inpath := filepath.Join(x...)
|
||||
mkdir(filepath.Dir(inpath))
|
||||
err := helpers.WriteToDisk(inpath, bytes.NewReader([]byte{}), hugofs.SourceFs)
|
||||
err := helpers.WriteToDisk(inpath, bytes.NewReader([]byte{}), hugofs.Source())
|
||||
if err != nil {
|
||||
jww.FATAL.Fatalln(err)
|
||||
}
|
||||
@@ -227,7 +284,7 @@ description = ""
|
||||
homepage = "http://siteforthistheme.com/"
|
||||
tags = ["", ""]
|
||||
features = ["", ""]
|
||||
min_version = 0.13
|
||||
min_version = 0.17
|
||||
|
||||
[author]
|
||||
name = ""
|
||||
@@ -240,7 +297,7 @@ min_version = 0.13
|
||||
repo = ""
|
||||
`)
|
||||
|
||||
err = helpers.WriteToDisk(filepath.Join(inpath, "theme.toml"), bytes.NewReader(by), hugofs.SourceFs)
|
||||
err = helpers.WriteToDisk(filepath.Join(inpath, "theme.toml"), bytes.NewReader(by), hugofs.Source())
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -262,7 +319,7 @@ func newContentPathSection(path string) (string, string) {
|
||||
}
|
||||
|
||||
func createConfig(inpath string, kind string) (err error) {
|
||||
in := map[string]string{
|
||||
in := map[string]interface{}{
|
||||
"baseurl": "http://replace-this-with-your-hugo-site.com/",
|
||||
"title": "My New Hugo Site",
|
||||
"languageCode": "en-us",
|
||||
@@ -274,7 +331,7 @@ func createConfig(inpath string, kind string) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
err = helpers.WriteToDisk(filepath.Join(inpath, "config."+kind), bytes.NewReader(by), hugofs.SourceFs)
|
||||
err = helpers.WriteToDisk(filepath.Join(inpath, "config."+kind), bytes.NewReader(by), hugofs.Source())
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
+89
-1
@@ -1,9 +1,25 @@
|
||||
// Copyright 2016 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/hugo/hugofs"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// Issue #1133
|
||||
@@ -12,3 +28,75 @@ func TestNewContentPathSectionWithForwardSlashes(t *testing.T) {
|
||||
assert.Equal(t, filepath.FromSlash("/post/new.md"), p)
|
||||
assert.Equal(t, "post", s)
|
||||
}
|
||||
|
||||
func checkNewSiteInited(basepath string, t *testing.T) {
|
||||
paths := []string{
|
||||
filepath.Join(basepath, "layouts"),
|
||||
filepath.Join(basepath, "content"),
|
||||
filepath.Join(basepath, "archetypes"),
|
||||
filepath.Join(basepath, "static"),
|
||||
filepath.Join(basepath, "data"),
|
||||
filepath.Join(basepath, "config.toml"),
|
||||
}
|
||||
|
||||
for _, path := range paths {
|
||||
_, err := hugofs.Source().Stat(path)
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDoNewSite(t *testing.T) {
|
||||
basepath := filepath.Join(os.TempDir(), "blog")
|
||||
hugofs.InitMemFs()
|
||||
err := doNewSite(basepath, false)
|
||||
assert.Nil(t, err)
|
||||
|
||||
checkNewSiteInited(basepath, t)
|
||||
}
|
||||
|
||||
func TestDoNewSite_noerror_base_exists_but_empty(t *testing.T) {
|
||||
basepath := filepath.Join(os.TempDir(), "blog")
|
||||
hugofs.InitMemFs()
|
||||
hugofs.Source().MkdirAll(basepath, 777)
|
||||
err := doNewSite(basepath, false)
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
|
||||
func TestDoNewSite_error_base_exists(t *testing.T) {
|
||||
basepath := filepath.Join(os.TempDir(), "blog")
|
||||
hugofs.InitMemFs()
|
||||
hugofs.Source().MkdirAll(basepath, 777)
|
||||
hugofs.Source().Create(filepath.Join(basepath, "foo"))
|
||||
// Since the directory already exists and isn't empty, expect an error
|
||||
err := doNewSite(basepath, false)
|
||||
assert.NotNil(t, err)
|
||||
}
|
||||
|
||||
func TestDoNewSite_force_empty_dir(t *testing.T) {
|
||||
basepath := filepath.Join(os.TempDir(), "blog")
|
||||
hugofs.InitMemFs()
|
||||
hugofs.Source().MkdirAll(basepath, 777)
|
||||
err := doNewSite(basepath, true)
|
||||
assert.Nil(t, err)
|
||||
|
||||
checkNewSiteInited(basepath, t)
|
||||
}
|
||||
|
||||
func TestDoNewSite_error_force_dir_inside_exists(t *testing.T) {
|
||||
basepath := filepath.Join(os.TempDir(), "blog")
|
||||
contentPath := filepath.Join(basepath, "content")
|
||||
hugofs.InitMemFs()
|
||||
hugofs.Source().MkdirAll(contentPath, 777)
|
||||
err := doNewSite(basepath, true)
|
||||
assert.NotNil(t, err)
|
||||
}
|
||||
|
||||
func TestDoNewSite_error_force_config_inside_exists(t *testing.T) {
|
||||
basepath := filepath.Join(os.TempDir(), "blog")
|
||||
configPath := filepath.Join(basepath, "config.toml")
|
||||
hugofs.InitMemFs()
|
||||
hugofs.Source().MkdirAll(basepath, 777)
|
||||
hugofs.Source().Create(configPath)
|
||||
err := doNewSite(basepath, true)
|
||||
assert.NotNil(t, err)
|
||||
}
|
||||
|
||||
+136
-54
@@ -1,9 +1,9 @@
|
||||
// Copyright © 2013-14 Steve Francia <spf@spf13.com>.
|
||||
// Copyright 2016 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Simple Public License, Version 2.0 (the "License");
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://opensource.org/licenses/Simple-2.0
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@@ -24,6 +24,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"mime"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/hugo/helpers"
|
||||
@@ -32,38 +34,81 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var serverPort int
|
||||
var serverInterface string
|
||||
var serverWatch bool
|
||||
var serverAppend bool
|
||||
var disableLiveReload bool
|
||||
var (
|
||||
disableLiveReload bool
|
||||
renderToDisk bool
|
||||
serverAppend bool
|
||||
serverInterface string
|
||||
serverPort int
|
||||
serverWatch bool
|
||||
)
|
||||
|
||||
//var serverCmdV *cobra.Command
|
||||
|
||||
var serverCmd = &cobra.Command{
|
||||
Use: "server",
|
||||
Short: "Hugo runs its own webserver to render the files",
|
||||
Long: `Hugo is able to run its own high performance web server.
|
||||
Hugo will render all the files defined in the source directory and
|
||||
serve them up.`,
|
||||
//Run: server,
|
||||
Use: "server",
|
||||
Aliases: []string{"serve"},
|
||||
Short: "A high performance webserver",
|
||||
Long: `Hugo provides its own webserver which builds and serves the site.
|
||||
While hugo server is high performance, it is a webserver with limited options.
|
||||
Many run it in production, but the standard behavior is for people to use it
|
||||
in development and use a more full featured server such as Nginx or Caddy.
|
||||
|
||||
'hugo server' will avoid writing the rendered and served content to disk,
|
||||
preferring to store it in memory.
|
||||
|
||||
By default hugo will also watch your files for any changes you make and
|
||||
automatically rebuild the site. It will then live reload any open browser pages
|
||||
and push the latest content to them. As most Hugo sites are built in a fraction
|
||||
of a second, you will be able to save and see your changes nearly instantly.`,
|
||||
//RunE: server,
|
||||
}
|
||||
|
||||
type filesOnlyFs struct {
|
||||
fs http.FileSystem
|
||||
}
|
||||
|
||||
type noDirFile struct {
|
||||
http.File
|
||||
}
|
||||
|
||||
func (fs filesOnlyFs) Open(name string) (http.File, error) {
|
||||
f, err := fs.fs.Open(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return noDirFile{f}, nil
|
||||
}
|
||||
|
||||
func (f noDirFile) Readdir(count int) ([]os.FileInfo, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
initHugoBuilderFlags(serverCmd)
|
||||
|
||||
serverCmd.Flags().IntVarP(&serverPort, "port", "p", 1313, "port on which the server will listen")
|
||||
serverCmd.Flags().StringVarP(&serverInterface, "bind", "", "127.0.0.1", "interface to which the server will bind")
|
||||
serverCmd.Flags().BoolVarP(&serverWatch, "watch", "w", false, "watch filesystem for changes and recreate as needed")
|
||||
serverCmd.Flags().BoolVarP(&serverWatch, "watch", "w", true, "watch filesystem for changes and recreate as needed")
|
||||
serverCmd.Flags().BoolVarP(&serverAppend, "appendPort", "", true, "append port to baseurl")
|
||||
serverCmd.Flags().BoolVar(&disableLiveReload, "disableLiveReload", false, "watch without enabling live browser reload on rebuild")
|
||||
serverCmd.Flags().BoolVar(&renderToDisk, "renderToDisk", false, "render to Destination path (default is render to memory & serve from there)")
|
||||
serverCmd.Flags().String("memstats", "", "log memory usage to this file")
|
||||
serverCmd.Flags().Int("meminterval", 100, "interval to poll memory usage (requires --memstats)")
|
||||
serverCmd.Run = server
|
||||
serverCmd.Flags().String("meminterval", "100ms", "interval to poll memory usage (requires --memstats), valid time units are \"ns\", \"us\" (or \"µs\"), \"ms\", \"s\", \"m\", \"h\".")
|
||||
|
||||
serverCmd.RunE = server
|
||||
|
||||
mime.AddExtensionType(".json", "application/json; charset=utf-8")
|
||||
mime.AddExtensionType(".css", "text/css; charset=utf-8")
|
||||
|
||||
}
|
||||
|
||||
func server(cmd *cobra.Command, args []string) {
|
||||
InitializeConfig()
|
||||
func server(cmd *cobra.Command, args []string) error {
|
||||
if err := InitializeConfig(serverCmd); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cmd.Flags().Lookup("disableLiveReload").Changed {
|
||||
if flagChanged(cmd.Flags(), "disableLiveReload") {
|
||||
viper.Set("DisableLiveReload", disableLiveReload)
|
||||
}
|
||||
|
||||
@@ -71,24 +116,32 @@ func server(cmd *cobra.Command, args []string) {
|
||||
viper.Set("Watch", true)
|
||||
}
|
||||
|
||||
if viper.GetBool("watch") {
|
||||
serverWatch = true
|
||||
watchConfig()
|
||||
}
|
||||
|
||||
l, err := net.Listen("tcp", net.JoinHostPort(serverInterface, strconv.Itoa(serverPort)))
|
||||
if err == nil {
|
||||
l.Close()
|
||||
} else {
|
||||
if flagChanged(serverCmd.Flags(), "port") {
|
||||
// port set explicitly by user -- he/she probably meant it!
|
||||
return newSystemErrorF("Server startup failed: %s", err)
|
||||
}
|
||||
jww.ERROR.Println("port", serverPort, "already in use, attempting to use an available port")
|
||||
sp, err := helpers.FindAvailablePort()
|
||||
if err != nil {
|
||||
jww.ERROR.Println("Unable to find alternative port to use")
|
||||
jww.ERROR.Fatalln(err)
|
||||
return newSystemError("Unable to find alternative port to use:", err)
|
||||
}
|
||||
serverPort = sp.Port
|
||||
}
|
||||
|
||||
viper.Set("port", serverPort)
|
||||
|
||||
BaseURL, err := fixURL(BaseURL)
|
||||
BaseURL, err := fixURL(baseURL)
|
||||
if err != nil {
|
||||
jww.ERROR.Fatal(err)
|
||||
return err
|
||||
}
|
||||
viper.Set("BaseURL", BaseURL)
|
||||
|
||||
@@ -96,32 +149,55 @@ func server(cmd *cobra.Command, args []string) {
|
||||
jww.ERROR.Println("memstats error:", err)
|
||||
}
|
||||
|
||||
build(serverWatch)
|
||||
// If a Destination is provided via flag write to disk
|
||||
if destination != "" {
|
||||
renderToDisk = true
|
||||
}
|
||||
|
||||
// Hugo writes the output to memory instead of the disk
|
||||
if !renderToDisk {
|
||||
hugofs.SetDestination(new(afero.MemMapFs))
|
||||
// Rendering to memoryFS, publish to Root regardless of publishDir.
|
||||
viper.Set("PublishDir", "/")
|
||||
}
|
||||
|
||||
if err := build(serverWatch); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Watch runs its own server as part of the routine
|
||||
if serverWatch {
|
||||
watched := getDirList()
|
||||
workingDir := helpers.AbsPathify(viper.GetString("WorkingDir"))
|
||||
for i, dir := range watched {
|
||||
watched[i], _ = helpers.GetRelativePath(dir, workingDir)
|
||||
watchDirs := getDirList()
|
||||
baseWatchDir := viper.GetString("WorkingDir")
|
||||
for i, dir := range watchDirs {
|
||||
watchDirs[i], _ = helpers.GetRelativePath(dir, baseWatchDir)
|
||||
}
|
||||
unique := strings.Join(helpers.RemoveSubpaths(watched), ",")
|
||||
|
||||
jww.FEEDBACK.Printf("Watching for changes in %s/{%s}\n", workingDir, unique)
|
||||
rootWatchDirs := strings.Join(helpers.UniqueStrings(helpers.ExtractRootPaths(watchDirs)), ",")
|
||||
|
||||
jww.FEEDBACK.Printf("Watching for changes in %s%s{%s}\n", baseWatchDir, helpers.FilePathSeparator, rootWatchDirs)
|
||||
err := NewWatcher(serverPort)
|
||||
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
serve(serverPort)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func serve(port int) {
|
||||
jww.FEEDBACK.Println("Serving pages from " + helpers.AbsPathify(viper.GetString("PublishDir")))
|
||||
if renderToDisk {
|
||||
jww.FEEDBACK.Println("Serving pages from " + helpers.AbsPathify(viper.GetString("PublishDir")))
|
||||
} else {
|
||||
jww.FEEDBACK.Println("Serving pages from memory")
|
||||
}
|
||||
|
||||
httpFs := &afero.HttpFs{SourceFs: hugofs.DestinationFS}
|
||||
fileserver := http.FileServer(httpFs.Dir(helpers.AbsPathify(viper.GetString("PublishDir"))))
|
||||
httpFs := afero.NewHttpFs(hugofs.Destination())
|
||||
fs := filesOnlyFs{httpFs.Dir(helpers.AbsPathify(viper.GetString("PublishDir")))}
|
||||
fileserver := http.FileServer(fs)
|
||||
|
||||
// We're only interested in the path
|
||||
u, err := url.Parse(viper.GetString("BaseURL"))
|
||||
@@ -134,9 +210,7 @@ func serve(port int) {
|
||||
http.Handle(u.Path, http.StripPrefix(u.Path, fileserver))
|
||||
}
|
||||
|
||||
u.Host = net.JoinHostPort(serverInterface, strconv.Itoa(serverPort))
|
||||
u.Scheme = "http"
|
||||
jww.FEEDBACK.Printf("Web Server is available at %s\n", u.String())
|
||||
jww.FEEDBACK.Printf("Web Server is available at %s (bind address %s)\n", u.String(), serverInterface)
|
||||
fmt.Println("Press Ctrl+C to stop")
|
||||
|
||||
endpoint := net.JoinHostPort(serverInterface, strconv.Itoa(port))
|
||||
@@ -155,37 +229,45 @@ func fixURL(s string) (string, error) {
|
||||
s = viper.GetString("BaseURL")
|
||||
useLocalhost = true
|
||||
}
|
||||
if !strings.HasPrefix(s, "http://") && !strings.HasPrefix(s, "https://") {
|
||||
s = "http://" + s
|
||||
}
|
||||
|
||||
if !strings.HasSuffix(s, "/") {
|
||||
s = s + "/"
|
||||
}
|
||||
|
||||
// do an initial parse of the input string
|
||||
u, err := url.Parse(s)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if serverAppend {
|
||||
if useLocalhost {
|
||||
u.Host = fmt.Sprintf("localhost:%d", serverPort)
|
||||
u.Scheme = "http"
|
||||
return u.String(), nil
|
||||
// if no Host is defined, then assume that no schema or double-slash were
|
||||
// present in the url. Add a double-slash and make a best effort attempt.
|
||||
if u.Host == "" && s != "/" {
|
||||
s = "//" + s
|
||||
|
||||
u, err = url.Parse(s)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
host := u.Host
|
||||
if strings.Contains(host, ":") {
|
||||
host, _, err = net.SplitHostPort(u.Host)
|
||||
}
|
||||
|
||||
if useLocalhost {
|
||||
if u.Scheme == "https" {
|
||||
u.Scheme = "http"
|
||||
}
|
||||
u.Host = "localhost"
|
||||
}
|
||||
|
||||
if serverAppend {
|
||||
if strings.Contains(u.Host, ":") {
|
||||
u.Host, _, err = net.SplitHostPort(u.Host)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Failed to split BaseURL hostpost: %s", err)
|
||||
}
|
||||
}
|
||||
u.Host = fmt.Sprintf("%s:%d", host, serverPort)
|
||||
return u.String(), nil
|
||||
u.Host += fmt.Sprintf(":%d", serverPort)
|
||||
}
|
||||
|
||||
if useLocalhost {
|
||||
u.Host = "localhost"
|
||||
}
|
||||
return u.String(), nil
|
||||
}
|
||||
|
||||
|
||||
+20
-6
@@ -1,3 +1,16 @@
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
@@ -23,19 +36,20 @@ func TestFixURL(t *testing.T) {
|
||||
{"Basic subdir", "", "http://foo.com/bar", true, 1313, "http://localhost:1313/bar/"},
|
||||
{"Basic production", "http://foo.com", "http://foo.com", false, 80, "http://foo.com/"},
|
||||
{"Production subdir", "http://foo.com/bar", "http://foo.com/bar", false, 80, "http://foo.com/bar/"},
|
||||
{"No http", "", "foo.com", true, 1313, "http://localhost:1313/"},
|
||||
{"Override configured port", "", "foo.com:2020", true, 1313, "http://localhost:1313/"},
|
||||
{"No http production", "foo.com", "foo.com", false, 80, "http://foo.com/"},
|
||||
{"No http production with port", "foo.com", "foo.com", true, 2020, "http://foo.com:2020/"},
|
||||
{"No http", "", "foo.com", true, 1313, "//localhost:1313/"},
|
||||
{"Override configured port", "", "foo.com:2020", true, 1313, "//localhost:1313/"},
|
||||
{"No http production", "foo.com", "foo.com", false, 80, "//foo.com/"},
|
||||
{"No http production with port", "foo.com", "foo.com", true, 2020, "//foo.com:2020/"},
|
||||
{"No config", "", "", true, 1313, "//localhost:1313/"},
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
viper.Reset()
|
||||
BaseURL = test.CLIBaseURL
|
||||
baseURL = test.CLIBaseURL
|
||||
viper.Set("BaseURL", test.CfgBaseURL)
|
||||
serverAppend = test.AppendPort
|
||||
serverPort = test.Port
|
||||
result, err := fixURL(BaseURL)
|
||||
result, err := fixURL(baseURL)
|
||||
if err != nil {
|
||||
t.Errorf("Test #%d %s: unexpected error %s", i, test.TestName, err)
|
||||
}
|
||||
|
||||
+29
-29
@@ -1,15 +1,16 @@
|
||||
// Copyright © 2013 Steve Francia <spf@spf13.com>.
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Simple Public License, Version 2.0 (the "License");
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://opensource.org/licenses/Simple-2.0
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
@@ -19,64 +20,63 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/hugo/hugofs"
|
||||
"github.com/spf13/hugo/parser"
|
||||
jww "github.com/spf13/jwalterweatherman"
|
||||
)
|
||||
|
||||
var undraftCmd = &cobra.Command{
|
||||
Use: "undraft path/to/content",
|
||||
Short: "Undraft changes the content's draft status from 'True' to 'False'",
|
||||
Long: `Undraft changes the content's draft status from 'True' to 'False' and updates the date to the current date and time. If the content's draft status is 'False', nothing is done`,
|
||||
Run: Undraft,
|
||||
Long: `Undraft changes the content's draft status from 'True' to 'False'
|
||||
and updates the date to the current date and time.
|
||||
If the content's draft status is 'False', nothing is done.`,
|
||||
RunE: Undraft,
|
||||
}
|
||||
|
||||
// Publish publishes the specified content by setting its draft status
|
||||
// Undraft publishes the specified content by setting its draft status
|
||||
// to false and setting its publish date to now. If the specified content is
|
||||
// not a draft, it will log an error.
|
||||
func Undraft(cmd *cobra.Command, args []string) {
|
||||
InitializeConfig()
|
||||
func Undraft(cmd *cobra.Command, args []string) error {
|
||||
if err := InitializeConfig(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(args) < 1 {
|
||||
cmd.Usage()
|
||||
jww.FATAL.Fatalln("a piece of content needs to be specified")
|
||||
return newUserError("a piece of content needs to be specified")
|
||||
}
|
||||
|
||||
location := args[0]
|
||||
// open the file
|
||||
f, err := os.Open(location)
|
||||
f, err := hugofs.Source().Open(location)
|
||||
if err != nil {
|
||||
jww.ERROR.Print(err)
|
||||
return
|
||||
return err
|
||||
}
|
||||
|
||||
// get the page from file
|
||||
p, err := parser.ReadFrom(f)
|
||||
f.Close()
|
||||
if err != nil {
|
||||
jww.ERROR.Print(err)
|
||||
return
|
||||
return err
|
||||
}
|
||||
|
||||
w, err := undraftContent(p)
|
||||
if err != nil {
|
||||
jww.ERROR.Printf("an error occurred while undrafting %q: %s", location, err)
|
||||
return
|
||||
return newSystemErrorF("an error occurred while undrafting %q: %s", location, err)
|
||||
}
|
||||
|
||||
f, err = os.OpenFile(location, os.O_WRONLY|os.O_TRUNC, 0644)
|
||||
f, err = hugofs.Source().OpenFile(location, os.O_WRONLY|os.O_TRUNC, 0644)
|
||||
if err != nil {
|
||||
jww.ERROR.Printf("%q not be undrafted due to error opening file to save changes: %q\n", location, err)
|
||||
return
|
||||
return newSystemErrorF("%q not be undrafted due to error opening file to save changes: %q\n", location, err)
|
||||
}
|
||||
defer f.Close()
|
||||
_, err = w.WriteTo(f)
|
||||
if err != nil {
|
||||
jww.ERROR.Printf("%q not be undrafted due to save error: %q\n", location, err)
|
||||
return newSystemErrorF("%q not be undrafted due to save error: %q\n", location, err)
|
||||
}
|
||||
return
|
||||
return nil
|
||||
}
|
||||
|
||||
// undraftContent: if the content is a draft, change it's draft status to
|
||||
// undraftContent: if the content is a draft, change its draft status to
|
||||
// 'false' and set the date to time.Now(). If the draft status is already
|
||||
// 'false', don't do anything.
|
||||
func undraftContent(p parser.Page) (bytes.Buffer, error) {
|
||||
@@ -123,15 +123,15 @@ L:
|
||||
|
||||
// get the front matter as bytes and split it into lines
|
||||
var lineEnding []byte
|
||||
fmLines := bytes.Split(fm, parser.UnixEnding)
|
||||
fmLines := bytes.Split(fm, []byte("\n"))
|
||||
if len(fmLines) == 1 { // if the result is only 1 element, try to split on dos line endings
|
||||
fmLines = bytes.Split(fm, parser.DosEnding)
|
||||
fmLines = bytes.Split(fm, []byte("\r\n"))
|
||||
if len(fmLines) == 1 {
|
||||
return buff, fmt.Errorf("unable to split FrontMatter into lines")
|
||||
}
|
||||
lineEnding = append(lineEnding, parser.DosEnding...)
|
||||
lineEnding = append(lineEnding, []byte("\r\n")...)
|
||||
} else {
|
||||
lineEnding = append(lineEnding, parser.UnixEnding...)
|
||||
lineEnding = append(lineEnding, []byte("\n")...)
|
||||
}
|
||||
|
||||
// Write the front matter lines to the buffer, replacing as necessary
|
||||
@@ -151,7 +151,7 @@ L:
|
||||
}
|
||||
|
||||
// append the actual content
|
||||
buff.Write([]byte(p.Content()))
|
||||
buff.Write(p.Content())
|
||||
|
||||
return buff, nil
|
||||
}
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package commands
|
||||
|
||||
// TODO Support Mac Encoding (\r)
|
||||
|
||||
+22
-18
@@ -1,9 +1,9 @@
|
||||
// Copyright © 2013 Steve Francia <spf@spf13.com>.
|
||||
// Copyright 2015 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Simple Public License, Version 2.0 (the "License");
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://opensource.org/licenses/Simple-2.0
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@@ -26,26 +26,30 @@ import (
|
||||
"github.com/spf13/hugo/hugolib"
|
||||
)
|
||||
|
||||
var timeLayout string // the layout for time.Time
|
||||
|
||||
var version = &cobra.Command{
|
||||
var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print the version number of Hugo",
|
||||
Long: `All software has versions. This is Hugo's`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if hugolib.BuildDate == "" {
|
||||
setBuildDate() // set the build date from executable's mdate
|
||||
} else {
|
||||
formatBuildDate() // format the compile time
|
||||
}
|
||||
if hugolib.CommitHash == "" {
|
||||
fmt.Printf("Hugo Static Site Generator v%s BuildDate: %s\n", helpers.HugoVersion(), hugolib.BuildDate)
|
||||
} else {
|
||||
fmt.Printf("Hugo Static Site Generator v%s-%s BuildDate: %s\n", helpers.HugoVersion(), strings.ToUpper(hugolib.CommitHash), hugolib.BuildDate)
|
||||
}
|
||||
Long: `All software has versions. This is Hugo's.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
printHugoVersion()
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
func printHugoVersion() {
|
||||
if hugolib.BuildDate == "" {
|
||||
setBuildDate() // set the build date from executable's mdate
|
||||
} else {
|
||||
formatBuildDate() // format the compile time
|
||||
}
|
||||
if hugolib.CommitHash == "" {
|
||||
fmt.Printf("Hugo Static Site Generator v%s BuildDate: %s\n", helpers.HugoVersion(), hugolib.BuildDate)
|
||||
} else {
|
||||
fmt.Printf("Hugo Static Site Generator v%s-%s BuildDate: %s\n", helpers.HugoVersion(), strings.ToUpper(hugolib.CommitHash), hugolib.BuildDate)
|
||||
}
|
||||
}
|
||||
|
||||
// setBuildDate checks the ModTime of the Hugo executable and returns it as a
|
||||
// formatted string. This assumes that the executable name is Hugo, if it does
|
||||
// not exist, an empty string will be returned. This is only called if the
|
||||
|
||||
+77
-58
@@ -1,9 +1,9 @@
|
||||
// Copyright © 2014 Steve Francia <spf@spf13.com>.
|
||||
// Copyright 2016 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Simple Public License, Version 2.0 (the "License");
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://opensource.org/licenses/Simple-2.0
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@@ -11,11 +11,11 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Package create provides functions to create new content.
|
||||
package create
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
@@ -23,24 +23,26 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/spf13/hugo/helpers"
|
||||
"github.com/spf13/hugo/hugofs"
|
||||
"github.com/spf13/hugo/hugolib"
|
||||
"github.com/spf13/hugo/parser"
|
||||
jww "github.com/spf13/jwalterweatherman"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func NewContent(kind, name string) (err error) {
|
||||
// NewContent creates a new content file in the content directory based upon the
|
||||
// given kind, which is used to lookup an archetype.
|
||||
func NewContent(fs afero.Fs, kind, name string) (err error) {
|
||||
jww.INFO.Println("attempting to create ", name, "of", kind)
|
||||
|
||||
location := FindArchetype(kind)
|
||||
location := FindArchetype(fs, kind)
|
||||
|
||||
var by []byte
|
||||
|
||||
if location != "" {
|
||||
by, err = ioutil.ReadFile(location)
|
||||
by, err = afero.ReadFile(fs, location)
|
||||
if err != nil {
|
||||
jww.ERROR.Println(err)
|
||||
}
|
||||
@@ -53,22 +55,64 @@ func NewContent(kind, name string) (err error) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
metadata, err := psr.Metadata()
|
||||
|
||||
metadata, err := createMetadata(psr, name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
newmetadata, err := cast.ToStringMapE(metadata)
|
||||
if err != nil {
|
||||
jww.ERROR.Println("Error processing archetype file:", location)
|
||||
jww.ERROR.Printf("Error processing archetype file %s: %s\n", location, err)
|
||||
return err
|
||||
}
|
||||
|
||||
for k := range newmetadata {
|
||||
page, err := hugolib.NewPage(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = page.SetSourceMetaData(metadata, parser.FormatToLeadRune(viper.GetString("MetaDataFormat"))); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
page.SetSourceContent(psr.Content())
|
||||
|
||||
if err = page.SafeSaveSourceAs(filepath.Join(viper.GetString("contentDir"), name)); err != nil {
|
||||
return
|
||||
}
|
||||
jww.FEEDBACK.Println(helpers.AbsPathify(filepath.Join(viper.GetString("contentDir"), name)), "created")
|
||||
|
||||
editor := viper.GetString("NewContentEditor")
|
||||
|
||||
if editor != "" {
|
||||
jww.FEEDBACK.Printf("Editing %s with %q ...\n", name, editor)
|
||||
|
||||
cmd := exec.Command(editor, helpers.AbsPathify(path.Join(viper.GetString("contentDir"), name)))
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// createMetadata generates Metadata for a new page based upon the metadata
|
||||
// found in an archetype.
|
||||
func createMetadata(archetype parser.Page, name string) (map[string]interface{}, error) {
|
||||
archMetadata, err := archetype.Metadata()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
metadata, err := cast.ToStringMapE(archMetadata)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for k := range metadata {
|
||||
switch strings.ToLower(k) {
|
||||
case "date":
|
||||
newmetadata[k] = time.Now()
|
||||
metadata[k] = time.Now()
|
||||
case "title":
|
||||
newmetadata[k] = helpers.MakeTitle(helpers.Filename(name))
|
||||
metadata[k] = helpers.MakeTitle(helpers.Filename(name))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,60 +125,35 @@ func NewContent(kind, name string) (err error) {
|
||||
return false
|
||||
}
|
||||
|
||||
if newmetadata == nil {
|
||||
newmetadata = make(map[string]interface{})
|
||||
if metadata == nil {
|
||||
metadata = make(map[string]interface{})
|
||||
}
|
||||
|
||||
if !caseimatch(newmetadata, "date") {
|
||||
newmetadata["date"] = time.Now()
|
||||
if !caseimatch(metadata, "date") {
|
||||
metadata["date"] = time.Now()
|
||||
}
|
||||
|
||||
if !caseimatch(newmetadata, "title") {
|
||||
newmetadata["title"] = helpers.MakeTitle(helpers.Filename(name))
|
||||
}
|
||||
|
||||
page, err := hugolib.NewPage(name)
|
||||
if err != nil {
|
||||
return err
|
||||
if !caseimatch(metadata, "title") {
|
||||
metadata["title"] = helpers.MakeTitle(helpers.Filename(name))
|
||||
}
|
||||
|
||||
if x := parser.FormatSanitize(viper.GetString("MetaDataFormat")); x == "json" || x == "yaml" || x == "toml" {
|
||||
newmetadata["date"] = time.Now().Format(time.RFC3339)
|
||||
metadata["date"] = time.Now().Format(time.RFC3339)
|
||||
}
|
||||
|
||||
//page.Dir = viper.GetString("sourceDir")
|
||||
page.SetSourceMetaData(newmetadata, parser.FormatToLeadRune(viper.GetString("MetaDataFormat")))
|
||||
page.SetSourceContent(psr.Content())
|
||||
if err = page.SafeSaveSourceAs(filepath.Join(viper.GetString("contentDir"), name)); err != nil {
|
||||
return
|
||||
}
|
||||
jww.FEEDBACK.Println(helpers.AbsPathify(filepath.Join(viper.GetString("contentDir"), name)), "created")
|
||||
|
||||
editor := viper.GetString("NewContentEditor")
|
||||
|
||||
if editor != "" {
|
||||
jww.FEEDBACK.Printf("Editing %s in %s.\n", name, editor)
|
||||
|
||||
cmd := exec.Command(editor, path.Join(viper.GetString("contentDir"), name))
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
if err = cmd.Run(); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
return metadata, nil
|
||||
}
|
||||
|
||||
func FindArchetype(kind string) (outpath string) {
|
||||
// FindArchetype takes a given kind/archetype of content and returns an output
|
||||
// path for that archetype. If no archetype is found, an empty string is
|
||||
// returned.
|
||||
func FindArchetype(fs afero.Fs, kind string) (outpath string) {
|
||||
search := []string{helpers.AbsPathify(viper.GetString("archetypeDir"))}
|
||||
|
||||
if viper.GetString("theme") != "" {
|
||||
themeDir := filepath.Join(helpers.AbsPathify("themes/"+viper.GetString("theme")), "/archetypes/")
|
||||
if _, err := os.Stat(themeDir); os.IsNotExist(err) {
|
||||
jww.ERROR.Println("Unable to find archetypes directory for theme :", viper.GetString("theme"), "in", themeDir)
|
||||
themeDir := filepath.Join(helpers.AbsPathify(viper.GetString("themesDir")+"/"+viper.GetString("theme")), "/archetypes/")
|
||||
if _, err := fs.Stat(themeDir); os.IsNotExist(err) {
|
||||
jww.ERROR.Printf("Unable to find archetypes directory for theme %q at %q", viper.GetString("theme"), themeDir)
|
||||
} else {
|
||||
search = append(search, themeDir)
|
||||
}
|
||||
@@ -154,7 +173,7 @@ func FindArchetype(kind string) (outpath string) {
|
||||
for _, p := range pathsToCheck {
|
||||
curpath := filepath.Join(x, p)
|
||||
jww.DEBUG.Println("checking", curpath, "for archetypes")
|
||||
if exists, _ := helpers.Exists(curpath, hugofs.SourceFs); exists {
|
||||
if exists, _ := helpers.Exists(curpath, fs); exists {
|
||||
jww.INFO.Println("curpath: " + curpath)
|
||||
return curpath
|
||||
}
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
// Copyright 2016 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package create_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
"github.com/spf13/hugo/create"
|
||||
"github.com/spf13/hugo/hugofs"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func TestNewContent(t *testing.T) {
|
||||
initViper()
|
||||
|
||||
err := initFs()
|
||||
if err != nil {
|
||||
t.Fatalf("initialization error: %s", err)
|
||||
}
|
||||
|
||||
cases := []struct {
|
||||
kind string
|
||||
path string
|
||||
resultStrings []string
|
||||
}{
|
||||
{"post", "post/sample-1.md", []string{`title = "sample 1"`, `test = "test1"`}},
|
||||
{"stump", "stump/sample-2.md", []string{`title = "sample 2"`}}, // no archetype file
|
||||
{"", "sample-3.md", []string{`title = "sample 3"`}}, // no archetype
|
||||
{"product", "product/sample-4.md", []string{`title = "sample 4"`}}, // empty archetype front matter
|
||||
}
|
||||
|
||||
for i, c := range cases {
|
||||
err = create.NewContent(hugofs.Source(), c.kind, c.path)
|
||||
if err != nil {
|
||||
t.Errorf("[%d] NewContent: %s", i, err)
|
||||
}
|
||||
|
||||
fname := filepath.Join(os.TempDir(), "content", filepath.FromSlash(c.path))
|
||||
_, err = hugofs.Source().Stat(fname)
|
||||
if err != nil {
|
||||
t.Errorf("[%d] Stat: %s", i, err)
|
||||
}
|
||||
|
||||
for _, v := range c.resultStrings {
|
||||
found, err := afero.FileContainsBytes(hugofs.Source(), fname, []byte(v))
|
||||
if err != nil {
|
||||
t.Errorf("[%d] FileContainsBytes: %s", i, err)
|
||||
}
|
||||
if !found {
|
||||
t.Errorf("content missing from output: %q", v)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func initViper() {
|
||||
viper.Reset()
|
||||
viper.Set("MetaDataFormat", "toml")
|
||||
viper.Set("archetypeDir", filepath.Join(os.TempDir(), "archetypes"))
|
||||
viper.Set("contentDir", filepath.Join(os.TempDir(), "content"))
|
||||
viper.Set("themesDir", filepath.Join(os.TempDir(), "themes"))
|
||||
viper.Set("theme", "sample")
|
||||
}
|
||||
|
||||
func initFs() error {
|
||||
hugofs.SetSource(new(afero.MemMapFs))
|
||||
perm := os.FileMode(0755)
|
||||
var err error
|
||||
|
||||
// create directories
|
||||
dirs := []string{
|
||||
"archetypes",
|
||||
"content",
|
||||
filepath.Join("themes", "sample", "archetypes"),
|
||||
}
|
||||
for _, dir := range dirs {
|
||||
dir = filepath.Join(os.TempDir(), dir)
|
||||
err = hugofs.Source().Mkdir(dir, perm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// create files
|
||||
for _, v := range []struct {
|
||||
path string
|
||||
content string
|
||||
}{
|
||||
{
|
||||
path: filepath.Join(os.TempDir(), "archetypes", "post.md"),
|
||||
content: "+++\ndate = \"2015-01-12T19:20:04-07:00\"\ntitle = \"post arch\"\ntest = \"test1\"\n+++\n",
|
||||
},
|
||||
{
|
||||
path: filepath.Join(os.TempDir(), "archetypes", "product.md"),
|
||||
content: "+++\n+++\n",
|
||||
},
|
||||
} {
|
||||
f, err := hugofs.Source().Create(v.path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
_, err = f.Write([]byte(v.content))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
+29
-9
@@ -1,8 +1,13 @@
|
||||
title = "Hugo: A Fast and Flexible Website Generator"
|
||||
baseurl = "http://gohugo.io/"
|
||||
MetaDataFormat = "yaml"
|
||||
pluralizeListTitles = false
|
||||
|
||||
[blackfriday]
|
||||
plainIDAnchors = true
|
||||
|
||||
[params]
|
||||
description = "Documentation of Hugo, a fast and flexible static site generator built with love by spf13 and friends in Go"
|
||||
description = "Documentation of Hugo, a fast and flexible static site generator built with love by spf13, bep and friends in Go"
|
||||
author = "Steve Francia (spf13) and friends"
|
||||
|
||||
[taxonomies]
|
||||
@@ -15,15 +20,20 @@ MetaDataFormat = "yaml"
|
||||
url = "https://github.com/spf13/hugo/releases"
|
||||
weight = -200
|
||||
[[menu.main]]
|
||||
name = "Showcase"
|
||||
name = "Site Showcase"
|
||||
pre = "<i class='fa fa-cubes'></i>"
|
||||
url = "/showcase/"
|
||||
weight = -180
|
||||
[[menu.main]]
|
||||
name = "Theme Showcase"
|
||||
pre = "<i class='fa fa-puzzle-piece'></i>"
|
||||
url = "http://themes.gohugo.io"
|
||||
weight = -170
|
||||
[[menu.main]]
|
||||
name = "Press & Articles"
|
||||
pre = "<i class='fa fa-bullhorn'></i>"
|
||||
url = "/community/press/"
|
||||
weight = -170
|
||||
weight = -160
|
||||
[[menu.main]]
|
||||
name = "Discuss Hugo"
|
||||
pre = "<i class='fa fa-comments'></i>"
|
||||
@@ -39,12 +49,6 @@ MetaDataFormat = "yaml"
|
||||
identifier = "getting started"
|
||||
pre = "<i class='fa fa-road'></i>"
|
||||
weight = -100
|
||||
[[menu.main]]
|
||||
name = "Hugo Commands"
|
||||
identifier = "commands"
|
||||
pre = "<i class='fa fa-space-shuttle'></i>"
|
||||
weight = -95
|
||||
url = "/commands/"
|
||||
[[menu.main]]
|
||||
name = "Content"
|
||||
identifier = "content"
|
||||
@@ -55,6 +59,11 @@ MetaDataFormat = "yaml"
|
||||
identifier = "themes"
|
||||
pre = "<i class='fa fa-desktop'></i>"
|
||||
weight = -85
|
||||
[[menu.main]]
|
||||
parent = "themes"
|
||||
name = "Theme Showcase"
|
||||
url = "http://themes.gohugo.io"
|
||||
weight = -170
|
||||
[[menu.main]]
|
||||
name = "Templates"
|
||||
identifier = "layout"
|
||||
@@ -90,3 +99,14 @@ MetaDataFormat = "yaml"
|
||||
identifier = "troubleshooting"
|
||||
pre = "<i class='fa fa-wrench'></i>"
|
||||
weight = -30
|
||||
[[menu.main]]
|
||||
name = "Tools"
|
||||
url = "/tools/"
|
||||
pre = "<i class='fa fa-cogs'></i>"
|
||||
weight = -25
|
||||
[[menu.main]]
|
||||
name = "Hugo Cmd Reference"
|
||||
identifier = "commands"
|
||||
pre = "<i class='fa fa-space-shuttle'></i>"
|
||||
weight = -20
|
||||
url = "/commands/"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo"
|
||||
slug: hugo
|
||||
url: /commands/hugo/
|
||||
@@ -11,11 +11,12 @@ hugo builds your site
|
||||
### Synopsis
|
||||
|
||||
|
||||
hugo is the main command, used to build your Hugo site.
|
||||
|
||||
Hugo is a Fast and Flexible Static Site Generator built with love by spf13 and friends in Go.
|
||||
hugo is the main command, used to build your Hugo site.
|
||||
|
||||
Complete documentation is available at http://gohugo.io
|
||||
Hugo is a Fast and Flexible Static Site Generator
|
||||
built with love by spf13 and friends in Go.
|
||||
|
||||
Complete documentation is available at http://gohugo.io/.
|
||||
|
||||
```
|
||||
hugo
|
||||
@@ -24,42 +25,50 @@ hugo
|
||||
### Options
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
-h, --help=false: help for hugo
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
--noTimes=false: Don't sync modification time of files
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
-w, --watch=false: watch filesystem for changes and recreate as needed
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. http://spf13.com/
|
||||
-D, --buildDrafts include content marked as draft
|
||||
-E, --buildExpired include expired content
|
||||
-F, --buildFuture include content with publishdate in the future
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--canonifyURLs if true, all relative URLs will be canonicalized using baseURL
|
||||
--cleanDestinationDir Remove files from destination not found in static directories
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-d, --destination string filesystem path to write files to
|
||||
--disable404 Do not render 404 page
|
||||
--disableRSS Do not build RSS files
|
||||
--disableSitemap Do not build Sitemap file
|
||||
--forceSyncStatic Copy all files when static is changed.
|
||||
--i18n-warnings Print missing translations
|
||||
--ignoreCache Ignores the cache directory
|
||||
-l, --layoutDir string filesystem path to layout directory
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
--noTimes Don't sync modification time of files
|
||||
--pluralizeListTitles Pluralize titles in lists using inflect (default true)
|
||||
--preserveTaxonomyNames Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
|
||||
--renderToMemory render to memory (only useful for benchmark testing)
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--stepAnalysis display memory and timing of different steps of the program
|
||||
-t, --theme string theme to use (located in /themes/THEMENAME/)
|
||||
--uglyURLs if true, use /filename.html instead of /filename/
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
-w, --watch watch filesystem for changes and recreate as needed
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo benchmark](/commands/hugo_benchmark/) - Benchmark hugo by building a site a number of times
|
||||
* [hugo benchmark](/commands/hugo_benchmark/) - Benchmark Hugo by building a site a number of times.
|
||||
* [hugo check](/commands/hugo_check/) - Check content in the source directory
|
||||
* [hugo config](/commands/hugo_config/) - Print the site configuration
|
||||
* [hugo convert](/commands/hugo_convert/) - Convert will modify your content to different formats
|
||||
* [hugo genautocomplete](/commands/hugo_genautocomplete/) - Generate shell autocompletion script for Hugo
|
||||
* [hugo gendoc](/commands/hugo_gendoc/) - Generate Markdown documentation for the Hugo CLI.
|
||||
* [hugo help](/commands/hugo_help/) - Help about any command
|
||||
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
|
||||
* [hugo env](/commands/hugo_env/) - Print Hugo version and environment info
|
||||
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
|
||||
* [hugo import](/commands/hugo_import/) - Import your site from others.
|
||||
* [hugo list](/commands/hugo_list/) - Listing out various types of content
|
||||
* [hugo new](/commands/hugo_new/) - Create new content for your site
|
||||
* [hugo server](/commands/hugo_server/) - Hugo runs its own webserver to render the files
|
||||
* [hugo server](/commands/hugo_server/) - A high performance webserver
|
||||
* [hugo undraft](/commands/hugo_undraft/) - Undraft changes the content's draft status from 'True' to 'False'
|
||||
* [hugo version](/commands/hugo_version/) - Print the version number of Hugo
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.802527731 +0000 UTC
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo benchmark"
|
||||
slug: hugo_benchmark
|
||||
url: /commands/hugo_benchmark/
|
||||
---
|
||||
## hugo benchmark
|
||||
|
||||
Benchmark hugo by building a site a number of times
|
||||
Benchmark Hugo by building a site a number of times.
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Hugo can build a site many times over and analyze the
|
||||
running process creating a benchmark.
|
||||
Hugo can build a site many times over and analyze the running process
|
||||
creating a benchmark.
|
||||
|
||||
```
|
||||
hugo benchmark
|
||||
@@ -21,37 +21,46 @@ hugo benchmark
|
||||
### Options
|
||||
|
||||
```
|
||||
-n, --count=13: number of times to build the site
|
||||
--cpuprofile="": path/filename for the CPU profile file
|
||||
-h, --help=false: help for benchmark
|
||||
--memprofile="": path/filename for the memory profile file
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. http://spf13.com/
|
||||
-D, --buildDrafts include content marked as draft
|
||||
-E, --buildExpired include expired content
|
||||
-F, --buildFuture include content with publishdate in the future
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--canonifyURLs if true, all relative URLs will be canonicalized using baseURL
|
||||
--cleanDestinationDir Remove files from destination not found in static directories
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-n, --count int number of times to build the site (default 13)
|
||||
--cpuprofile string path/filename for the CPU profile file
|
||||
-d, --destination string filesystem path to write files to
|
||||
--disable404 Do not render 404 page
|
||||
--disableRSS Do not build RSS files
|
||||
--disableSitemap Do not build Sitemap file
|
||||
--forceSyncStatic Copy all files when static is changed.
|
||||
--i18n-warnings Print missing translations
|
||||
--ignoreCache Ignores the cache directory
|
||||
-l, --layoutDir string filesystem path to layout directory
|
||||
--memprofile string path/filename for the memory profile file
|
||||
--noTimes Don't sync modification time of files
|
||||
--pluralizeListTitles Pluralize titles in lists using inflect (default true)
|
||||
--preserveTaxonomyNames Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
|
||||
--renderToMemory render to memory (only useful for benchmark testing)
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--stepAnalysis display memory and timing of different steps of the program
|
||||
-t, --theme string theme to use (located in /themes/THEMENAME/)
|
||||
--uglyURLs if true, use /filename.html instead of /filename/
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.80030401 +0000 UTC
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo check"
|
||||
slug: hugo_check
|
||||
url: /commands/hugo_check/
|
||||
@@ -11,8 +11,8 @@ Check content in the source directory
|
||||
### Synopsis
|
||||
|
||||
|
||||
Hugo will perform some basic analysis on the
|
||||
content provided and will give feedback.
|
||||
Hugo will perform some basic analysis on the content provided
|
||||
and will give feedback.
|
||||
|
||||
```
|
||||
hugo check
|
||||
@@ -21,34 +21,43 @@ hugo check
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help=false: help for check
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. http://spf13.com/
|
||||
-D, --buildDrafts include content marked as draft
|
||||
-E, --buildExpired include expired content
|
||||
-F, --buildFuture include content with publishdate in the future
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--canonifyURLs if true, all relative URLs will be canonicalized using baseURL
|
||||
--cleanDestinationDir Remove files from destination not found in static directories
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-d, --destination string filesystem path to write files to
|
||||
--disable404 Do not render 404 page
|
||||
--disableRSS Do not build RSS files
|
||||
--disableSitemap Do not build Sitemap file
|
||||
--forceSyncStatic Copy all files when static is changed.
|
||||
--i18n-warnings Print missing translations
|
||||
--ignoreCache Ignores the cache directory
|
||||
-l, --layoutDir string filesystem path to layout directory
|
||||
--noTimes Don't sync modification time of files
|
||||
--pluralizeListTitles Pluralize titles in lists using inflect (default true)
|
||||
--preserveTaxonomyNames Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--stepAnalysis display memory and timing of different steps of the program
|
||||
-t, --theme string theme to use (located in /themes/THEMENAME/)
|
||||
--uglyURLs if true, use /filename.html instead of /filename/
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
* [hugo check ulimit](/commands/hugo_check_ulimit/) - Check system ulimit settings
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.800150805 +0000 UTC
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
---
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo check ulimit"
|
||||
slug: hugo_check_ulimit
|
||||
url: /commands/hugo_check_ulimit/
|
||||
---
|
||||
## hugo check ulimit
|
||||
|
||||
Check system ulimit settings
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Hugo will inspect the current ulimit settings on the system.
|
||||
This is primarily to ensure that Hugo can watch enough files on some OSs
|
||||
|
||||
```
|
||||
hugo check ulimit
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo check](/commands/hugo_check/) - Check content in the source directory
|
||||
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo config"
|
||||
slug: hugo_config
|
||||
url: /commands/hugo_config/
|
||||
@@ -11,43 +11,23 @@ Print the site configuration
|
||||
### Synopsis
|
||||
|
||||
|
||||
Print the site configuration, both default and custom settings
|
||||
Print the site configuration, both default and custom settings.
|
||||
|
||||
```
|
||||
hugo config
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help=false: help for config
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.800015664 +0000 UTC
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
|
||||
@@ -1,48 +1,36 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo convert"
|
||||
slug: hugo_convert
|
||||
url: /commands/hugo_convert/
|
||||
---
|
||||
## hugo convert
|
||||
|
||||
Convert will modify your content to different formats
|
||||
Convert your content to different formats
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Convert will modify your content to different formats
|
||||
Convert your content (e.g. front matter) to different formats.
|
||||
|
||||
See convert's subcommands toJSON, toTOML and toYAML for more information.
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help=false: help for convert
|
||||
-o, --output="": filesystem path to write files to
|
||||
--unsafe=false: enable less safe operations, please backup first
|
||||
-o, --output string filesystem path to write files to
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--unsafe enable less safe operations, please backup first
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
@@ -51,4 +39,4 @@ Convert will modify your content to different formats
|
||||
* [hugo convert toTOML](/commands/hugo_convert_totoml/) - Convert front matter to TOML
|
||||
* [hugo convert toYAML](/commands/hugo_convert_toyaml/) - Convert front matter to YAML
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.800919 +0000 UTC
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo convert toJSON"
|
||||
slug: hugo_convert_toJSON
|
||||
url: /commands/hugo_convert_tojson/
|
||||
@@ -11,46 +11,27 @@ Convert front matter to JSON
|
||||
### Synopsis
|
||||
|
||||
|
||||
toJSON will convert all front matter in the content
|
||||
directory to use JSON for the front matter
|
||||
toJSON converts all front matter in the content directory
|
||||
to use JSON for the front matter.
|
||||
|
||||
```
|
||||
hugo convert toJSON
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help=false: help for toJSON
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
-o, --output="": filesystem path to write files to
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
--unsafe=false: enable less safe operations, please backup first
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-o, --output string filesystem path to write files to
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--unsafe enable less safe operations, please backup first
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo convert](/commands/hugo_convert/) - Convert will modify your content to different formats
|
||||
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.800453812 +0000 UTC
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo convert toTOML"
|
||||
slug: hugo_convert_toTOML
|
||||
url: /commands/hugo_convert_totoml/
|
||||
@@ -11,46 +11,27 @@ Convert front matter to TOML
|
||||
### Synopsis
|
||||
|
||||
|
||||
toTOML will convert all front matter in the content
|
||||
directory to use TOML for the front matter
|
||||
toTOML converts all front matter in the content directory
|
||||
to use TOML for the front matter.
|
||||
|
||||
```
|
||||
hugo convert toTOML
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help=false: help for toTOML
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
-o, --output="": filesystem path to write files to
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
--unsafe=false: enable less safe operations, please backup first
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-o, --output string filesystem path to write files to
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--unsafe enable less safe operations, please backup first
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo convert](/commands/hugo_convert/) - Convert will modify your content to different formats
|
||||
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.800610431 +0000 UTC
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo convert toYAML"
|
||||
slug: hugo_convert_toYAML
|
||||
url: /commands/hugo_convert_toyaml/
|
||||
@@ -11,46 +11,27 @@ Convert front matter to YAML
|
||||
### Synopsis
|
||||
|
||||
|
||||
toYAML will convert all front matter in the content
|
||||
directory to use YAML for the front matter
|
||||
toYAML converts all front matter in the content directory
|
||||
to use YAML for the front matter.
|
||||
|
||||
```
|
||||
hugo convert toYAML
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help=false: help for toYAML
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
-o, --output="": filesystem path to write files to
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
--unsafe=false: enable less safe operations, please backup first
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-o, --output string filesystem path to write files to
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--unsafe enable less safe operations, please backup first
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo convert](/commands/hugo_convert/) - Convert will modify your content to different formats
|
||||
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.800758702 +0000 UTC
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
---
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo env"
|
||||
slug: hugo_env
|
||||
url: /commands/hugo_env/
|
||||
---
|
||||
## hugo env
|
||||
|
||||
Print Hugo version and environment info
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Print Hugo version and environment info. This is useful in Hugo bug reports.
|
||||
|
||||
```
|
||||
hugo env
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo gen"
|
||||
slug: hugo_gen
|
||||
url: /commands/hugo_gen/
|
||||
---
|
||||
## hugo gen
|
||||
|
||||
A collection of several useful generators.
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
A collection of several useful generators.
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
* [hugo gen autocomplete](/commands/hugo_gen_autocomplete/) - Generate shell autocompletion script for Hugo
|
||||
* [hugo gen doc](/commands/hugo_gen_doc/) - Generate Markdown documentation for the Hugo CLI.
|
||||
* [hugo gen man](/commands/hugo_gen_man/) - Generate man pages for the Hugo CLI
|
||||
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo gen autocomplete"
|
||||
slug: hugo_gen_autocomplete
|
||||
url: /commands/hugo_gen_autocomplete/
|
||||
---
|
||||
## hugo gen autocomplete
|
||||
|
||||
Generate shell autocompletion script for Hugo
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Generates a shell autocompletion script for Hugo.
|
||||
|
||||
NOTE: The current version supports Bash only.
|
||||
This should work for *nix systems with Bash installed.
|
||||
|
||||
By default, the file is written directly to /etc/bash_completion.d
|
||||
for convenience, and the command may need superuser rights, e.g.:
|
||||
|
||||
$ sudo hugo gen autocomplete
|
||||
|
||||
Add `--completionfile=/path/to/file` flag to set alternative
|
||||
file-path and name.
|
||||
|
||||
Logout and in again to reload the completion scripts,
|
||||
or just source them in directly:
|
||||
|
||||
$ . /etc/bash_completion
|
||||
|
||||
```
|
||||
hugo gen autocomplete
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
--completionfile string Autocompletion file (default "/etc/bash_completion.d/hugo.sh")
|
||||
--type string Autocompletion type (currently only bash supported) (default "bash")
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
|
||||
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo gen doc"
|
||||
slug: hugo_gen_doc
|
||||
url: /commands/hugo_gen_doc/
|
||||
---
|
||||
## hugo gen doc
|
||||
|
||||
Generate Markdown documentation for the Hugo CLI.
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Generate Markdown documentation for the Hugo CLI.
|
||||
|
||||
This command is, mostly, used to create up-to-date documentation
|
||||
of Hugo's command-line interface for http://gohugo.io/.
|
||||
|
||||
It creates one Markdown file per command with front matter suitable
|
||||
for rendering in Hugo.
|
||||
|
||||
```
|
||||
hugo gen doc
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
--dir string the directory to write the doc. (default "/tmp/hugodoc/")
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
|
||||
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo gen man"
|
||||
slug: hugo_gen_man
|
||||
url: /commands/hugo_gen_man/
|
||||
---
|
||||
## hugo gen man
|
||||
|
||||
Generate man pages for the Hugo CLI
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
This command automatically generates up-to-date man pages of Hugo's
|
||||
command-line interface. By default, it creates the man page files
|
||||
in the "man" directory under the current directory.
|
||||
|
||||
```
|
||||
hugo gen man
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
--dir string the directory to write the man pages. (default "man/")
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
|
||||
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
@@ -1,68 +0,0 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
title: "hugo genautocomplete"
|
||||
slug: hugo_genautocomplete
|
||||
url: /commands/hugo_genautocomplete/
|
||||
---
|
||||
## hugo genautocomplete
|
||||
|
||||
Generate shell autocompletion script for Hugo
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Generates a shell autocompletion script for Hugo.
|
||||
|
||||
NOTE: The current version supports Bash only. This should work for *nix systems with Bash installed.
|
||||
|
||||
By default the file is written directly to /etc/bash_completion.d for convenience and the command may need superuser rights, e.g:
|
||||
|
||||
sudo hugo genautocomplete
|
||||
|
||||
Add --completionfile=/path/to/file flag to set alternative file-path and name.
|
||||
|
||||
Logout and in again to reload the completion scripts or just source them in directly:
|
||||
|
||||
. /etc/bash_completion
|
||||
|
||||
|
||||
```
|
||||
hugo genautocomplete
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
--completionfile="/etc/bash_completion.d/hugo.sh": Autocompletion file
|
||||
-h, --help=false: help for genautocomplete
|
||||
--type="bash": Autocompletion type (currently only bash supported)
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.802059052 +0000 UTC
|
||||
@@ -1,59 +0,0 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
title: "hugo gendoc"
|
||||
slug: hugo_gendoc
|
||||
url: /commands/hugo_gendoc/
|
||||
---
|
||||
## hugo gendoc
|
||||
|
||||
Generate Markdown documentation for the Hugo CLI.
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Generate Markdown documentation for the Hugo CLI.
|
||||
|
||||
This command is, mostly, used to create up-to-date documentation for gohugo.io.
|
||||
|
||||
It creates one Markdown file per command with front matter suitable for rendering in Hugo.
|
||||
|
||||
|
||||
```
|
||||
hugo gendoc
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
--dir="/tmp/hugodoc/": the directory to write the doc.
|
||||
-h, --help=false: help for gendoc
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.802209793 +0000 UTC
|
||||
@@ -1,54 +0,0 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
title: "hugo help"
|
||||
slug: hugo_help
|
||||
url: /commands/hugo_help/
|
||||
---
|
||||
## hugo help
|
||||
|
||||
Help about any command
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Help provides help for any command in the application.
|
||||
Simply type hugo help [path to command] for full details.
|
||||
|
||||
```
|
||||
hugo help [command]
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help=false: help for help
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.802371739 +0000 UTC
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo import"
|
||||
slug: hugo_import
|
||||
url: /commands/hugo_import/
|
||||
---
|
||||
## hugo import
|
||||
|
||||
Import your site from others.
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Import your site from other web site generators like Jekyll.
|
||||
|
||||
Import requires a subcommand, e.g. `hugo import jekyll jekyll_root_path target_path`.
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
* [hugo import jekyll](/commands/hugo_import_jekyll/) - hugo import from Jekyll
|
||||
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo import jekyll"
|
||||
slug: hugo_import_jekyll
|
||||
url: /commands/hugo_import_jekyll/
|
||||
---
|
||||
## hugo import jekyll
|
||||
|
||||
hugo import from Jekyll
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
hugo import from Jekyll.
|
||||
|
||||
Import from Jekyll requires two paths, e.g. `hugo import jekyll jekyll_root_path target_path`.
|
||||
|
||||
```
|
||||
hugo import jekyll
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
--force Allow import into non-empty target directory
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo import](/commands/hugo_import/) - Import your site from others.
|
||||
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo list"
|
||||
slug: hugo_list
|
||||
url: /commands/hugo_list/
|
||||
@@ -11,41 +11,30 @@ Listing out various types of content
|
||||
### Synopsis
|
||||
|
||||
|
||||
Listing out various types of content. List requires a subcommand, eg. hugo list drafts
|
||||
Listing out various types of content.
|
||||
|
||||
List requires a subcommand, e.g. `hugo list drafts`.
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help=false: help for list
|
||||
-s, --source string filesystem path to read files relative from
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
* [hugo list drafts](/commands/hugo_list_drafts/) - List all drafts
|
||||
* [hugo list expired](/commands/hugo_list_expired/) - List all posts already expired
|
||||
* [hugo list future](/commands/hugo_list_future/) - List all posts dated in the future
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.801756747 +0000 UTC
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo list drafts"
|
||||
slug: hugo_list_drafts
|
||||
url: /commands/hugo_list_drafts/
|
||||
@@ -11,43 +11,24 @@ List all drafts
|
||||
### Synopsis
|
||||
|
||||
|
||||
List all of the drafts in your content directory
|
||||
List all of the drafts in your content directory.
|
||||
|
||||
```
|
||||
hugo list drafts
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help=false: help for drafts
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-s, --source string filesystem path to read files relative from
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo list](/commands/hugo_list/) - Listing out various types of content
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.801489239 +0000 UTC
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo list expired"
|
||||
slug: hugo_list_expired
|
||||
url: /commands/hugo_list_expired/
|
||||
---
|
||||
## hugo list expired
|
||||
|
||||
List all posts already expired
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
List all of the posts in your content directory which has already
|
||||
expired.
|
||||
|
||||
```
|
||||
hugo list expired
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-s, --source string filesystem path to read files relative from
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo list](/commands/hugo_list/) - Listing out various types of content
|
||||
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo list future"
|
||||
slug: hugo_list_future
|
||||
url: /commands/hugo_list_future/
|
||||
@@ -11,43 +11,25 @@ List all posts dated in the future
|
||||
### Synopsis
|
||||
|
||||
|
||||
List all of the posts in your content directory who will be posted in the future
|
||||
List all of the posts in your content directory which will be
|
||||
posted in the future.
|
||||
|
||||
```
|
||||
hugo list future
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help=false: help for future
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-s, --source string filesystem path to read files relative from
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo list](/commands/hugo_list/) - Listing out various types of content
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.801618973 +0000 UTC
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo new"
|
||||
slug: hugo_new
|
||||
url: /commands/hugo_new/
|
||||
@@ -13,9 +13,10 @@ Create new content for your site
|
||||
|
||||
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.
|
||||
|
||||
You can also specify the kind with `-k KIND`.
|
||||
|
||||
If archetypes are provided in your theme or site, they will be used.
|
||||
|
||||
```
|
||||
hugo new [path]
|
||||
@@ -24,33 +25,20 @@ hugo new [path]
|
||||
### Options
|
||||
|
||||
```
|
||||
-f, --format="toml": frontmatter format
|
||||
-h, --help=false: help for new
|
||||
-k, --kind="": Content type to create
|
||||
--editor string edit new content with this editor, if provided
|
||||
-f, --format string frontmatter format (default "toml")
|
||||
-k, --kind string Content type to create
|
||||
-s, --source string filesystem path to read files relative from
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
@@ -58,4 +46,4 @@ hugo new [path]
|
||||
* [hugo new site](/commands/hugo_new_site/) - Create a new site (skeleton)
|
||||
* [hugo new theme](/commands/hugo_new_theme/) - Create a new theme
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.80134962 +0000 UTC
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo new site"
|
||||
slug: hugo_new_site
|
||||
url: /commands/hugo_new_site/
|
||||
@@ -13,8 +13,7 @@ Create a new site (skeleton)
|
||||
|
||||
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.
|
||||
|
||||
Use `hugo new [contentPath]` to create new content.
|
||||
|
||||
```
|
||||
hugo new site [path]
|
||||
@@ -23,35 +22,22 @@ hugo new site [path]
|
||||
### Options
|
||||
|
||||
```
|
||||
-f, --format="toml": config & frontmatter format
|
||||
-h, --help=false: help for site
|
||||
--force Init inside non-empty directory
|
||||
-f, --format string config & frontmatter format (default "toml")
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-s, --source string filesystem path to read files relative from
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo new](/commands/hugo_new/) - Create new content for your site
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.80106191 +0000 UTC
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo new theme"
|
||||
slug: hugo_new_theme
|
||||
url: /commands/hugo_new_theme/
|
||||
@@ -15,43 +15,23 @@ Create a new theme (skeleton) called [name] in the current directory.
|
||||
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
|
||||
as you see fit.
|
||||
|
||||
|
||||
```
|
||||
hugo new theme [name]
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help=false: help for theme
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-s, --source string filesystem path to read files relative from
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo new](/commands/hugo_new/) - Create new content for your site
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.801202688 +0000 UTC
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
|
||||
@@ -1,19 +1,28 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo server"
|
||||
slug: hugo_server
|
||||
url: /commands/hugo_server/
|
||||
---
|
||||
## hugo server
|
||||
|
||||
Hugo runs its own webserver to render the files
|
||||
A high performance webserver
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Hugo is able to run its own high performance web server.
|
||||
Hugo will render all the files defined in the source directory and
|
||||
serve them up.
|
||||
Hugo provides its own webserver which builds and serves the site.
|
||||
While hugo server is high performance, it is a webserver with limited options.
|
||||
Many run it in production, but the standard behavior is for people to use it
|
||||
in development and use a more full featured server such as Nginx or Caddy.
|
||||
|
||||
'hugo server' will avoid writing the rendered and served content to disk,
|
||||
preferring to store it in memory.
|
||||
|
||||
By default hugo will also watch your files for any changes you make and
|
||||
automatically rebuild the site. It will then live reload any open browser pages
|
||||
and push the latest content to them. As most Hugo sites are built in a fraction
|
||||
of a second, you will be able to save and see your changes nearly instantly.
|
||||
|
||||
```
|
||||
hugo server
|
||||
@@ -22,41 +31,50 @@ hugo server
|
||||
### Options
|
||||
|
||||
```
|
||||
--appendPort=true: append port to baseurl
|
||||
--bind="127.0.0.1": interface to which the server will bind
|
||||
--disableLiveReload=false: watch without enabling live browser reload on rebuild
|
||||
-h, --help=false: help for server
|
||||
--meminterval=100: interval to poll memory usage (requires --memstats)
|
||||
--memstats="": log memory usage to this file
|
||||
-p, --port=1313: port on which the server will listen
|
||||
-w, --watch=false: watch filesystem for changes and recreate as needed
|
||||
--appendPort append port to baseurl (default true)
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. http://spf13.com/
|
||||
--bind string interface to which the server will bind (default "127.0.0.1")
|
||||
-D, --buildDrafts include content marked as draft
|
||||
-E, --buildExpired include expired content
|
||||
-F, --buildFuture include content with publishdate in the future
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--canonifyURLs if true, all relative URLs will be canonicalized using baseURL
|
||||
--cleanDestinationDir Remove files from destination not found in static directories
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-d, --destination string filesystem path to write files to
|
||||
--disable404 Do not render 404 page
|
||||
--disableLiveReload watch without enabling live browser reload on rebuild
|
||||
--disableRSS Do not build RSS files
|
||||
--disableSitemap Do not build Sitemap file
|
||||
--forceSyncStatic Copy all files when static is changed.
|
||||
--i18n-warnings Print missing translations
|
||||
--ignoreCache Ignores the cache directory
|
||||
-l, --layoutDir string filesystem path to layout directory
|
||||
--meminterval string interval to poll memory usage (requires --memstats), valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". (default "100ms")
|
||||
--memstats string log memory usage to this file
|
||||
--noTimes Don't sync modification time of files
|
||||
--pluralizeListTitles Pluralize titles in lists using inflect (default true)
|
||||
-p, --port int port on which the server will listen (default 1313)
|
||||
--preserveTaxonomyNames Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
|
||||
--renderToDisk render to Destination path (default is render to memory & serve from there)
|
||||
-s, --source string filesystem path to read files relative from
|
||||
--stepAnalysis display memory and timing of different steps of the program
|
||||
-t, --theme string theme to use (located in /themes/THEMENAME/)
|
||||
--uglyURLs if true, use /filename.html instead of /filename/
|
||||
-w, --watch watch filesystem for changes and recreate as needed (default true)
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.799665309 +0000 UTC
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo undraft"
|
||||
slug: hugo_undraft
|
||||
url: /commands/hugo_undraft/
|
||||
@@ -11,43 +11,25 @@ Undraft changes the content's draft status from 'True' to 'False'
|
||||
### Synopsis
|
||||
|
||||
|
||||
Undraft changes the content's draft status from 'True' to 'False' and updates the date to the current date and time. If the content's draft status is 'False', nothing is done
|
||||
Undraft changes the content's draft status from 'True' to 'False'
|
||||
and updates the date to the current date and time.
|
||||
If the content's draft status is 'False', nothing is done.
|
||||
|
||||
```
|
||||
hugo undraft path/to/content
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help=false: help for undraft
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.801883978 +0000 UTC
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2015-05-21T20:03:19+02:00
|
||||
date: 2016-10-05T10:21:48+02:00
|
||||
title: "hugo version"
|
||||
slug: hugo_version
|
||||
url: /commands/hugo_version/
|
||||
@@ -11,43 +11,23 @@ Print the version number of Hugo
|
||||
### Synopsis
|
||||
|
||||
|
||||
All software has versions. This is Hugo's
|
||||
All software has versions. This is Hugo's.
|
||||
|
||||
```
|
||||
hugo version
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help=false: help for version
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
|
||||
-D, --buildDrafts=false: include content marked as draft
|
||||
-F, --buildFuture=false: include content with publishdate in the future
|
||||
--cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
|
||||
--config="": config file (default is path/config.yaml|json|toml)
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS=false: Do not build RSS files
|
||||
--disableSitemap=false: Do not build Sitemap file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache=false: Ignores the cache directory for reading but still writes to it
|
||||
--log=false: Enable Logging
|
||||
--logFile="": Log File path (if set, logging enabled automatically)
|
||||
--pluralizeListTitles=true: Pluralize titles in lists using inflect
|
||||
-s, --source="": filesystem path to read files relative from
|
||||
--stepAnalysis=false: display memory and timing of different steps of the program
|
||||
-t, --theme="": theme to use (located in /themes/THEMENAME/)
|
||||
--uglyUrls=false: if true, use /filename.html instead of /filename/
|
||||
-v, --verbose=false: verbose output
|
||||
--verboseLog=false: verbose logging
|
||||
--config string config file (default is path/config.yaml|json|toml)
|
||||
--log Enable Logging
|
||||
--logFile string Log File path (if set, logging enabled automatically)
|
||||
-v, --verbose verbose output
|
||||
--verboseLog verbose logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [hugo](/commands/hugo/) - hugo builds your site
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-21 18:03:19.799870429 +0000 UTC
|
||||
###### Auto generated by spf13/cobra on 5-Oct-2016
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
aliases:
|
||||
- /doc/contributing/
|
||||
- /meta/contributing/
|
||||
lastmod: 2015-02-12
|
||||
date: 2013-07-01
|
||||
menu:
|
||||
main:
|
||||
@@ -12,9 +13,7 @@ title: Contributing to Hugo
|
||||
weight: 30
|
||||
---
|
||||
|
||||
All contributions to Hugo are welcome. Whether you want to scratch an itch, or simply contribute to the project, feel free to pick something from the roadmap
|
||||
or contact [spf13](http://spf13.com/) about what may make sense
|
||||
to do next.
|
||||
All contributions to Hugo are welcome. Whether you want to scratch an itch, or simply contribute to the project, feel free to pick something from the [roadmap]({{< relref "meta/roadmap.md" >}}) or contact [spf13](http://spf13.com/) about what may make sense to do next.
|
||||
|
||||
You should fork the project and make your changes. *We encourage pull requests to discuss code changes.*
|
||||
|
||||
@@ -28,15 +27,7 @@ When you're ready to create a pull request, be sure to:
|
||||
|
||||
## Contribution Overview
|
||||
|
||||
1. Fork Hugo from https://github.com/spf13/hugo
|
||||
2. Create your feature branch (`git checkout -b my-new-feature`)
|
||||
3. Commit your changes (`git commit -am 'Add some feature'`)
|
||||
4. Commit passing tests to validate changes.
|
||||
5. Run `go fmt`
|
||||
6. Squash commits into a single (or logically grouped) commits (`git rebase -i`)
|
||||
7. Push to the branch (`git push origin my-new-feature`)
|
||||
8. Create new Pull Request
|
||||
|
||||
We wrote a [detailed guide]({{< relref "tutorials/how-to-contribute-to-hugo.md" >}}) for newcomers that guides you step by step to your first contribution. If you are more experienced read on. You probably know what to do.
|
||||
|
||||
# Building from source
|
||||
|
||||
@@ -65,3 +56,55 @@ of the following paths:
|
||||
go build -o hugo main.go
|
||||
mv hugo /usr/local/bin/
|
||||
|
||||
|
||||
# Showcase additions
|
||||
|
||||
You got your new website running and it's powered by Hugo? Great. You can add your website with a few steps to the [showcase](/showcase/).
|
||||
|
||||
First, make sure that you created a [fork](https://help.github.com/articles/fork-a-repo/) of Hugo on Github and cloned your fork on your local computer. Next, create a separate branch for your additions:
|
||||
|
||||
```
|
||||
# You can choose a different descriptive branch name if you like
|
||||
git checkout -b showcase-addition
|
||||
```
|
||||
|
||||
Let's create a new document that contains some metadata of your homepage. Replace `example` in the following examples with something unique like the name of your website. Inside the terminal enter the following commands:
|
||||
|
||||
```
|
||||
cd docs
|
||||
hugo new showcase/example.md
|
||||
```
|
||||
|
||||
You should find the new file at `content/showcase/example.md`. Open it in an editor. The file should contain a frontmatter with predefined variables like below:
|
||||
|
||||
```
|
||||
---
|
||||
date: 2016-02-12T21:01:18+01:00
|
||||
description: ""
|
||||
license: ""
|
||||
licenseLink: ""
|
||||
sitelink: http://spf13.com/
|
||||
sourceLink: https://github.com/spf13/spf13.com
|
||||
tags:
|
||||
- personal
|
||||
- blog
|
||||
thumbnail: /img/spf13-tn.jpg
|
||||
title: example
|
||||
---
|
||||
```
|
||||
|
||||
Add at least values for `sitelink`, `title`, `description` and a path for `thumbnail`.
|
||||
|
||||
Furthermore, we need to create the thumbnail of your website. **It's important that the thumbnail has the required dimensions of 600px by 400px.** Give your thumbnail a name like `example-tn.png`. Save it under `docs/static/img/`.
|
||||
|
||||
Check a last time that everything works as expected. Start Hugo's built-in server in order to inspect your local copy of the showcase in the browser:
|
||||
|
||||
hugo server
|
||||
|
||||
If everything looks fine, we are ready to commit your additions. For the sake of best practices, please make sure that your commit follows our [code contribution guideline](https://github.com/spf13/hugo#code-contribution-guideline).
|
||||
|
||||
git commit -m"docs: Add example.com to the showcase"
|
||||
|
||||
Last but not least, we're ready to create a [pull request](https://github.com/spf13/hugo/compare).
|
||||
|
||||
Don't forget to accept the contributor license agreement. Click on the yellow badge in the automatically added comment in the pull request.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
lastmod: 2015-05-25
|
||||
date: 2013-07-01
|
||||
menu:
|
||||
main:
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
lastmod: 2016-08-17
|
||||
date: 2014-03-24T20:00:00Z
|
||||
linktitle: Press
|
||||
notoc: true
|
||||
@@ -8,7 +9,7 @@ weight: 20
|
||||
|
||||
### Help keep this list up to date
|
||||
|
||||
Know of a post, article or tutorial on hugo? [Add it to this list](https://github.com/spf13/hugo/edit/master/docs/content/community/press.md).
|
||||
Know of a post, article or tutorial on Hugo? [Add it to this list](https://github.com/spf13/hugo/edit/master/docs/content/community/press.md).
|
||||
|
||||
## Press and Articles
|
||||
|
||||
@@ -17,32 +18,62 @@ Hugo has been featured in the following Blog Posts, Press and Media.
|
||||
|
||||
| Title | Author | Date |
|
||||
| ------ | ------ | -----: |
|
||||
| [Building our site: From Django & Wordpress to a static generator (Part I)](https://tryolabs.com/blog/2016/09/20/building-our-site-django-wordpress-to-static-part-i/) | Alan Descoins | 20 Sep 2016 |
|
||||
| [Webseitenmaschine - Statische Websites mit Hugo erzeugen](http://www.heise.de/ct/ausgabe/2016-12-Statische-Websites-mit-Hugo-erzeugen-3211704.html) <small>(German, $)</small> | Christian Helmbold | 27 May 2016 |
|
||||
| [Cómo hacer sitios web estáticos con Hugo y Go - Platzi](https://www.youtube.com/watch?v=qaXXpdiCHXE) <small>(Video tutorial)</small> | Verónica López | 6 Apr 2016 |
|
||||
| [CDNOverview: A CDN comparison site made with Hugo](https://www.cloakfusion.com/cdnoverview-cdn-comparison-site-made-hugo/) | Thijs de Zoete | 23 Feb 2016 |
|
||||
| [Hugo: A Modern WebSite Engine That Just Works](https://github.com/shekhargulati/52-technologies-in-2016/blob/master/07-hugo/README.md) | Shekhar Gulati | 14 Feb 2016 |
|
||||
| [Minify Hugo Generated HTML](http://ratson.name/blog/minify-hugo-generated-html/) | Ratson | 2 Feb 2016 |
|
||||
| [Static site generators: el futuro de las webs estáticas<br>(Hugo, Jekyll, Flask y otros)](http://sitelabs.es/static-site-generators-futuro-las-webs-estaticas/) | Eneko Sarasola | 9 Jan 2016 |
|
||||
| [Writing a Lambda Function for Hugo](https://blog.jolexa.net/post/writing-a-lambda-function-for-hugo/) | Jeremy Olexa | 1 Jan 2016 |
|
||||
| [Ein Blog mit Hugo erstellen - Tutorial](http://privat.albicker.org/blog/tags/hugo/) <small>(Deutsch/German)</small> | Bernhard Albicker | 30 Dec 2015 |
|
||||
| [How to host Hugo static website generator on AWS Lambda](http://bezdelev.com/post/hugo-aws-lambda-static-website/) | Ilya Bezdelev | 15 Dec 2015 |
|
||||
| [Migrating from Pelican to Hugo](http://www.softinio.com/post/migrating-from-pelican-to-hugo/) | Salar Rahmanian | 29 Nov 2015 |
|
||||
| [Hugo + Uberspace + Git = Hubergit — eine Anleitung (German)](https://harms-ensink.name/post/hubergit/) | Christoph Harms-Ensink | 24 Nov 2015 |
|
||||
| [Static Website Generators Reviewed: Jekyll, Middleman, Roots, Hugo](http://www.smashingmagazine.com/2015/11/static-website-generators-jekyll-middleman-roots-hugo-review/) | <div style="line-height: 100%">Mathias Biilmann Christensen</div> | 16 Nov 2015 |
|
||||
| [How To Deploy a Hugo Site to Production with Git Hooks on Ubuntu 14.04](https://www.digitalocean.com/community/tutorials/how-to-deploy-a-hugo-site-to-production-with-git-hooks-on-ubuntu-14-04) | Justin Ellingwood | 12 Nov 2015 |
|
||||
| [How To Install and Use Hugo, a Static Site Generator, on Ubuntu 14.04](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-hugo-a-static-site-generator-on-ubuntu-14-04) | Justin Ellingwood | 9 Nov 2015 |
|
||||
| [Switching from Wordpress to Hugo](http://justinfx.com/2015/11/08/switching-from-wordpress-to-hugo/) | Justin Israel | 8 Nov 2015 |
|
||||
| [Hands-on Experience with Hugo as a Static Site Generator](http://usersnap.com/blog/hands-on-experience-with-hugo-static-site-generator/) | Thomas Peham | 15 Oct 2015 |
|
||||
| [Statische Webseites mit Hugo erstellen/Vortrag mit Foliensatz (deutsch)](http://sfd.koelnerlinuxtreffen.de/2015/HaraldWeidner/) | Harald Weidner | 19 Sep 2015 |
|
||||
| [Moving from WordPress to Hugo](http://abhipandey.com/2015/09/moving-to-hugo/) | Abhishek Pandey | 15 Sep 2015 |
|
||||
| [<span lang="zh-CN">通过webhook将Hugo自动部署至GitHub Pages和GitCafe Pages</span> <small>(Automated deployment)</small>](http://blog.coderzh.com/2015/09/13/use-webhook-automated-deploy-hugo/) | CoderZh | 13 Sep 2015 |
|
||||
| [<span lang="zh-CN">使用hugo搭建个人博客站点</span> <small>(Using Hugo to build a personal blog site)</small>](http://blog.coderzh.com/2015/08/29/hugo/) | CoderZh | 29 Aug 2015 |
|
||||
| [Good-Bye Wordpress, Hello Hugo!](http://blog.arminhanisch.de/2015/08/blog-migration-zu-hugo/) <small>(German)</small> | Armin Hanisch | 18 Aug 2015 |
|
||||
| [Static Site E-Commerce: Integrating Snipcart with Hugo](https://snipcart.com/blog/snipcart-hugo-integration) | Francis Tremblay | 13 Aug 2015 |
|
||||
| [Hugo on Netlify — Insanely Fast Deploys](https://www.netlify.com/blog/2015/07/30/hugo-on-netlify-insanely-fast-deploys.html) | Mathias Biilmann | 30 July 2015 |
|
||||
| [Générer votre site web statique avec Hugo <small>(Generate your static site with Hugo)<small>](http://www.linux-pratique.com/?p=191) | Benoît Benedetti | 26 June 2015 |
|
||||
| [<span lang="ja">Hugo向けの新しいテーマを作った</span> <small>(I created a new theme for Hugo)<small>](http://yet.unresolved.xyz/blog/2015/06/20/making-new-theme-robust-for-hugo/) | Daisuke Tsuji | 20 June 2015 |
|
||||
| [Hugo - Gerando um site com conteúdo estático. (Portuguese Brazil)](http://blog.ffrizzo.com/posts/hugo/) | Fabiano Frizzo | 2 Jun 2015 |
|
||||
| [An Introduction to Static Site Generators](http://davidwalsh.name/introduction-static-site-generators) | Eduardo Bouças | 20 May 2015 |
|
||||
| [Hugo Still Rules](http://cheekycoder.com/2015/05/hugo-still-rules/) | Cheeky Coder | 18 May 2015 |
|
||||
| [hugo - Static Site Generator](http://gscacco.github.io/post/hugo/) | G Scaccoio | 4 May 2015 |
|
||||
| [WindowsでHugoを使う](http://ureta.net/2015/05/hugo-on-windows/) | うれ太郎 | 1 May 2015 |
|
||||
| [Hugoのshortcodesを用いてサイトにスライドなどを埋め込む](http://blog.yucchiy.com/2015/04/29/hugo-shortcode/) | Yucchiy | 29 Apr 2015 |
|
||||
| [HugoとCircleCIでGitHub PagesにBlogを公開してみたら超簡単だった](http://hori-ryota.github.io/blog/create-blog-with-hugo-and-circleci/) | Hori Ryota | 17 Apr 2015 |
|
||||
| [<span lang="ja">WindowsでHugoを使う</span>](http://ureta.net/2015/05/hugo-on-windows/) | <span lang="ja">うれ太郎</span> | 1 May 2015 |
|
||||
| [<span lang="ja">Hugoのshortcodesを用いてサイトにスライドなどを埋め込む</span>](http://blog.yucchiy.com/2015/04/29/hugo-shortcode/) | Yucchiy | 29 Apr 2015 |
|
||||
| [<span lang="ja">HugoとCircleCIでGitHub PagesにBlogを公開してみたら超簡単だった</span>](http://hori-ryota.github.io/blog/create-blog-with-hugo-and-circleci/) | Hori Ryota | 17 Apr 2015 |
|
||||
| [How to build a mobile friendly website Part 2 - Ok to Go](http://jbrodriguez.io/mobile-friendly-website-2/) | Juan B. Rodriguez | 13 Apr 2015 |
|
||||
| [10 Best Static Site Generators](http://beebom.com/2015/04/best-static-site-generators) | Aniruddha Mysore | 6 Apr 2015 |
|
||||
| [Goodbye WordPress; Hello Hugo](http://willwarren.com/2015/04/05/goodbye-wordpress-hello-hugo/) | Will Warren | 5 Apr 2015 |
|
||||
| [Static Websites with Hugo on Google Cloud Storage](http://www.moxie.io/post/static-websites-with-hugo-on-google-cloud-storage/) | Moxie Input/Output | 2 Apr 2015 |
|
||||
| [De nuevo iniciando un blog](http://alvarolizama.net/blog/denuevo-iniciando-un-blog/) | Alvaro Lizama | 29 Mar 2015 |
|
||||
| [We moved our blog from Posthaven to Hugo after only three posts. Why?](http://blog.hypriot.com/post/moved-from-posthaven-to-hugo/) | Hypriot | 27 Mar 2015 |
|
||||
| [Hugo is cool](http://tnt.wicast.tk/2015/03/23/hugo-is-cool/) <small>(<span lang="zh-CN">中文</span> Chinese)</small> | wicast | 23 Mar 2015 |
|
||||
| [Top Static Site Generators in 2015](http://superdevresources.com/static-site-generators-2015/) | Kanishk Kunal | 12 Mar 2015 |
|
||||
| [Moving to Hugo](http://abiosoft.com/moving-to-hugo/) | Abiola Ibrahim | 8 Mar 2015 |
|
||||
| [Hugoで試行錯誤する - log](http://deprode.net/log/logs/first/) | Deprode | 28 Feb 2015 |
|
||||
| [服务器上 hugo 的安装和配置 <small>(Installing and configuring Hugo on the server)</small>](http://hucsmn.com/post/hugo-tutorial-make-it-work/) | hucsmn | 11 Feb 2015 |
|
||||
| [blogをoctopressからHugoに乗り換えたメモ](http://blog.jigyakkuma.org/2015/02/11/hugo/) | jigyakkuma | 11 Feb 2015 |
|
||||
| [Hugoでブログをつくった](http://porgy13.github.io/post/new-hugo-blog/) | porgy13 | 7 Feb 2015 |
|
||||
| [Hugoにブログを移行した](http://keichi.net/post/first/) | Keichi Takahashi | 4 Feb 2015 |
|
||||
| [Hugo静态网站生成器中文教程](http://nanshu.wang/post/2015-01-31/) | Nanshu Wang | 31 Jan 2015 |
|
||||
| [Hugo + Github Pages + Wercker CI =<br> ¥0(無料)でコマンド 1 発(自動化)でサイト・ブログを公開・運営・分析・収益化](http://qiita.com/yoheimuta/items/8a619cac356bed89a4c9) | Yoheimuta | 31 Jan 2015 |
|
||||
| [<span lang="ja">Hugoで試行錯誤する</span> - log](http://deprode.net/log/logs/first/) | Deprode | 28 Feb 2015 |
|
||||
| [Migrating a blog (yes, this one!) from Wordpress to Hugo](http://justindunham.net/migrating-from-wordpress-to-hugo/) | Justin Dunham | 13 Feb 2015 |
|
||||
| [<span lang="ja">blogをoctopressからHugoに乗り換えたメモ</span>](http://blog.jigyakkuma.org/2015/02/11/hugo/) | jigyakkuma | 11 Feb 2015 |
|
||||
| [<span lang="ja">Hugoでブログをつくった</span>](http://porgy13.github.io/post/new-hugo-blog/) | porgy13 | 7 Feb 2015 |
|
||||
| [<span lang="ja">Hugoにブログを移行した</span>](http://keichi.net/post/first/) | Keichi Takahashi | 4 Feb 2015 |
|
||||
| [<span lang="zh-CN">Hugo静态网站生成器中文教程</span>](http://nanshu.wang/post/2015-01-31/) | Nanshu Wang | 31 Jan 2015 |
|
||||
| [<span lang="ja">Hugo + Github Pages + Wercker CI = ¥0(無料)<br>でコマンド 1 発(自動化)でサイト<br>・ブログを公開・運営・分析・収益化</span>](http://qiita.com/yoheimuta/items/8a619cac356bed89a4c9) | Yohei Yoshimuta | 31 Jan 2015 |
|
||||
| [Running Hugo websites on anynines](http://blog.anynines.com/running-hugo-websites-on-anynines/) | Julian Weber | 30 Jan 2015 |
|
||||
| [MiddlemanからHugoへ移行した](http://re-dzine.net/2015/01/hugo/) | Haruki Konishi | 21 Jan 2015 |
|
||||
| [WordPress から Hugo に乗り換えました](http://rakuishi.com/archives/wordpress-to-hugo/) | rakuishi | 20 Jan 2015 |
|
||||
| [HUGOを使ってサイトを立ち上げる方法](http://qiita.com/syui/items/869538099551f24acbbf) | Syui | 17 Jan 2015 |
|
||||
| [Jekyllが許されるのは小学生までだよね](http://t32k.me/mol/log/hugo/) | Ishimoto Koji | 16 Jan 2015 |
|
||||
| [<span lang="ja">Jekyllが許されるのは小学生までだよね</span>](http://t32k.me/mol/log/hugo/) | Ishimoto Koji | 16 Jan 2015 |
|
||||
| [Getting started with Hugo](http://anthonyfok.org/post/getting-started-with-hugo/) | Anthony Fok | 12 Jan 2015 |
|
||||
| [把这个博客静态化了 <small>(Migrate to Hugo)</small>](http://lich-eng.com/2015/01/03/migrate-to-hugo/) | Li Cheng | 3 Jan 2015 |
|
||||
| [<span lang="zh-CN">把这个博客静态化了</span> <small>(Migrate to Hugo)</small>](http://lich-eng.com/2015/01/03/migrate-to-hugo/) | Li Cheng | 3 Jan 2015 |
|
||||
| [My Hugo Experiment](http://tilde.club/~jbaty/2014/12/2014-12-31-my-hugo-experiment/) | Jack Baty | 31 Dec 2014 |
|
||||
| [Porting my blog with Hugo](http://blog.srackham.com/posts/porting-my-blog-with-hugo/) | Stuart Rackham | 30 Dec 2014 |
|
||||
| [Hugoを使ってみたときのメモ](http://machortz.github.io/posts/usinghugo/) | Machortz | 29 Dec 2014 |
|
||||
@@ -53,26 +84,25 @@ Hugo has been featured in the following Blog Posts, Press and Media.
|
||||
| [6 Static Blog Generators That Aren’t Jekyll](http://www.sitepoint.com/6-static-blog-generators-arent-jekyll/) | David Turnbull | 8 Dec 2014 |
|
||||
| [Travel Blogging Setup](http://www.stou.dk/2014/11/travel-blogging-setup/) | Rasmus Stougaard | 23 Nov 2014 |
|
||||
| [Hosting A Hugo Website Behind Nginx](http://www.bigbeeconsultants.co.uk/blog/hosting-hugo-website-behind-nginx) | Rick Beton | 20 Nov 2014 |
|
||||
| [使用Hugo搭建免费个人Blog <small>(How to use Hugo)</small>](http://ulricqin.com/post/how-to-use-hugo/) | Ulric Qin 秦晓辉 | 11 Nov 2014 |
|
||||
| [<span lang="zh-CN">使用Hugo搭建免费个人Blog</span> <small>(How to use Hugo)</small>](http://ulricqin.com/post/how-to-use-hugo/) | Ulric Qin <span lang="zh-CN">秦晓辉</span> | 11 Nov 2014 |
|
||||
| [Built in Speed and Built for Speed by Hugo](http://cheekycoder.com/2014/10/built-for-speed-by-hugo/) | Cheeky Coder | 30 Oct 2014 |
|
||||
| [hugo, syncthing](http://fredix.ovh/2014/10/hugo-syncthing/) | Frédéric Logier | 13 Oct 2014 |
|
||||
| [Hugo para crear sitios web estáticos](http://www.webbizarro.com/noticias/1076/hugo-para-crear-sitios-web-estaticos/) | Web Bizarro | 19 Aug 2014 |
|
||||
| [Hello Hugo!](http://commiechink.com/2014/08/hello-hugo/) | Jason Yee | 19 Aug 2014 |
|
||||
| [Going with hugo](http://www.markuseliasson.se/article/going-with-hugo/) | Markus Eliasson | 18 Aug 2014 |
|
||||
| [Benchmarking Jekyll, Hugo and Wintersmith](http://www.internaldeployment.se/post/2014-08-12-Jekyll-and-its-alternatives-from-a-site-generation-point-of-view/) | Fredrik Loch | 12 Aug 2014 |
|
||||
| [Benchmarking Jekyll, Hugo and Wintersmith](http://fredrikloch.me/post/2014-08-12-Jekyll-and-its-alternatives-from-a-site-generation-point-of-view/) | Fredrik Loch | 12 Aug 2014 |
|
||||
| [Goodbye Octopress, Hello Hugo!](http://andreimihu.com/blog/2014/08/11/goodbye-octopress-hello-hugo/) | Andrei Mihu | 11 Aug 2014 |
|
||||
| [Beautiful sites for Open Source projects](http://beautifulopen.com/2014/08/09/hugo/) | Beautiful Open | 9 Aug 2014 |
|
||||
| [Hugo: Beyond the Defaults](http://npf.io/2014/08/hugo-beyond-the-defaults/) | Nate Finch | 8 Aug 2014 |
|
||||
| [First Impressions of Hugo](https://peteraba.com/blog/first-impressions-of-hugo/) | Peter Aba | 6 Aug 2014 |
|
||||
| [New Site Workflow](http://vurt.co.uk/post/new_website/) | Giles Paterson | 5 Aug 2014 |
|
||||
| [How I Learned to Stop Worrying and Love the (Static) Web](http://cognition.ca/post/about-hugo/) | Joshua McKenty | 4 Aug 2014 |
|
||||
| [Hugo over Octopress](http://kennywoo.com/blog/hugo---golang-based-static-site-generator/) | Kenny Woo | 3 Aug 2014 |
|
||||
| [Hugo - Static Site Generator](http://kenwoo.io/blog/hugo---static-site-generator/) | Kenny Woo | 3 Aug 2014 |
|
||||
| [Hugo Is Friggin' Awesome](http://npf.io/2014/08/hugo-is-awesome/) | Nate Finch | 1 Aug 2014 |
|
||||
| [再次搬家 <small>(Move from WordPress to Hugo)</small>](http://www.chingli.com/misc/move-from-wordpress-to-hugo/) | 青砾 (chingli) | 12 July 2014 |
|
||||
| [<span lang="zh-CN">再次搬家</span> <small>(Move from WordPress to Hugo)</small>](http://www.chingli.com/misc/move-from-wordpress-to-hugo/) | <span lang="zh-CN">青砾</span> (chingli) | 12 July 2014 |
|
||||
| [Embedding Gists in Hugo](http://danmux.com/posts/embedded_gists/) | Dan Mull | 5 July 2014 |
|
||||
| [An Introduction To Hugo](http://www.cirrushosting.com/web-hosting-blog/an-introduction-to-hugo/) | Dan Silber | 1 July 2014 |
|
||||
| [Moving to Hugo](http://danmux.com/posts/hugo_based_blog/) | Dan Mull | 29 May 2014 |
|
||||
| [开源之静态站点生成器排行榜<br><small>(Leaderboard of open-source static website generators)</small>](http://code.csdn.net/news/2819909) | CSDN.net | 23 May 2014 |
|
||||
| [<span lang="zh-CN">开源之静态站点生成器排行榜</span><br><small>(Leaderboard of open-source static website generators)</small>](http://code.csdn.net/news/2819909) | CSDN.net | 23 May 2014 |
|
||||
| [How I deploy this site using Fabric](http://carlorat.me/quote/fabric/) | Carlo Ratam | 21 May 2014 |
|
||||
| [Finally, a satisfying and effective blog setup](http://michaelwhatcott.com/now-powered-by-hugo/) | Michael Whatcott | 20 May 2014 |
|
||||
| [Hugo from scratch](http://zackofalltrades.com/notes/2014/05/hugo-from-scratch/) | Zack Williams | 18 May 2014 |
|
||||
@@ -84,11 +114,11 @@ Hugo has been featured in the following Blog Posts, Press and Media.
|
||||
| [Hugo](http://bra.am/post/hugo/) | bra.am | 23 Mar 2014 |
|
||||
| [Converting Blogger To Markdown](http://trishagee.github.io/project/atom-to-hugo/) | Trisha Gee | 20 Mar 2014 |
|
||||
| [Moving to Hugo Static Web Pages](http://tepid.org/tech/hugo-web/) | Tobias Weingartner | 16 Mar 2014 |
|
||||
| [Hugo and GitHub Pages](http://sglyon.com/blog/2014/creating-the-site/) | Spencer Lyon | 15 Mar 2014 |
|
||||
| [Hugo and GitHub Pages](http://spencerlyon.com/blog/2014/creating-the-site/) | Spencer Lyon | 15 Mar 2014 |
|
||||
| [New Blog Engine: Hugo](https://blog.afoolishmanifesto.com/posts/hugo/) | fREW Schmidt | 15 Mar 2014 |
|
||||
| [Hugo + gulp.js = Huggle](http://ktmud.github.io/huggle/en/intro/) ([English](http://ktmud.github.io/huggle/en/intro/), [中文](http://ktmud.github.io/huggle/zh/intro/)) | Jesse Yang 杨建超 | 8 Mar 2014 |
|
||||
| [Hugo + gulp.js = Huggle](http://ktmud.github.io/huggle/en/intro/) ([English](http://ktmud.github.io/huggle/en/intro/), [<span lang="zh-CN">中文</span>](http://ktmud.github.io/huggle/zh/intro/)) | Jesse Yang <span lang="zh-CN">杨建超</span> | 8 Mar 2014 |
|
||||
| [Powered by Hugo](http://kieranhealy.org/blog/archives/2014/02/24/powered-by-hugo/) | Kieran Healy | 24 Feb 2014 |
|
||||
| [静的サイトを素早く構築するために<br>GoLangで作られたジェネレータHugo](http://hamasyou.com/blog/2014/02/21/hugo/) | <div style="line-height: 1.1;">Shogo Hamada<br>濱田章吾</div> | 21 Feb 2014 |
|
||||
| [<span lang="ja">静的サイトを素早く構築するために<br>GoLangで作られたジェネレータHugo</span>](http://hamasyou.com/blog/2014/02/21/hugo/) | <div lang="ja" style="line-height: 1.1;">Shogo Hamada<br>濱田章吾</div> | 21 Feb 2014 |
|
||||
| [Latest Roundup of Useful Tools For Developers](http://codegeekz.com/latest-roundup-of-useful-tools-for-developers/) | CodeGeekz | 13 Feb 2014 |
|
||||
| [Hugo: Static Site Generator written in Go](http://www.braveterry.com/2014/02/06/hugo-static-site-generator-written-in-go/) | Brave Terry | 6 Feb 2014 |
|
||||
| [10 Useful HTML5 Tools for Web Designers and Developers](http://designdizzy.com/10-useful-html5-tools-for-web-designers-and-developers/) | Design Dizzy | 4 Feb 2014 |
|
||||
@@ -100,4 +130,3 @@ Hugo has been featured in the following Blog Posts, Press and Media.
|
||||
| [Hugo](http://onethingwell.org/post/69070926608/hugo) | One Thing Well | 5 Dec 2013 |
|
||||
| [In Praise Of Hugo](http://sound-guru.com/blog/post/hello-world/) | sound-guru.com | 19 Oct 2013 |
|
||||
| [Hosting a blog on S3 and Cloudfront](http://www.danesparza.net/2013/07/hosting-a-blog-on-s3-and-cloudfront/) | Dan Esparza | 24 July 2013 |
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
lastmod: 2016-10-01
|
||||
date: 2014-05-14T02:13:50Z
|
||||
menu:
|
||||
main:
|
||||
@@ -10,54 +11,107 @@ weight: 50
|
||||
toc: true
|
||||
---
|
||||
|
||||
Hugo v0.11 introduced the concept of a content builder. Using the
|
||||
command: <code>hugo new <em>[relative new content path]</em></code>,
|
||||
you can start a content file with the date and title automatically set.
|
||||
While this is a welcome feature, active writers need more.
|
||||
In Hugo v0.11, we introduced the concept of a content builder. Using the CLI
|
||||
command <code>hugo new <em>[path/to/my/content]</em></code>, an author could
|
||||
create an empty content file, with the date and title automatically defined in
|
||||
the front matter of the post. While this was a welcome feature, active writers
|
||||
need more flexibility.
|
||||
|
||||
Hugo presents the concept of archetypes, which are archetypal content files
|
||||
with pre-configured [front matter](content/front-matter) which will
|
||||
populate each new content file whenever you run the `hugo new` command.
|
||||
When defining a custom content type, you can use an **archetype** as a way to
|
||||
define the default metadata for a new post of that type.
|
||||
|
||||
**Archetypes** are quite literally archetypal content files with pre-configured
|
||||
[front matter](/content/front-matter). An archetype will populate each new
|
||||
content file of a given type with any default metadata you've defined whenever
|
||||
you run the `hugo new` command.
|
||||
|
||||
## Example
|
||||
|
||||
### Step 1. Creating an archetype
|
||||
|
||||
In this example scenario, we have a blog with a single content type (blog post).
|
||||
We will use ‘tags’ and ‘categories’ for our taxonomies, so let's create an archetype file with ‘tags’ and ‘categories’ pre-defined, as follows:
|
||||
In the following example scenario, suppose we have a blog with a single content
|
||||
type (blog post). Our imaginary blog will use ‘tags’ and ‘categories’ for its
|
||||
taxonomies, so let's create an archetype file with ‘tags’ and ‘categories’
|
||||
pre-defined:
|
||||
|
||||
#### archetypes/default.md
|
||||
|
||||
+++
|
||||
tags = ["x", "y"]
|
||||
categories = ["x", "y"]
|
||||
+++
|
||||
```toml
|
||||
+++
|
||||
tags = ["x", "y"]
|
||||
categories = ["x", "y"]
|
||||
+++
|
||||
```
|
||||
|
||||
> __CAVEAT:__ Some editors (e.g. Sublime, Emacs) do not insert an EOL (end-of-line) character at the end of the file (i.e. EOF). If you get a [strange EOF error](/troubleshooting/strange-eof-error/) when using `hugo new`, please open each archetype file (i.e. `archetypes/*.md`) and press <kbd>Enter</kbd> to type a carriage return after the closing `+++` or `---` as necessary.
|
||||
|
||||
|
||||
### Step 2. Using the archetype
|
||||
|
||||
Now, with `archetypes/default.md` in place, let's create a new post in the `post` section with the `hugo new` command:
|
||||
Now, with `archetypes/default.md` in place, let's create a new post in the `post`
|
||||
section with the `hugo new` command:
|
||||
|
||||
$ hugo new post/my-new-post.md
|
||||
|
||||
Hugo would create the file with the following contents:
|
||||
Hugo will now create the file with the following contents:
|
||||
|
||||
#### content/post/my-new-post.md
|
||||
|
||||
+++
|
||||
title = "my new post"
|
||||
date = "2015-01-12T19:20:04-07:00"
|
||||
tags = ["x", "y"]
|
||||
categories = ["x", "y"]
|
||||
+++
|
||||
```toml
|
||||
+++
|
||||
title = "my new post"
|
||||
date = "2015-01-12T19:20:04-07:00"
|
||||
tags = ["x", "y"]
|
||||
categories = ["x", "y"]
|
||||
+++
|
||||
```
|
||||
|
||||
We see that the `title` and `date` variables have been added, in addition to the `tags` and `categories` variables which were carried over from `archetype/default.md`.
|
||||
We see that the `title` and `date` variables have been added, in addition to the
|
||||
`tags` and `categories` variables which were carried over from `archetype/default.md`.
|
||||
|
||||
Congratulations! We have successfully created an archetype and used it for our new contents. That's all there is to it!
|
||||
Congratulations! We have successfully created an archetype and used it to
|
||||
quickly scaffold out a new post. But wait, what if we want to create some content
|
||||
that isn't exactly a blog post, like a profile for a musician? Let's see how
|
||||
using **archetypes** can help us out.
|
||||
|
||||
### Creating custom archetypes
|
||||
|
||||
Previously, we had created a new content type by adding a new subfolder to the
|
||||
content directory. In this case, its name would be `content/musician`. To begin
|
||||
using a `musician` archetype for each new `musician` post, we simply need to
|
||||
create a file named after the content type called `musician.md`, and put it in
|
||||
the `archetypes` directory, similar to the one below.
|
||||
|
||||
#### archetypes/musician.md
|
||||
|
||||
```toml
|
||||
+++
|
||||
name = ""
|
||||
bio = ""
|
||||
genre = ""
|
||||
+++
|
||||
```
|
||||
|
||||
Now, let's create a new musician.
|
||||
|
||||
$ hugo new musician/mozart.md
|
||||
|
||||
This time, Hugo recognizes our custom `musician` archetype and uses it instead of
|
||||
the default one. Take a look at the new `musician/mozart.md` post. You should see
|
||||
that the generated file's front matter now includes the variables `name`, `bio`,
|
||||
and `genre`.
|
||||
|
||||
#### content/musician/mozart.md
|
||||
|
||||
```toml
|
||||
+++
|
||||
title = "mozart"
|
||||
date = "2015-08-24T13:04:37+02:00"
|
||||
name = ""
|
||||
bio = ""
|
||||
genre = ""
|
||||
+++
|
||||
```
|
||||
|
||||
## Using a different front matter format
|
||||
|
||||
@@ -68,12 +122,11 @@ You can specify a different default format in your site-wide config file
|
||||
(e.g. `config.toml`) using the `MetaDataFormat` directive.
|
||||
Possible values are `"toml"`, `"yaml"` and `"json"`.
|
||||
|
||||
|
||||
## Which archetype is being used
|
||||
|
||||
The following rules apply:
|
||||
The following rules apply when creating new content:
|
||||
|
||||
* If an archetype with a filename that matches the content type being created, it will be used.
|
||||
* If an archetype with a filename matching the new post's [content type](/content/type) exists, it will be used.
|
||||
* If no match is found, `archetypes/default.md` will be used.
|
||||
* If neither is present and a theme is in use, then within the theme:
|
||||
* If an archetype with a filename that matches the content type being created, it will be used.
|
||||
@@ -90,4 +143,6 @@ file name) and the `date` in RFC 3339 format based on
|
||||
> `title` and `date`, which are dynamic and unique for each piece of content,
|
||||
> are the sole exceptions.*
|
||||
|
||||
Content type is automatically detected based on the path. You are welcome to declare which type to create using the `--kind` flag during creation.
|
||||
The content type is automatically detected based on the file path passed to the
|
||||
Hugo CLI command <code>hugo new <em>[my-content-type/post-name]</em></code>. To
|
||||
override the content type for a new post, include the `--kind` flag during creation.
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
---
|
||||
aliases:
|
||||
- /doc/example/
|
||||
lastmod: 2015-12-23
|
||||
date: 2013-07-01
|
||||
linktitle: Example
|
||||
menu:
|
||||
main:
|
||||
parent: content
|
||||
prev: /content/summaries
|
||||
next: /themes/overview
|
||||
notoc: true
|
||||
prev: /content/summaries
|
||||
title: Example Content File
|
||||
weight: 70
|
||||
---
|
||||
@@ -19,8 +20,7 @@ Some things are better shown than explained. The following is a very basic examp
|
||||
|
||||
With TOML front matter:
|
||||
|
||||
```markdown
|
||||
+++
|
||||
<pre><code class="language-toml">+++
|
||||
date = "2013-06-21T11:27:27-04:00"
|
||||
title = "Nitro: A quick and simple profiler for Go"
|
||||
description = "Nitro is a simple profiler for your Golang applications"
|
||||
@@ -29,8 +29,7 @@ topics = [ "Development", "Go" ]
|
||||
slug = "nitro"
|
||||
project_url = "https://github.com/spf13/nitro"
|
||||
+++
|
||||
|
||||
# Nitro
|
||||
</code><code class="language-markdown"># Nitro
|
||||
|
||||
Quick and easy performance analyzer library for [Go](http://golang.org/).
|
||||
|
||||
@@ -48,12 +47,13 @@ of the library.
|
||||
$ go get github.com/spf13/nitro
|
||||
|
||||
Next, include nitro in your application.
|
||||
```
|
||||
</code></pre>
|
||||
|
||||
You may also use the equivalent YAML front matter:
|
||||
|
||||
```markdown
|
||||
```yaml
|
||||
---
|
||||
lastmod: 2015-12-23
|
||||
date: "2013-06-21T11:27:27-04:00"
|
||||
title: "Nitro: A quick and simple profiler for Go"
|
||||
description: "Nitro is a simple profiler for your Go lang applications"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
aliases:
|
||||
- /doc/front-matter/
|
||||
lastmod: 2015-12-23
|
||||
date: 2013-07-01
|
||||
menu:
|
||||
main:
|
||||
@@ -28,50 +29,55 @@ Supported formats:
|
||||
|
||||
## TOML Example
|
||||
|
||||
+++
|
||||
title = "spf13-vim 3.0 release and new website"
|
||||
description = "spf13-vim is a cross platform distribution of vim plugins and resources for Vim."
|
||||
tags = [ ".vimrc", "plugins", "spf13-vim", "vim" ]
|
||||
date = "2012-04-06"
|
||||
categories = [
|
||||
"Development",
|
||||
"VIM"
|
||||
]
|
||||
slug = "spf13-vim-3-0-release-and-new-website"
|
||||
+++
|
||||
|
||||
Content of the file goes Here
|
||||
<pre><code class="language-toml">+++
|
||||
title = "spf13-vim 3.0 release and new website"
|
||||
description = "spf13-vim is a cross platform distribution of vim plugins and resources for Vim."
|
||||
tags = [ ".vimrc", "plugins", "spf13-vim", "vim" ]
|
||||
date = "2012-04-06"
|
||||
categories = [
|
||||
"Development",
|
||||
"VIM"
|
||||
]
|
||||
slug = "spf13-vim-3-0-release-and-new-website"
|
||||
+++
|
||||
</code><code class="language-markdown">Content of the file goes Here
|
||||
</code></pre>
|
||||
|
||||
## YAML Example
|
||||
|
||||
---
|
||||
title: "spf13-vim 3.0 release and new website"
|
||||
description: "spf13-vim is a cross platform distribution of vim plugins and resources for Vim."
|
||||
tags: [ ".vimrc", "plugins", "spf13-vim", "vim" ]
|
||||
date: "2012-04-06"
|
||||
categories:
|
||||
- "Development"
|
||||
- "VIM"
|
||||
slug: "spf13-vim-3-0-release-and-new-website"
|
||||
---
|
||||
|
||||
Content of the file goes Here
|
||||
```yaml
|
||||
---
|
||||
title: "spf13-vim 3.0 release and new website"
|
||||
description: "spf13-vim is a cross platform distribution of vim plugins and resources for Vim."
|
||||
tags: [ ".vimrc", "plugins", "spf13-vim", "vim" ]
|
||||
lastmod: 2015-12-23
|
||||
date: "2012-04-06"
|
||||
categories:
|
||||
- "Development"
|
||||
- "VIM"
|
||||
slug: "spf13-vim-3-0-release-and-new-website"
|
||||
---
|
||||
|
||||
Content of the file goes Here
|
||||
```
|
||||
|
||||
## JSON Example
|
||||
|
||||
{
|
||||
"title": "spf13-vim 3.0 release and new website",
|
||||
"description": "spf13-vim is a cross platform distribution of vim plugins and resources for Vim.",
|
||||
"tags": [ ".vimrc", "plugins", "spf13-vim", "vim" ],
|
||||
"date": "2012-04-06",
|
||||
"categories": [
|
||||
"Development",
|
||||
"VIM"
|
||||
],
|
||||
"slug": "spf13-vim-3-0-release-and-new-website",
|
||||
}
|
||||
|
||||
Content of the file goes Here
|
||||
```json
|
||||
{
|
||||
"title": "spf13-vim 3.0 release and new website",
|
||||
"description": "spf13-vim is a cross platform distribution of vim plugins and resources for Vim.",
|
||||
"tags": [ ".vimrc", "plugins", "spf13-vim", "vim" ],
|
||||
"date": "2012-04-06",
|
||||
"categories": [
|
||||
"Development",
|
||||
"VIM"
|
||||
],
|
||||
"slug": "spf13-vim-3-0-release-and-new-website"
|
||||
}
|
||||
|
||||
Content of the file goes Here
|
||||
```
|
||||
|
||||
## Variables
|
||||
|
||||
@@ -88,16 +94,20 @@ Field names are always normalized to lowercase (e.g. `camelCase: true` is availa
|
||||
|
||||
### Optional variables
|
||||
|
||||
* **redirect** Mark the post as a redirect post
|
||||
* **aliases** An array of one or more aliases
|
||||
(e.g. old published path of a renamed content)
|
||||
that would be created to redirect to this content.
|
||||
See [Aliases]({{< relref "extras/aliases.md" >}}) for details.
|
||||
* **draft** If true, the content will not be rendered unless `hugo` is called with `--buildDrafts`
|
||||
* **publishdate** If in the future, content will not be rendered unless `hugo` is called with `--buildFuture`
|
||||
* **expirydate** Content already expired will not be rendered unless `hugo` is called with `--buildExpired`
|
||||
* **type** The type of the content (will be derived from the directory automatically if unset)
|
||||
* **isCJKLanguage** If true, explicitly treat the content as CJKLanguage (`.Summary` and `.WordCount` can work properly in CJKLanguage)
|
||||
* **weight** Used for sorting
|
||||
* **markup** *(Experimental)* Specify `"rst"` for reStructuredText (requires
|
||||
`rst2html`) or `"md"` (default) for Markdown
|
||||
* **slug** The token to appear in the tail of the URL,
|
||||
*or*<br>
|
||||
* **url** The full path to the content from the web root.<br>
|
||||
* **slug** appears as tail of the url. It can be used to change the part of the url that is based on the filename.
|
||||
* **url** The full path to the content from the web root. It makes no assumptions about the path of the content file. It also ignores any language prefixes of the multilingual feature.
|
||||
|
||||
*If neither `slug` or `url` is present, the filename will be used.*
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
aliases:
|
||||
- /doc/supported-formats/
|
||||
lastmod: 2016-07-22
|
||||
date: 2016-07-22
|
||||
menu:
|
||||
main:
|
||||
parent: content
|
||||
prev: /content/summaries
|
||||
next: /content/example
|
||||
title: Markdown Extras
|
||||
weight: 66
|
||||
toc: false
|
||||
---
|
||||
|
||||
Hugo provides some convenient markdown extensions.
|
||||
|
||||
## Task lists
|
||||
|
||||
Hugo supports GitHub styled task lists (TODO lists) for the Blackfriday renderer (md-files). See [Blackfriday config](/overview/configuration/#configure-blackfriday-rendering) for how to turn it off.
|
||||
|
||||
Example:
|
||||
|
||||
```markdown
|
||||
- [ ] a task list item
|
||||
- [ ] list syntax required
|
||||
- [ ] incomplete
|
||||
- [x] completed
|
||||
```
|
||||
|
||||
Renders as:
|
||||
|
||||
- [ ] a task list item
|
||||
- [ ] list syntax required
|
||||
- [ ] incomplete
|
||||
- [x] completed
|
||||
|
||||
|
||||
And produces this HTML:
|
||||
|
||||
```html
|
||||
|
||||
<ul class="task-list">
|
||||
<li><input type="checkbox" disabled="" class="task-list-item"> a task list item</li>
|
||||
<li><input type="checkbox" disabled="" class="task-list-item"> list syntax required</li>
|
||||
<li><input type="checkbox" disabled="" class="task-list-item"> incomplete</li>
|
||||
<li><input type="checkbox" checked="" disabled="" class="task-list-item"> completed</li>
|
||||
</ul>
|
||||
```
|
||||
@@ -0,0 +1,205 @@
|
||||
---
|
||||
date: 2016-01-02T21:21:00Z
|
||||
menu:
|
||||
main:
|
||||
parent: content
|
||||
next: /content/example
|
||||
prev: /content/summaries
|
||||
title: Multilingual Mode
|
||||
weight: 68
|
||||
toc: true
|
||||
---
|
||||
Hugo supports multiple languages side-by-side (added in `Hugo 0.17`). Define the available languages in a `Languages` section in your top-level `config.toml` (or equivalent).
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
DefaultContentLanguage = "en"
|
||||
|
||||
Languages:
|
||||
en:
|
||||
weight: 1
|
||||
title: "My blog"
|
||||
params:
|
||||
linkedin: "english-link"
|
||||
fr:
|
||||
weight: 2
|
||||
title: "Mon blog"
|
||||
params:
|
||||
linkedin: "lien-francais"
|
||||
copyright: "Tout est à moi"
|
||||
|
||||
copyright: "Everything is mine"
|
||||
```
|
||||
|
||||
Anything not defined in a `[lang]:` block will fall back to the global
|
||||
value for that key (like `copyright` for the English (`en`) language in this example).
|
||||
|
||||
With the config above, all content, sitemap, RSS feeds, paginations
|
||||
and taxonomy pages will be rendered below `/` in English (your default content language), and below `/fr` in French.
|
||||
|
||||
If you want all of the languages to be put below their respective language code, enable `DefaultContentLanguageInSubdir: true` in your configuration.
|
||||
|
||||
Only the obvious non-global options can be overridden per language. Examples of global options are `BaseURL`, `BuildDrafts`, etc.
|
||||
|
||||
Taxonomies and Blackfriday configuration can also be set per language, example:
|
||||
|
||||
```
|
||||
[Taxonomies]
|
||||
tag = "tags"
|
||||
|
||||
[blackfriday]
|
||||
angledQuotes = true
|
||||
hrefTargetBlank = true
|
||||
|
||||
[Languages]
|
||||
[Languages.en]
|
||||
weight = 1
|
||||
title = "English"
|
||||
[Languages.en.blackfriday]
|
||||
angledQuotes = false
|
||||
|
||||
[Languages.fr]
|
||||
weight = 2
|
||||
title = "Français"
|
||||
[Languages.fr.Taxonomies]
|
||||
plaque = "plaques"
|
||||
```
|
||||
|
||||
|
||||
### Translating your content
|
||||
|
||||
Translated articles are identified by the name of the content file.
|
||||
|
||||
Example of translated articles:
|
||||
|
||||
1. `/content/about.en.md`
|
||||
2. `/content/about.fr.md`
|
||||
|
||||
You can also have:
|
||||
|
||||
1. `/content/about.md`
|
||||
2. `/content/about.fr.md`
|
||||
|
||||
In which case the config variable `DefaultContentLanguage` will be used to affect the default language `about.md`. This way, you can
|
||||
slowly start to translate your current content without having to rename everything.
|
||||
|
||||
If left unspecified, the value for `DefaultContentLanguage` defaults to `en`.
|
||||
|
||||
By having the same _base file name_, the content pieces are linked together as translated pieces.
|
||||
|
||||
### Link to translated content
|
||||
|
||||
To create a list of links to translated content, use a template similar to this:
|
||||
|
||||
```
|
||||
{{ if .IsTranslated }}
|
||||
<h4>{{ i18n "translations" }}</h4>
|
||||
<ul>
|
||||
{{ range .Translations }}
|
||||
<li>
|
||||
<a href="{{ .Permalink }}">{{ .Lang }}: {{ .Title }}{{ if .IsPage }} ({{ i18n "wordCount" . }}){{ end }}</a>
|
||||
</li>
|
||||
{{ end}}
|
||||
</ul>
|
||||
{{ end }}
|
||||
```
|
||||
The above can be put in a `partial` and included in any template, be it for a content page or the home page. It will not print anything if there are no translations for a given page, or if it is -- in the case of the home page, section listing etc. -- a site with only one language.
|
||||
|
||||
The above also uses the `i18n` func, see [Translation of strings](#translation-of-strings).
|
||||
|
||||
### Translation of strings
|
||||
|
||||
Hugo uses [go-i18n](https://github.com/nicksnyder/go-i18n) to support string translations. Follow the link to find tools to manage your translation workflows.
|
||||
|
||||
Translations are collected from the `themes/[name]/i18n/` folder (built into the theme), as well as translations present in `i18n/` at the root of your project. In the `i18n`, the translations will be merged and take precedence over what is in the theme folder. Language files should be named according to RFC 5646 with names such as `en-US.yaml`, `fr.yaml`, etc.
|
||||
|
||||
From within your templates, use the `i18n` function like this:
|
||||
|
||||
```
|
||||
{{ i18n "home" }}
|
||||
```
|
||||
|
||||
This uses a definition like this one in `i18n/en-US.yaml`:
|
||||
|
||||
```
|
||||
- id: home
|
||||
translation: "Home"
|
||||
```
|
||||
|
||||
Often you will want to use to the page variables in the translations strings. To do that, pass on the "." context when calling `i18n`:
|
||||
|
||||
```
|
||||
{{ i18n "wordCount" . }}
|
||||
```
|
||||
|
||||
This uses a definition like this one in `i18n/en-US.yaml`:
|
||||
|
||||
```
|
||||
- id: wordCount
|
||||
translation: "This article has {{ .WordCount }} words."
|
||||
```
|
||||
|
||||
To track down missing translation strings, run Hugo with the `--i18n-warnings` flag:
|
||||
|
||||
```bash
|
||||
hugo --i18n-warnings | grep i18n
|
||||
i18n|MISSING_TRANSLATION|en|wordCount
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Menus
|
||||
|
||||
You can define your menus for each language independently. The [creation of a menu]({{< relref "extras/menus.md" >}}) works analogous to earlier versions of Hugo, except that they have to be defined in their language-specific block in the configuration file:
|
||||
|
||||
```toml
|
||||
DefaultContentLanguage = "en"
|
||||
|
||||
[languages.en]
|
||||
weight = 0
|
||||
languageName = "English"
|
||||
|
||||
[[languages.en.menu.main]]
|
||||
url = "/"
|
||||
name = "Home"
|
||||
weight = 0
|
||||
|
||||
|
||||
[languages.de]
|
||||
weight = 10
|
||||
languageName = "Deutsch"
|
||||
|
||||
[[languages.de.menu.main]]
|
||||
url = "/"
|
||||
name = "Startseite"
|
||||
weight = 0
|
||||
```
|
||||
|
||||
The rendering of the main navigation works as usual. `.Site.Menus` will just contain the menu of the current language. Pay attention to the generation of the menu links. `absLangURL` takes care that you link to the correct locale of your website. Otherwise, both menu entries would link to the English version because it's the default content language that resides in the root directory.
|
||||
|
||||
```html
|
||||
<ul>
|
||||
{{- $currentNode := . -}}
|
||||
{{ range .Site.Menus.main -}}
|
||||
<li class="{{ if $currentNode.IsMenuCurrent "main" . }}active{{ end }}">
|
||||
<a href="{{ .URL | absLangURL }}">{{ .Name }}</a>
|
||||
</li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
|
||||
```
|
||||
|
||||
### 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.
|
||||
|
||||
While translating a Hugo site, it can be handy to have a visual indicator of missing translations. The `EnableMissingTranslationPlaceholders` config option will flag all untranslated strings with the placeholder `[i18n] identifier`, where `identifier` is the id of the missing translation.
|
||||
|
||||
**Remember: Hugo will generate your website with these placeholders. It might not be suited for production environments.**
|
||||
|
||||
### Multilingual Themes support
|
||||
|
||||
To support Multilingual mode in your themes, some considerations must be taken for the URLs in the templates. If there are more than one language, URLs must either come from the built-in `.Permalink` or `.URL`, be constructed with `relLangURL` or `absLangURL` template funcs -- or prefixed with `{{.LanguagePrefix }}`.
|
||||
|
||||
If there are more than one language defined, the`LanguagePrefix` variable will equal `"/en"` (or whatever your `CurrentLanguage` is). If not enabled, it will be an empty string, so it is harmless for single-language sites.
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
lastmod: 2015-12-23
|
||||
date: 2014-03-06
|
||||
linktitle: Ordering
|
||||
menu:
|
||||
@@ -26,13 +27,14 @@ guaranteed.
|
||||
|
||||
## Assigning weight to content
|
||||
|
||||
+++
|
||||
weight = 4
|
||||
title = "Three"
|
||||
date = "2012-04-06"
|
||||
+++
|
||||
Front Matter with Ordered Pages 3
|
||||
|
||||
```toml
|
||||
+++
|
||||
weight = 4
|
||||
title = "Three"
|
||||
date = "2012-04-06"
|
||||
+++
|
||||
Front Matter with Ordered Pages 3
|
||||
```
|
||||
|
||||
## Ordering Content Within Taxonomies
|
||||
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
---
|
||||
aliases:
|
||||
- /doc/organization/
|
||||
lastmod: 2015-09-27
|
||||
date: 2013-07-01
|
||||
linktitle: Organization
|
||||
menu:
|
||||
main:
|
||||
parent: content
|
||||
next: /content/front-matter
|
||||
next: /content/supported-formats
|
||||
prev: /overview/source-directory
|
||||
title: Content Organization
|
||||
weight: 10
|
||||
toc: true
|
||||
---
|
||||
|
||||
Hugo uses Markdown files with headers commonly called the *front matter*. Hugo
|
||||
Hugo uses files (see [supported formats](/content/supported-formats/)) with headers commonly called the *front matter*. Hugo
|
||||
respects the organization that you provide for your content to minimize any
|
||||
extra configuration, though this can be overridden by additional configuration
|
||||
in the front matter.
|
||||
@@ -27,19 +28,23 @@ in Hugo and is used as the [section](/content/sections/).
|
||||
|
||||
.
|
||||
└── content
|
||||
└── about
|
||||
| └── index.md // <- http://1.com/about/
|
||||
├── post
|
||||
| ├── firstpost.md // <- http://1.com/post/firstpost/
|
||||
| ├── happy
|
||||
| | └── ness.md // <- http://1.com/post/happy/ness/
|
||||
| | └── ness.md // <- http://1.com/post/happy/ness/
|
||||
| └── secondpost.md // <- http://1.com/post/secondpost/
|
||||
└── quote
|
||||
├── first.md // <- http://1.com/quote/first/
|
||||
└── second.md // <- http://1.com/quote/second/
|
||||
|
||||
**Here's the same organization run with `hugo --uglyUrls`**
|
||||
**Here's the same organization run with `hugo --uglyURLs`**
|
||||
|
||||
.
|
||||
└── content
|
||||
└── about
|
||||
| └── index.md // <- http://1.com/about/
|
||||
├── post
|
||||
| ├── firstpost.md // <- http://1.com/post/firstpost.html
|
||||
| ├── happy
|
||||
@@ -56,6 +61,9 @@ that works to organize your source content is used to organize the rendered
|
||||
site. As displayed above, the organization of the source content will be
|
||||
mirrored in the destination.
|
||||
|
||||
Notice that the first level `about/` page URL was created using a directory
|
||||
named "about" with a single `index.md` file inside.
|
||||
|
||||
There are times when one would need more control over their content. In these
|
||||
cases, there are a variety of things that can be specified in the front matter
|
||||
to determine the destination of a specific piece of content.
|
||||
@@ -76,8 +84,10 @@ The actual path to the file on disk. Destination will create the destination
|
||||
with the same path. Includes [section](/content/sections/).
|
||||
|
||||
### section
|
||||
`section` can be provided in the front matter overriding the section derived from
|
||||
the source content location on disk. See [section](/content/sections/).
|
||||
`section` is determined by its location on disk and can *not* be specified in the front matter. See [section](/content/sections/).
|
||||
|
||||
### type
|
||||
`type` is also determined by its location on disk but, unlike `section`, it *can* be specified in the front matter. See [type](/content/types/).
|
||||
|
||||
### path
|
||||
`path` can be provided in the front matter. This will replace the actual
|
||||
@@ -88,7 +98,7 @@ path. Includes [section](/content/sections/).
|
||||
A complete URL can be provided. This will override all the above as it pertains
|
||||
to the end destination. This must be the path from the baseURL (starting with a "/").
|
||||
When a `url` is provided, it will be used exactly. Using `url` will ignore the
|
||||
`--uglyUrls` setting.
|
||||
`--uglyURLs` setting.
|
||||
|
||||
|
||||
## Path breakdown in Hugo
|
||||
@@ -145,12 +155,12 @@ When a `url` is provided, it will be used exactly. Using `url` will ignore the
|
||||
|
||||
**section** = which type the content is by default
|
||||
|
||||
* based on content location
|
||||
* based on content location
|
||||
* front matter overrides
|
||||
|
||||
**slug** = name.ext or name/
|
||||
|
||||
* based on content-name.md
|
||||
* based on content-name.md
|
||||
* front matter overrides
|
||||
|
||||
**path** = section + path to file excluding slug
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
lastmod: 2015-12-23
|
||||
date: 2013-07-01
|
||||
menu:
|
||||
main:
|
||||
@@ -17,17 +18,17 @@ uses the top level of your content organization as **the Section**.
|
||||
|
||||
The following example site uses two sections, "post" and "quote".
|
||||
|
||||
.
|
||||
└── content
|
||||
├── post
|
||||
| ├── firstpost.md // <- http://1.com/post/firstpost/
|
||||
| ├── happy
|
||||
| | └── ness.md // <- http://1.com/post/happy/ness/
|
||||
| └── secondpost.md // <- http://1.com/post/secondpost/
|
||||
└── quote
|
||||
├── first.md // <- http://1.com/quote/first/
|
||||
└── second.md // <- http://1.com/quote/second/
|
||||
|
||||
{{< nohighlight >}}.
|
||||
└── content
|
||||
├── post
|
||||
| ├── firstpost.md // <- http://1.com/post/firstpost/
|
||||
| ├── happy
|
||||
| | └── ness.md // <- http://1.com/post/happy/ness/
|
||||
| └── secondpost.md // <- http://1.com/post/secondpost/
|
||||
└── quote
|
||||
├── first.md // <- http://1.com/quote/first/
|
||||
└── second.md // <- http://1.com/quote/second/
|
||||
{{< /nohighlight >}}
|
||||
|
||||
## Section Lists
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
---
|
||||
lastmod: 2015-01-27
|
||||
date: 2013-07-01
|
||||
menu:
|
||||
main:
|
||||
parent: content
|
||||
next: /content/example
|
||||
notoc: true
|
||||
prev: /content/ordering
|
||||
next: /content/markdown-extras
|
||||
title: Summaries
|
||||
weight: 65
|
||||
---
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
aliases:
|
||||
- /doc/supported-formats/
|
||||
lastmod: 2015-08-01
|
||||
date: 2015-08-01
|
||||
menu:
|
||||
main:
|
||||
parent: content
|
||||
next: /content/front-matter
|
||||
prev: /content/organization
|
||||
title: Supported Formats
|
||||
weight: 15
|
||||
toc: true
|
||||
---
|
||||
|
||||
Since 0.14, Hugo has defined a new concept called _external helpers_. It means that you can write your content using Asciidoc[tor], or reStructuredText. If you have files with associated extensions ([details](https://github.com/spf13/hugo/blob/77c60a3440806067109347d04eb5368b65ea0fe8/helpers/general.go#L65)), then Hugo will call external commands to generate the content.
|
||||
|
||||
This means that you will have to install the associated tool on your machine to be able to use those formats.
|
||||
|
||||
For example, for Asciidoc files, Hugo will try to call __asciidoctor__ or __asciidoc__ command.
|
||||
|
||||
To use those formats, just use the standard extension and the front matter exactly as you would do with natively supported _.md_ files.
|
||||
|
||||
Notes:
|
||||
|
||||
* as these are external commands, generation performance for that content will heavily depend on the performance of those external tools.
|
||||
* this feature is still in early stage, hence feedback is even more welcome.
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
lastmod: 2015-09-28
|
||||
date: 2013-07-01
|
||||
linktitle: Types
|
||||
menu:
|
||||
@@ -54,21 +55,23 @@ whenever a specific file is not present.
|
||||
*Remember, all of the following are optional:*
|
||||
|
||||
### Create Type Directory
|
||||
Create a directory with the name of the type in `layouts`. Type is always singular. *E.g. `/layouts/post`*.
|
||||
Create a directory with the name of the type in `/layouts`. Type is always singular. *E.g. `/layouts/post`*.
|
||||
|
||||
### Create single template
|
||||
Create a file called `single.html` inside your directory. *E.g. `/layouts/post/single.html`*.
|
||||
|
||||
### Create list template
|
||||
Create a file called `list.html` inside your directory. *E.g. `/layouts/post/list.html`*.
|
||||
Create a file called `post.html` inside the section lists template directory, `/layouts/section`. *E.g. `/layouts/section/post.html`*.
|
||||
|
||||
### Create views
|
||||
Many sites support rendering content in a few different ways, for instance,
|
||||
a single page view and a summary view to be used when displaying a list
|
||||
of contents on a single page. Hugo makes no assumptions here about how you want
|
||||
to display your content, and will support as many different views of a content
|
||||
type as your site requires. All that is required for these additional views is
|
||||
that a template exists in each layouts/`TYPE` directory with the same name.
|
||||
Many sites support rendering content in a few different ways, for
|
||||
instance, a single page view and a summary view to be used when
|
||||
displaying a [list of contents on a single page](/templates/list).
|
||||
Hugo makes no assumptions here about how you want to display your
|
||||
content, and will support as many different views of a content type
|
||||
as your site requires. All that is required for these additional
|
||||
views is that a template exists in each `/layouts/TYPE` directory
|
||||
with the same name.
|
||||
|
||||
### Create a corresponding archetype
|
||||
|
||||
|
||||
@@ -3,11 +3,12 @@ aliases:
|
||||
- /doc/redirects/
|
||||
- /doc/alias/
|
||||
- /doc/aliases/
|
||||
lastmod: 2015-12-23
|
||||
date: 2013-07-09
|
||||
menu:
|
||||
main:
|
||||
parent: extras
|
||||
next: /extras/builders
|
||||
next: /extras/analytics
|
||||
prev: /taxonomies/ordering
|
||||
title: Aliases
|
||||
weight: 10
|
||||
@@ -19,15 +20,15 @@ Luckily, redirects can be handled easily with _aliases_ in Hugo.
|
||||
|
||||
## Example
|
||||
|
||||
Given a post on your current Hugo site, with a path of:
|
||||
Given a post on your current Hugo site, with a path of:
|
||||
|
||||
``content/posts/my-awesome-blog-post.md``
|
||||
|
||||
... you create an "aliases" section in the frontmatter of your post, and add previous paths to that.
|
||||
... you create an "aliases" section in the frontmatter of your post, and add previous paths to that.
|
||||
|
||||
### TOML frontmatter
|
||||
|
||||
~~~yaml
|
||||
```toml
|
||||
+++
|
||||
...
|
||||
aliases = [
|
||||
@@ -36,11 +37,11 @@ aliases = [
|
||||
]
|
||||
...
|
||||
+++
|
||||
~~~
|
||||
```
|
||||
|
||||
### YAML frontmatter
|
||||
|
||||
~~~yaml
|
||||
```yaml
|
||||
---
|
||||
...
|
||||
aliases:
|
||||
@@ -48,34 +49,48 @@ aliases:
|
||||
- /2010/01/01/even-earlier-url.html
|
||||
...
|
||||
---
|
||||
~~~
|
||||
```
|
||||
|
||||
Now when you visit any of the locations specified in aliases, _assuming the same site domain_, you'll be redirected to the page they are specified on.
|
||||
Now when you visit any of the locations specified in aliases, _assuming the same site domain_, you'll be redirected to the page they are specified on.
|
||||
|
||||
## Important Behaviors
|
||||
|
||||
1. *Hugo makes no assumptions about aliases. They also don't change based
|
||||
on your UglyUrls setting. You need to provide absolute path to your webroot and the
|
||||
complete filename or directory.*
|
||||
on your UglyURLs setting. You need to provide absolute path to your webroot
|
||||
and the complete filename or directory.*
|
||||
|
||||
2. *Aliases are rendered prior to any content and will be overwritten by
|
||||
any content with the same location.*
|
||||
|
||||
## Multilingual example
|
||||
|
||||
On [multilingual sites]({{< relref "content/multilingual.md" >}}), each translation of a post can have unique aliases. To use the same alias across multiple languages, prefix it with the language code.
|
||||
|
||||
In `/posts/my-new-post.es.md`:
|
||||
|
||||
```yaml
|
||||
---
|
||||
aliases:
|
||||
- /es/posts/my-original-post/
|
||||
---
|
||||
```
|
||||
|
||||
## How Hugo Aliases Work
|
||||
|
||||
When aliases are specified, Hugo creates a physical folder structure to match the alias entry, and, an html file specifying the canonical URL for the page, and a redirect target.
|
||||
When aliases are specified, Hugo creates a physical folder structure to match the alias entry, and, an html file specifying the canonical URL for the page, and a redirect target.
|
||||
|
||||
Assuming a baseurl of `mysite.tld`, the contents of the html file will look something like:
|
||||
Assuming a baseurl of `mysite.tld`, the contents of the html file will look something like:
|
||||
|
||||
~~~html
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>http://mysite.tld/posts/my-original-url</title>
|
||||
<link rel="canonical" href="http://mysite.tld/posts/my-original-url"/>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
|
||||
<meta http-equiv="refresh" content="0;url=http://mysite.tld/posts/my-original-url"/>
|
||||
<meta http-equiv="refresh" content="0; url=http://mysite.tld/posts/my-original-url"/>
|
||||
</head>
|
||||
</html>
|
||||
~~~
|
||||
```
|
||||
|
||||
The `http-equiv="refresh"` line is what performs the redirect, in 0 seconds in this case.
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
date: 2016-02-06
|
||||
linktitle: Analytics
|
||||
menu:
|
||||
main:
|
||||
parent: extras
|
||||
next: /extras/builders
|
||||
prev: /extras/aliases
|
||||
title: Analytics in Hugo
|
||||
weight: 15
|
||||
---
|
||||
|
||||
Hugo ships with prebuilt internal templates for Google Analytics tracking, including both synchronous and asynchronous tracking codes.
|
||||
|
||||
## Configuring Google Analytics
|
||||
|
||||
Provide your tracking id in your configuration file, e.g. config.yaml.
|
||||
|
||||
googleAnalytics = "UA-123-45"
|
||||
|
||||
## Example
|
||||
|
||||
Include the internal template in your templates like so:
|
||||
|
||||
{{ template "_internal/google_analytics.html" . }}
|
||||
|
||||
For async include the async template:
|
||||
|
||||
{{ template "_internal/google_analytics_async.html" . }}
|
||||
@@ -1,11 +1,12 @@
|
||||
---
|
||||
lastmod: 2015-12-24
|
||||
date: 2014-05-26
|
||||
linktitle: Builders
|
||||
menu:
|
||||
main:
|
||||
parent: extras
|
||||
next: /extras/comments
|
||||
prev: /extras/aliases
|
||||
prev: /extras/analytics
|
||||
title: Hugo Builders
|
||||
weight: 20
|
||||
---
|
||||
@@ -18,7 +19,8 @@ started.
|
||||
|
||||
Want to get a site built quickly?
|
||||
|
||||
$ hugo new site /path/to/site
|
||||
{{< nohighlight >}}$ hugo new site <i>path/to/site</i>
|
||||
{{< /nohighlight >}}
|
||||
|
||||
Hugo will create all the needed directories and files to get started
|
||||
quickly.
|
||||
@@ -52,7 +54,4 @@ will pre-populate values based on the content type.
|
||||
$ hugo new relative/path/to/content
|
||||
|
||||
This assumes it is being run from your working directory and the content
|
||||
path starts from your content directory.
|
||||
|
||||
I typically keep two different terminals open, one to run `hugo server
|
||||
--watch`, and another to use the builders to create new content.
|
||||
path starts from your content directory. Now, Hugo watches your content directory by default and rebuilds your entire website if any change occurs.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
lastmod: 2015-08-04
|
||||
date: 2014-05-26
|
||||
linktitle: Comments
|
||||
menu:
|
||||
@@ -52,7 +53,7 @@ Users have noticed that enabling Disqus comments when running the Hugo web serve
|
||||
return;
|
||||
|
||||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
||||
var disqus_shortname = '{{ .Site.Params.disqusShortname }}';
|
||||
var disqus_shortname = '{{ .Site.DisqusShortname }}';
|
||||
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
|
||||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
||||
})();
|
||||
@@ -80,7 +81,7 @@ A few alternatives exist to [Disqus](https://disqus.com/):
|
||||
* [isso](http://posativ.org/isso/) (Self-hosted, Python)
|
||||
* [Kaiju](https://github.com/spf13/kaiju)
|
||||
|
||||
## Kaiju
|
||||
## Kaiju
|
||||
|
||||
[Kaiju](https://github.com/spf13/kaiju) is an open-source project started by [spf13](http://spf13.com/) (Hugo’s author) to bring easy and fast real time discussions to the web.
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
lastmod: 2015-12-23
|
||||
date: 2014-11-25
|
||||
menu:
|
||||
main:
|
||||
@@ -14,12 +15,14 @@ Hugo makes it easy to link documents together with the `ref` and `relref` shortc
|
||||
|
||||
## Using `ref` and `relref`
|
||||
|
||||
{{</* ref "document" */>}}
|
||||
{{</* ref "#anchor" */>}}
|
||||
{{</* ref "document#anchor" */>}}
|
||||
{{</* relref "document" */>}}
|
||||
{{</* relref "#anchor" */>}}
|
||||
{{</* relref "document#anchor" */>}}
|
||||
```django
|
||||
{{</* ref "document" */>}}
|
||||
{{</* ref "#anchor" */>}}
|
||||
{{</* ref "document#anchor" */>}}
|
||||
{{</* relref "document" */>}}
|
||||
{{</* relref "#anchor" */>}}
|
||||
{{</* relref "document#anchor" */>}}
|
||||
```
|
||||
|
||||
The single parameter to `ref` is a string with a content _document name_ (`about.md`), an in-document _anchor_ (`#who`), or both (`about.md#who`).
|
||||
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
---
|
||||
aliases:
|
||||
- /doc/dynamiccontent/
|
||||
- /doc/datadrivencontent/
|
||||
lastmod: 2016-03-03
|
||||
date: 2015-02-14
|
||||
menu:
|
||||
main:
|
||||
parent: extras
|
||||
next: /extras/highlighting
|
||||
prev: /extras/datafiles
|
||||
title: Dynamic Content
|
||||
title: Data-driven Content
|
||||
weight: 91
|
||||
toc: true
|
||||
---
|
||||
|
||||
Dynamic content with a static site generator? Yes, it is possible!
|
||||
Data-driven content with a static site generator? Yes, it is possible!
|
||||
|
||||
In addition to the [data files](/extras/datafiles/) feature, we have also
|
||||
implemented the feature "Dynamic Content", which lets you load
|
||||
implemented the feature "Data-driven Content", which lets you load
|
||||
any [JSON](http://www.json.org/) or
|
||||
[CSV](http://en.wikipedia.org/wiki/Comma-separated_values) file
|
||||
from nearly any resource.
|
||||
|
||||
"Dynamic Content" currently consists of two functions, `getJSON`
|
||||
"Data-driven Content" currently consists of two functions, `getJSON`
|
||||
and `getCSV`, which are available in **all template files**.
|
||||
|
||||
## Implementation details
|
||||
@@ -102,9 +103,8 @@ temporary directory.
|
||||
With the command-line flag `--cacheDir`, you can specify any folder on
|
||||
your system as a caching directory.
|
||||
|
||||
If you don't like caching at all, you can fully disable to read from the
|
||||
cache with the command line flag `--ignoreCache`. However, Hugo will always
|
||||
write, on each build of the site, to the cache folder (silent backup).
|
||||
If you don't like caching at all, you can fully disable caching with the
|
||||
command line flag `--ignoreCache`.
|
||||
|
||||
### Authentication when using REST URLs
|
||||
|
||||
@@ -116,7 +116,7 @@ other authentication methods are not implemented.
|
||||
|
||||
To load local files with the two functions `getJSON` and `getCSV`, the
|
||||
source files must reside within Hugo's working directory. The file
|
||||
extension does not matter but the content.
|
||||
extension does not matter but the content does.
|
||||
|
||||
It applies the same output logic as in the topic: *Calling the functions with an URL*.
|
||||
|
||||
@@ -124,14 +124,14 @@ It applies the same output logic as in the topic: *Calling the functions with an
|
||||
|
||||
There is no chance to trigger a [LiveReload](/extras/livereload/) when
|
||||
the content of an URL changes. However, when a local JSON/CSV file changes,
|
||||
then a LiveReload will be triggered of course. Symlinks not supported.
|
||||
then a LiveReload will be triggered of course. Symlinks are not supported.
|
||||
|
||||
**URLs and LiveReload**: If you change any local file and the LiveReload
|
||||
got triggered, Hugo will either read the URL content from the cache or, if
|
||||
is triggered, Hugo will either read the URL content from the cache or, if
|
||||
you have disabled the cache, Hugo will re-download the content.
|
||||
This can create huge traffic and you may also reach API limits quickly.
|
||||
|
||||
As downloading of content takes a while, Hugo stops with processing
|
||||
As downloading of content takes a while, Hugo stops processing
|
||||
your Markdown files until the content has been downloaded.
|
||||
|
||||
## Examples
|
||||
@@ -1,11 +1,12 @@
|
||||
---
|
||||
aliases:
|
||||
- /doc/datafiles/
|
||||
lastmod: 2015-08-04
|
||||
date: 2015-01-22
|
||||
menu:
|
||||
main:
|
||||
parent: extras
|
||||
next: /extras/dynamiccontent
|
||||
next: /extras/datadrivencontent
|
||||
prev: /extras/scratch
|
||||
title: Data Files
|
||||
weight: 90
|
||||
@@ -21,9 +22,11 @@ Data Files can also be used in [themes](/themes/overview/), but note: If the sam
|
||||
|
||||
## The Data Folder
|
||||
|
||||
As explained in [Source Organization](/overview/source-directory/), the `data` folder is where you can store additional data for Hugo to use when generating your site. These files must be YAML, JSON or TOML files (using either the `.yml`, `.yaml`, `.json` or `toml` extension) and the data will be accessible as a `map` in `.Site.Data`.
|
||||
The `data` folder is where you can store additional data for Hugo to use when generating your site. Data files aren't used to generate standalone pages - rather they're meant supplemental to the content files. This feature can extend the content in case your frontmatter would grow immensely. Or perhaps your want to show a larger dataset in a template (see example below). In both cases it's a good idea to outsource the data in their own file.
|
||||
|
||||
**The keys in this map will be a dot chained set of _path_, _filename_ and _key_ in file (if applicable).**
|
||||
These files must be YAML, JSON or TOML files (using either the `.yml`, `.yaml`, `.json` or `toml` extension) and the data will be accessible as a `map` in `.Site.Data`.
|
||||
|
||||
**The keys in this map will be a dot chained set of _path_, _filename_ and _key_ in file (if applicable).**
|
||||
|
||||
This is best explained with an example:
|
||||
|
||||
@@ -56,7 +59,7 @@ discography = [
|
||||
"1991 - Live In New York City, Volumes 1-7.",
|
||||
"1999 - Rare Collection (compilation)",
|
||||
"2003 - Punk Jazz: The Jaco Pastorius Anthology (compilation)",
|
||||
"2007 - The Essential Jaco Pastorius (compilation)"
|
||||
"2007 - The Essential Jaco Pastorius (compilation)"
|
||||
]
|
||||
```
|
||||
|
||||
@@ -81,3 +84,24 @@ And then in `partial/artist.html`:
|
||||
```
|
||||
|
||||
Discover a new favourite bass player? Just add another TOML-file.
|
||||
|
||||
## Example: Accessing named values in a Data File
|
||||
|
||||
Assuming you have the following YAML structure to your `User0123.yml` Data File located directly in `data/`
|
||||
|
||||
```
|
||||
Name: User0123
|
||||
"Short Description": "He is a **jolly good** fellow."
|
||||
Achievements:
|
||||
- "Can create a Key, Value list from Data File"
|
||||
- "Learns Hugo"
|
||||
- "Reads documentation"
|
||||
```
|
||||
|
||||
To render the `Short Description` in your `layout` File following code is required.
|
||||
|
||||
```
|
||||
<div>Short Description of {{.Site.Data.User0123.Name}}: <p>{{ index .Site.Data.User0123 "Short Description" | markdownify }}</p></div>
|
||||
```
|
||||
|
||||
Note the use of the `markdownify` template function. This will send the description through the Blackfriday Markdown rendering engine.
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
---
|
||||
aliases:
|
||||
- /extras/highlight/
|
||||
lastmod: 2015-10-27
|
||||
date: 2013-07-01
|
||||
menu:
|
||||
main:
|
||||
parent: extras
|
||||
next: /extras/toc
|
||||
prev: /extras/shortcodes
|
||||
prev: /extras/datadrivencontent
|
||||
title: Syntax Highlighting
|
||||
weight: 90
|
||||
toc: true
|
||||
---
|
||||
|
||||
Hugo provides the ability for you to highlight source code in _two different ways_ — either pre-processed server side from your content, or to defer the processing to the client side, using a JavaScript library.
|
||||
Hugo provides the ability for you to highlight source code in _two different ways_ — either pre-processed server side from your content, or to defer the processing to the client side, using a JavaScript library.
|
||||
|
||||
**The advantage of server side** is that it doesn’t depend on a JavaScript library and consequently works very well when read from an RSS feed.
|
||||
**The advantage of server side** is that it doesn’t depend on a JavaScript library and consequently works very well when read from an RSS feed.
|
||||
|
||||
**The advantage of client side** is that it doesn’t cost anything when building your site and some of the highlighting scripts available cover more languages than Pygments does.
|
||||
|
||||
@@ -38,7 +39,7 @@ Hugo gives you two options that you can set with the variable `pygmentsuseclasse
|
||||
|
||||
### Usage
|
||||
|
||||
Highlighting is carried out via the in-built shortcode `highlight`. `highlight` takes exactly one required parameter of language, and requires a closing shortcode. Note that `highlight` is _not_ used for client-side javascript highlighting.
|
||||
Highlighting is carried out via the in-built shortcode `highlight`. `highlight` takes exactly one required parameter of language, and requires a closing shortcode. Note that `highlight` is _not_ used for client-side javascript highlighting.
|
||||
|
||||
### Example
|
||||
|
||||
@@ -85,10 +86,27 @@ Supported keywords: `style`, `encoding`, `noclasses`, `hl_lines`, `linenos`. No
|
||||
|
||||
The keywords are the same you would using with Pygments from the command line, see the [Pygments doc](http://pygments.org/docs/) for more info.
|
||||
|
||||
### Code fences
|
||||
|
||||
It is also possible to add syntax highlighting with GitHub flavoured code fences. To enable this, set the `PygmentsCodeFences` to `true` in Hugo's configuration file.
|
||||
|
||||
````
|
||||
``` html
|
||||
<section id="main">
|
||||
<div>
|
||||
<h1 id="title">{{ .Title }}</h1>
|
||||
{{ range .Data.Pages }}
|
||||
{{ .Render "summary"}}
|
||||
{{ end }}
|
||||
</div>
|
||||
</section>
|
||||
```
|
||||
````
|
||||
|
||||
### Disclaimers
|
||||
|
||||
* Pygments is relatively slow and _causes a performance hit when building your site_, but Hugo has been designed to cache the results to disk.
|
||||
* Pygments is relatively slow and _causes a performance hit when building your site_, but Hugo has been designed to cache the results to disk.
|
||||
* The caching can be turned off by setting the `--ignoreCache` flag to `true`.
|
||||
* Languages available depends on your Pygments installation.
|
||||
|
||||
## Client-side
|
||||
@@ -111,14 +129,14 @@ This example uses the popular [Highlight.js] library, hosted by [Yandex], a popu
|
||||
In your `./layouts/partials/` (or `./layouts/chrome/`) folder, depending on your specific theme, there will be a snippet that will be included in every generated HTML page, such as `header.html` or `header.includes.html`. Simply add the css and js to initialize [Highlight.js]:
|
||||
|
||||
~~~
|
||||
<link rel="stylesheet" href="https://yandex.st/highlightjs/8.0/styles/default.min.css">
|
||||
<script src="https://yandex.st/highlightjs/8.0/highlight.min.js"></script>
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/styles/default.min.css">
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/highlight.min.js"></script>
|
||||
<script>hljs.initHighlightingOnLoad();</script>
|
||||
~~~
|
||||
|
||||
### Prism example
|
||||
|
||||
Prism is another popular highlighter library, used on some major sites. Similar to Highlight.js, you simply load `prism.css` in your `<head>` via whatever Hugo partial template is creating that part of your pages, like so:
|
||||
Prism is another popular highlighter library, used on some major sites. Similar to Highlight.js, you simply load `prism.css` in your `<head>` via whatever Hugo partial template is creating that part of your pages, like so:
|
||||
|
||||
```html
|
||||
...
|
||||
@@ -126,7 +144,7 @@ Prism is another popular highlighter library, used on some major sites. Similar
|
||||
...
|
||||
```
|
||||
|
||||
... and add `prism.js` near the bottom of your `<body>` tag, again in whatever Hugo partial template is appropriate for your site or theme.
|
||||
... and add `prism.js` near the bottom of your `<body>` tag, again in whatever Hugo partial template is appropriate for your site or theme.
|
||||
|
||||
```html
|
||||
...
|
||||
@@ -139,9 +157,9 @@ In this example, the local paths indicate that your own copy of these files are
|
||||
|
||||
### Using Client-side highlighting
|
||||
|
||||
To use client-side highlighting, most of these javascript libraries expect your code to be wrapped in semantically correct `<code>` tags, with the language expressed in a class attribute on the `<code>` tag, such as `class="language-abc"`, where the `abc` is the code the highlighter script uses to represent that language.
|
||||
To use client-side highlighting, most of these javascript libraries expect your code to be wrapped in semantically correct `<code>` tags, with the language expressed in a class attribute on the `<code>` tag, such as `class="language-abc"`, where the `abc` is the code the highlighter script uses to represent that language.
|
||||
|
||||
The script would be looking for classes like `language-go`, `language-html`, or `language-css`. If you look at the page's source, it would be marked up like so:
|
||||
The script would be looking for classes like `language-go`, `language-html`, or `language-css`. If you look at the page's source, it would be marked up like so:
|
||||
|
||||
~~~html
|
||||
<pre>
|
||||
@@ -175,6 +193,6 @@ Please see individual libraries' documentation for how to implement each of the
|
||||
[Highlight.js]: http://highlightjs.org/
|
||||
[Rainbow]: http://craig.is/making/rainbows
|
||||
[Syntax Highlighter]: http://alexgorbatchev.com/SyntaxHighlighter/
|
||||
[Google Prettify]: https://code.google.com/p/google-code-prettify/
|
||||
[Google Prettify]: https://github.com/google/code-prettify
|
||||
[Yandex]: http://yandex.ru/
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
lastmod: 2016-08-09
|
||||
date: 2014-05-26
|
||||
menu:
|
||||
main:
|
||||
@@ -22,7 +23,8 @@ Hugo comes with LiveReload built in. There are no additional packages to
|
||||
install. A common way to use Hugo while developing a site is to have
|
||||
Hugo run a server and watch for changes:
|
||||
|
||||
$ hugo server --watch
|
||||
{{< nohighlight >}}$ hugo server
|
||||
{{< /nohighlight >}}
|
||||
|
||||
This will run a full functioning web server while simultaneously
|
||||
watching your file system for additions, deletions or changes within
|
||||
@@ -33,26 +35,41 @@ your:
|
||||
* data files
|
||||
* layouts
|
||||
* current theme
|
||||
* configuration files
|
||||
|
||||
Whenever anything changes Hugo will rebuild the site, continue to serve
|
||||
the content and as soon as the build is finished it will tell the
|
||||
browser and silently reload the page. Because most hugo builds are so
|
||||
Whenever anything changes, Hugo will rebuild the site while continuing to serve
|
||||
the content. As soon as the build is finished, it will tell the
|
||||
browser and silently reload the page. Because most Hugo builds are so
|
||||
fast they are barely noticeable, you merely need to glance at your open
|
||||
browser and you will see the change already there.
|
||||
browser and you will see the change, already there.
|
||||
|
||||
This means that keeping the site open on a second monitor (or another
|
||||
half of your current monitor) allows you to see exactly what your
|
||||
content looks like without even leaving your text editor.
|
||||
content looks like, without even leaving your text editor.
|
||||
|
||||
## Disabling Watch
|
||||
|
||||
If for some reason you don't want the Hugo server's watch functionality,
|
||||
just do:
|
||||
|
||||
{{< nohighlight >}}$ hugo server --watch=false
|
||||
{{< /nohighlight >}}
|
||||
|
||||
## Disabling LiveReload
|
||||
|
||||
LiveReload works by injecting JavaScript into the pages it
|
||||
creates that creates a web socket client to the hugo web socket server.
|
||||
LiveReload works by injecting JavaScript into the pages Hugo generates,
|
||||
which creates a connection from the browser web socket client to the
|
||||
Hugo web socket server.
|
||||
|
||||
Awesome for development, but not something you would want to do in
|
||||
production. Since many people use `hugo server --watch` in production to
|
||||
production. Since many people use `hugo server` in production to
|
||||
instantly display any updated content, we’ve made it easy to disable the
|
||||
LiveReload functionality.
|
||||
LiveReload functionality:
|
||||
|
||||
$ hugo server --watch --disableLiveReload
|
||||
{{< nohighlight >}}$ hugo server --disableLiveReload
|
||||
{{< /nohighlight >}}
|
||||
|
||||
## Notes
|
||||
|
||||
You must have a closing `</body>` tag for LiveReload to work.
|
||||
Hugo injects the LiveReload `<script>` before this tag.
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
---
|
||||
aliases:
|
||||
- /doc/localfiles/
|
||||
lastmod: 2016-09-12
|
||||
date: 2015-06-12
|
||||
menu:
|
||||
main:
|
||||
parent: extras
|
||||
next: /community/mailing-list
|
||||
notoc: true
|
||||
prev: /extras/urls
|
||||
title: Traversing Local Files
|
||||
weight: 110
|
||||
---
|
||||
## Traversing Local Files
|
||||
|
||||
Using Hugo's function `readDir`,
|
||||
you can traverse your web site's files on your server.
|
||||
## Using _readDir_
|
||||
|
||||
The `readDir` function returns an array
|
||||
of [`os.FileInfo`](https://golang.org/pkg/os/#FileInfo).
|
||||
It takes a single, string argument: a path.
|
||||
This path can be to any directory of your web site
|
||||
(as found on your server's filesystem).
|
||||
|
||||
Whether the path is absolute or relative makes no difference,
|
||||
because—at least for `readDir`—the root of your web site (typically `./public/`)
|
||||
in effect becomes both:
|
||||
|
||||
1. The filesystem root; and
|
||||
1. The current working directory.
|
||||
|
||||
## New Shortcode
|
||||
|
||||
So, let's create a new shortcode using `readDir`:
|
||||
|
||||
**layouts/shortcodes/directoryindex.html**
|
||||
```html
|
||||
{{< readfile "layouts/shortcodes/directoryindex.html" >}}
|
||||
```
|
||||
For the files in any given directory,
|
||||
this shortcode usefully lists their basenames and sizes,
|
||||
while providing links to them.
|
||||
|
||||
Already—actually—this shortcode
|
||||
has been included in this very web site.
|
||||
So, let's list some of its CSS files.
|
||||
(If you click on their names, you can reveal the contents.)
|
||||
{{< directoryindex path="/static/css" pathURL="/css" >}}
|
||||
<br />
|
||||
This is the call that rendered the above output:
|
||||
```html
|
||||
{{</* directoryindex path="/static/css" pathURL="/css" */>}}
|
||||
```
|
||||
By the way,
|
||||
regarding the pathURL argument, the initial slash `/` is important.
|
||||
Otherwise, it becomes relative to the current web page.
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
lastmod: 2015-08-04
|
||||
date: 2014-05-14T02:36:37Z
|
||||
toc: true
|
||||
menu:
|
||||
@@ -11,7 +12,7 @@ weight: 60
|
||||
---
|
||||
|
||||
Hugo has a simple yet powerful menu system that permits content to be
|
||||
placed in menus with a good degree of control without a lot of work.
|
||||
placed in menus with a good degree of control without a lot of work.
|
||||
|
||||
|
||||
*TIP:* If all you want is a simple menu for your sections, see [Section Menu for "the Lazy Blogger"]({{< relref "#section-menu-for-the-lazy-blogger" >}}).
|
||||
@@ -29,6 +30,8 @@ A menu is a named array of menu entries accessible on the site under
|
||||
`.Site.Menus` by name. For example, if I have a menu called `main`, I would
|
||||
access it via `.Site.Menus.main`.
|
||||
|
||||
If you make use of the [multilingual feature]({{< relref "content/multilingual.md#menus">}}) you can define menus language independent.
|
||||
|
||||
A menu entry has the following properties:
|
||||
|
||||
* **URL** string
|
||||
@@ -121,11 +124,11 @@ And the equivalent example `config.yaml`:
|
||||
Pre: "<i class='fa fa-road'></i>"
|
||||
Weight: -100
|
||||
URL: "/getting-started/"
|
||||
---
|
||||
---
|
||||
|
||||
|
||||
**NOTE:** The URLs must be relative to the context root. If the `BaseURL` is `http://example.com/mysite/`, then the URLs in the menu must not include the context root `mysite`.
|
||||
|
||||
**NOTE:** The URLs must be relative to the context root. If the `BaseURL` is `http://example.com/mysite/`, then the URLs in the menu must not include the context root `mysite`. Using an absolute URL will overide the BaseURL. If the `URL` is `http://subdomain.example.com/`, the output will be `http://subdomain.example.com`.
|
||||
|
||||
## Nesting
|
||||
|
||||
All nesting of content is done via the `parent` field.
|
||||
@@ -133,8 +136,11 @@ All nesting of content is done via the `parent` field.
|
||||
The parent of an entry should be the identifier of another entry.
|
||||
Identifier should be unique (within a menu).
|
||||
|
||||
The following order is used to determine identity Identifier > Name >
|
||||
LinkTitle > Title. This means that the title will be used unless
|
||||
The following order is used to determine an Identifier:
|
||||
|
||||
> Name > LinkTitle > Title.
|
||||
|
||||
This means that the title will be used unless
|
||||
linktitle is present, etc. In practice Name and Identifier are never
|
||||
displayed and only used to structure relationships.
|
||||
|
||||
@@ -146,7 +152,7 @@ and all content entries are attached to one of these entries via the
|
||||
|
||||
Hugo makes no assumptions about how your rendered HTML will be
|
||||
structured. Instead, it provides all of the functions you will need to be
|
||||
able to build your menu however you want.
|
||||
able to build your menu however you want.
|
||||
|
||||
|
||||
The following is an example:
|
||||
@@ -173,7 +179,7 @@ The following is an example:
|
||||
</ul>
|
||||
{{else}}
|
||||
<li>
|
||||
<a class="" href="{{.URL}}">
|
||||
<a href="{{.URL}}">
|
||||
{{ .Pre }}
|
||||
<span>{{ .Name }}</span>
|
||||
</a>
|
||||
@@ -188,6 +194,7 @@ The following is an example:
|
||||
</aside>
|
||||
<!--sidebar end-->
|
||||
|
||||
> **Note**: use the `absLangURL` or `relLangURL` if your theme makes use of the [multilingual feature]({{< relref "content/multilingual.md" >}}). In contrast to `absURL` and `relURL` it adds the correct language prefix to the url. [Read more]({{< relref "templates/functions.md#urls" >}}).
|
||||
|
||||
## Section Menu for "the Lazy Blogger"
|
||||
|
||||
@@ -213,7 +220,7 @@ This will create a menu with all the sections as menu items and all the sections
|
||||
|
||||
In the above, the menu item is marked as active if on the current section's list page or on a page in that section.
|
||||
|
||||
The above is all that's needed. But if you want custom menu items, e.g. changing weight or name, you can define them manually in the site config, i.e. `config.toml`:
|
||||
The above is all that's needed. But if you want custom menu items, e.g. changing weight or name, you can define them manually in the site config, i.e. `config.toml`:
|
||||
|
||||
```
|
||||
[[menu.main]]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
aliases:
|
||||
- /doc/pagination/
|
||||
lastmod: 2015-07-16
|
||||
date: 2014-01-01
|
||||
menu:
|
||||
main:
|
||||
@@ -35,12 +36,17 @@ There are two ways to configure and use a `.Paginator`:
|
||||
|
||||
For a given **Node**, it's one of the options above. The `.Paginator` is static and cannot change once created.
|
||||
|
||||
|
||||
The global page size setting (`Paginate`) can be overridden by providing a positive integer as the last argument. The examples below will give five items per page:
|
||||
|
||||
* `{{ range (.Paginator 5).Pages }}`
|
||||
* `{{ $paginator := .Paginate (where .Data.Pages "Type" "post") 5 }}`
|
||||
|
||||
It is also possible to use the `GroupBy` functions in combination with pagination:
|
||||
|
||||
```
|
||||
{{ range (.Paginate (.Data.Pages.GroupByDate "2006")).PageGroups }}
|
||||
```
|
||||
|
||||
## Build the navigation
|
||||
|
||||
The `.Paginator` contains enough information to build a paginator interface.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
aliases:
|
||||
- /doc/permalinks/
|
||||
lastmod: 2015-01-19
|
||||
date: 2013-11-18
|
||||
menu:
|
||||
main:
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
lastmod: 2016-01-06
|
||||
date: 2015-12-08
|
||||
menu:
|
||||
main:
|
||||
parent: extras
|
||||
next: /community/mailing-list
|
||||
prev: /extras/urls
|
||||
title: Custom robots.txt
|
||||
weight: 120
|
||||
---
|
||||
|
||||
Hugo can generated a customized [robots.txt](http://www.robotstxt.org/) in the
|
||||
[same way as any other templates]({{< ref "templates/go-templates.md" >}}).
|
||||
|
||||
To enable it, just set `enableRobotsTXT` option to `true` in the [configuration file]({{< ref "overview/configuration.md" >}}). By default, it generates a robots.txt, which allows everything, with the following content:
|
||||
|
||||
```http
|
||||
User-agent: *
|
||||
```
|
||||
|
||||
|
||||
Hugo will use the template `robots.txt` according to the following list in descending precedence:
|
||||
|
||||
* /layouts/robots.txt
|
||||
* /themes/`THEME`/layout/robots.txt
|
||||
|
||||
An example of a robots.txt layout is:
|
||||
|
||||
```http
|
||||
User-agent: *
|
||||
|
||||
{{range .Data.Pages}}
|
||||
Disallow: {{.RelPermalink}}{{end}}
|
||||
```
|
||||
|
||||
This template disallows and all the pages of the site creating one `Disallow` entry for each one.
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
aliases:
|
||||
- /doc/scratch/
|
||||
lastmod: 2015-08-02
|
||||
date: 2015-01-22
|
||||
menu:
|
||||
main:
|
||||
@@ -13,12 +14,20 @@ weight: 80
|
||||
|
||||
`Scratch` -- a "scratchpad" for your node- or page-scoped variables. In most cases you can do well without `Scratch`, but there are some use cases that aren't solvable with Go's templates without `Scratch`'s help, due to scoping issues.
|
||||
|
||||
`Scratch` is added to both `Node` and `Page` and `Shortcode` -- with following methods:
|
||||
|
||||
`Scratch` is added to both `Node` and `Page` -- with the three methods `Set`, `Get` and `Add`. `Set` and `Add` takes a `key` and the `value` to add. Get returns the `value` for the `key` given.
|
||||
* `Set` and `Add` takes a `key` and the `value` to add.
|
||||
* `Get` returns the `value` for the `key` given.
|
||||
* `SetInMap` takes a `key`, `mapKey` and `value`
|
||||
* `GetSortedMapValues` returns array of values from `key` sorted by `mapKey`
|
||||
|
||||
`Set` can store values of any type. `Add` accepts values that support Go's `+` operator.
|
||||
`Set` and `SetInMap` can store values of any type.
|
||||
|
||||
The scope of the backing data is global for the given `Node` or `Page`, and spans partial and shortcode includes.
|
||||
For single values, `Add` accepts values that support Go's `+` operator. If the first `Add` for a key is an array or slice, the follwing adds will be appended to that list.
|
||||
|
||||
The scope of the backing data is global for the given `Node`, `Page` or `Shortcode`, and spans partial and shortcode includes.
|
||||
|
||||
Note that `.Scratch` from a shortcode will return the shortcode's `Scratch`, which in most casses is what you want. If you want to store it in the page scroped Scratch, then use `.Page.Scratch`.
|
||||
|
||||
## Sample usage
|
||||
|
||||
@@ -35,8 +44,19 @@ The usage is best illustrated with some samples:
|
||||
{{ $.Scratch.Add "a2" "CD" }}
|
||||
{{ $.Scratch.Get "a2" }} {{/* => ABCD */}}
|
||||
|
||||
{{ $.Scratch.Add "l1" (slice "A" "B") }}
|
||||
{{ $.Scratch.Get "l1" }} {{/* => [A B] */}}
|
||||
{{ $.Scratch.Add "l1" (slice "C" "D") }}
|
||||
{{ $.Scratch.Get "l1" }} {{/* => [A B C D] */}}
|
||||
|
||||
{{ $.Scratch.Set "v1" 123 }}
|
||||
{{ $.Scratch.Get "v1" }} {{/* => 123 */}}
|
||||
|
||||
{{ $.Scratch.SetInMap "a3" "b" "XX" }}
|
||||
{{ $.Scratch.SetInMap "a3" "a" "AA" }}
|
||||
{{ $.Scratch.SetInMap "a3" "c" "CC" }}
|
||||
{{ $.Scratch.SetInMap "a3" "b" "BB" }}
|
||||
{{ $.Scratch.GetSortedMapValues "a3" }} {{/* => []interface {}{"AA", "BB", "CC"} */}}
|
||||
```
|
||||
|
||||
**Note:** The examples above uses the special `$` variable, which refers to the top-level node. This is the behavior you most likely want, and will help remove some confusion when using `Scratch` inside page range loops -- and you start inadvertently calling the wrong `Scratch`. But there may be use cases for `{{ .Scratch.Add "key" "some value" }}`.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
aliases:
|
||||
- /doc/shortcodes/
|
||||
lastmod: 2016-02-03
|
||||
date: 2013-07-01
|
||||
menu:
|
||||
main:
|
||||
@@ -9,7 +10,7 @@ next: /extras/pagination
|
||||
prev: /extras/permalinks
|
||||
title: Shortcodes
|
||||
weight: 80
|
||||
toc: true
|
||||
toc: false
|
||||
---
|
||||
|
||||
Hugo uses Markdown for its simple content format. However, there are a lot
|
||||
@@ -18,7 +19,7 @@ of things that Markdown doesn’t support well.
|
||||
We are unwilling to accept being constrained by our simple format. Also
|
||||
unacceptable is writing raw HTML in our Markdown every time we want to include
|
||||
unsupported content such as a video. To do so is in complete opposition to the
|
||||
intent of using a bare bones format for our content and utilizing templates to
|
||||
intent of using a bare-bones format for our content and utilizing templates to
|
||||
apply styling for display.
|
||||
|
||||
To avoid both of these limitations, Hugo created shortcodes.
|
||||
@@ -28,13 +29,19 @@ using a predefined template. Note that shortcodes will not work in template
|
||||
files---if you need a functionality like that in a template, you most likely
|
||||
want a [partial template](/templates/partials/) instead.
|
||||
|
||||
Another benefit is, you can update your shortcode with any related new classes or
|
||||
techniques, and upon generation, Hugo will easily merge in your changes. You
|
||||
avoid a possibly complicated search and replace operation.
|
||||
|
||||
## Using a shortcode
|
||||
|
||||
In your content files, a shortcode can be called by using '`{{%/* name parameters
|
||||
*/%}}`' respectively. Shortcodes are space delimited (parameters with spaces
|
||||
can be quoted).
|
||||
In your content files, a shortcode can be called by using the `{{%/* name parameters
|
||||
*/%}}` form. Shortcode parameters are space delimited. Parameters with spaces
|
||||
can be quoted.
|
||||
|
||||
The first word is always the name of the shortcode. Parameters follow the name.
|
||||
Depending upon how the shortcode is defined, the parameters may be named,
|
||||
positional or both (although you can't mixed parameter types in a single call).
|
||||
The format for named parameters models that of HTML with the format
|
||||
`name="value"`.
|
||||
|
||||
@@ -51,19 +58,18 @@ The examples above use two different delimiters, the difference being the `%` an
|
||||
|
||||
The `%` characters indicates that the shortcode's inner content needs further processing by the page's rendering processor (i.e. Markdown), needed to get the **bold** text in the example below:
|
||||
|
||||
```
|
||||
{{%/* myshortcode */%}}Hello **World!**{{%/* /myshortcode */%}}
|
||||
```
|
||||
|
||||
{{%/* myshortcode */%}}Hello **World!**{{%/* /myshortcode */%}}
|
||||
|
||||
|
||||
### Shortcodes without Markdown
|
||||
|
||||
The `<` character indicates that the shortcode's inner content doesn't need any further rendering, this will typically be pure HTML:
|
||||
|
||||
```
|
||||
{{</* myshortcode */>}}<p>Hello <strong>World!</strong></p>{{</* /myshortcode */>}}
|
||||
```
|
||||
{{</* myshortcode */>}}<p>Hello <strong>World!</strong></p>{{</* /myshortcode */>}}
|
||||
|
||||
## Hugo Shortcodes
|
||||
|
||||
## Built-in Shortcodes
|
||||
|
||||
Hugo ships with a set of predefined shortcodes.
|
||||
|
||||
@@ -73,6 +79,7 @@ This shortcode will convert the source code provided into syntax highlighted
|
||||
HTML. Read more on [highlighting](/extras/highlighting/).
|
||||
|
||||
#### Usage
|
||||
|
||||
`highlight` takes exactly one required parameter of _language_ and requires a
|
||||
closing shortcode.
|
||||
|
||||
@@ -102,12 +109,13 @@ closing shortcode.
|
||||
<span style="color: #f92672"></section></span>
|
||||
|
||||
### figure
|
||||
|
||||
`figure` is simply an extension of the image capabilities present with Markdown.
|
||||
`figure` provides the ability to add captions, CSS classes, alt text, links etc.
|
||||
|
||||
#### Usage
|
||||
|
||||
`figure` can use the following parameters:
|
||||
`figure` can use the following named parameters:
|
||||
|
||||
* src
|
||||
* link
|
||||
@@ -158,16 +166,78 @@ Assuming that standard Hugo pretty URLs are turned on.
|
||||
<a href="/blog/neat">Neat</a>
|
||||
<a href="/about/#who:c28654c202e73453784cfd2c5ab356c0">Who</a>
|
||||
|
||||
### Twitter
|
||||
|
||||
You want to include a single tweet into your blog post? Everything you need is the URL of the tweet, e.g.:
|
||||
|
||||
* https://twitter.com/spf13/status/666616452582129664
|
||||
|
||||
Pass the tweet's ID from the URL as parameter to the shortcode as shown below:
|
||||
|
||||
{{</* tweet 666616452582129664 */>}}
|
||||
|
||||
### YouTube
|
||||
|
||||
This shortcode embeds a responsive video player for [YouTube](https://www.youtube.com/) videos. Only the ID of the video is required, e.g.:
|
||||
|
||||
* https://www.youtube.com/watch?v=w7Ft2ymGmfc
|
||||
|
||||
Copy the ID from behind `v=` and pass it to the shortcode:
|
||||
|
||||
{{</* youtube w7Ft2ymGmfc */>}}
|
||||
|
||||
Furthermore, you can autostart the embedded video by setting the `autostart` parameter to true. Remember that you can't mix named an unamed parameters. Assign the yet unamed video id to the parameter `id` like below too.
|
||||
|
||||
{{</* youtube id="w7Ft2ymGmfc" autoplay="true" */>}}
|
||||
|
||||
|
||||
### Vimeo
|
||||
|
||||
Adding a video from [Vimeo](https://vimeo.com/) is equivalent to the YouTube shortcode above. Extract the ID from the URL, e.g.:
|
||||
|
||||
* https://vimeo.com/channels/staffpicks/146022717
|
||||
|
||||
and pass it to the shortcode:
|
||||
|
||||
{{</* vimeo 146022717 */>}}
|
||||
|
||||
### GitHub gists
|
||||
|
||||
Including code snippets with GitHub gists while writing a tutorial is common situation bloggers face. With a given URL of the gist, e.g.:
|
||||
|
||||
* https://gist.github.com/spf13/7896402
|
||||
|
||||
pass the owner and the ID of the gist to the shortcode:
|
||||
|
||||
{{</* gist spf13 7896402 */>}}
|
||||
|
||||
If the gist contains several files and you want to quote just one of them, you can pass the filename (quoted) as an optional third argument:
|
||||
|
||||
{{</* gist spf13 7896402 "img.html" */>}}
|
||||
|
||||
### Speaker Deck
|
||||
|
||||
To embed slides from [Speaker Deck](https://speakerdeck.com/), click on "< /> Embed" (under Share right next to the template on Speaker Deck) and copy the URL, e.g.:
|
||||
|
||||
<script async class="speakerdeck-embed" data-id="4e8126e72d853c0060001f97" data-ratio="1.33333333333333" src="//speakerdeck.com/assets/embed.js"></script>
|
||||
|
||||
Extract the value from the field `data-id` and pass it to the shortcode:
|
||||
|
||||
{{</* speakerdeck 4e8126e72d853c0060001f97 */>}}
|
||||
|
||||
|
||||
## Creating your own shortcodes
|
||||
|
||||
To create a shortcode, place a template in the layouts/shortcodes directory. The
|
||||
template name will be the name of the shortcode.
|
||||
|
||||
In creating a shortcode, you can choose if the shortcode will use _positional
|
||||
parameters_ or _named parameters_ (but not both). A good rule of thumb is that if a
|
||||
parameters_, or _named parameters_, or _both_. A good rule of thumb is that if a
|
||||
shortcode has a single required value in the case of the `youtube` example below,
|
||||
then positional works very well. For more complex layouts with optional
|
||||
parameters, named parameters work best.
|
||||
parameters, named parameters work best. Allowing both types of parameters is
|
||||
useful for complex layouts where you want to set default values that can be
|
||||
overridden.
|
||||
|
||||
**Inside the template**
|
||||
|
||||
@@ -194,13 +264,20 @@ of the content between the opening and closing shortcodes. If a closing
|
||||
shortcode is required, you can check the length of `.Inner` and provide a warning
|
||||
to the user.
|
||||
|
||||
A shortcode with `.Inner` content can be used wihout the inline content, and without the closing shortcode, by using the self-closing syntax:
|
||||
A shortcode with `.Inner` content can be used without the inline content, and without the closing shortcode, by using the self-closing syntax:
|
||||
|
||||
{{</* innershortcode /*/>}}
|
||||
|
||||
The variable `.Params` contains the list of parameters in case you need to do more complicated things than `.Get`.
|
||||
The variable `.Params` contains the list of parameters in case you need to do
|
||||
more complicated things than `.Get`. It is sometimes useful to provide a
|
||||
flexible shortcode that can take named or positional parameters. To meet this
|
||||
need, Hugo shortcodes have a `.IsNamedParams` boolean available that can be used
|
||||
such as `{{ if .IsNamedParams }}...{{ else }}...{{ end }}`. See the
|
||||
`Single Flexible Example` below for an example.
|
||||
|
||||
You can also use the variable `.Page` to access all the normal [Page Variables](/templates/variables/).
|
||||
You can also use the variable `.Page` to access all the normal [Page Variables](/templates/variables/).
|
||||
|
||||
A shortcodes can be nested. In a nested shortcode you can access the parent shortcode context with `.Parent`. This can be very useful for inheritance of common shortcode parameters from the root.
|
||||
|
||||
## Single Positional Example: youtube
|
||||
|
||||
@@ -257,6 +334,32 @@ Would be rendered as:
|
||||
</figcaption>
|
||||
</figure>
|
||||
|
||||
## Single Flexible Example: vimeo with defaults
|
||||
|
||||
{{</* vimeo 49718712 */>}}
|
||||
{{</* vimeo id="49718712" class="flex-video" */>}}
|
||||
|
||||
Would load the template /layouts/shortcodes/vimeo.html
|
||||
|
||||
{{ if .IsNamedParams }}
|
||||
<div class="{{ if .Get "class" }}{{ .Get "class" }}{{ else }}vimeo-container{{ end }}">
|
||||
<iframe src="//player.vimeo.com/video/{{ .Get "id" }}" allowfullscreen></iframe>
|
||||
</div>
|
||||
{{ else }}
|
||||
<div class="{{ if len .Params | eq 2 }}{{ .Get 1 }}{{ else }}vimeo-container{{ end }}">
|
||||
<iframe src="//player.vimeo.com/video/{{ .Get 0 }}" allowfullscreen></iframe>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
Would be rendered as:
|
||||
|
||||
<div class="vimeo-container">
|
||||
<iframe src="//player.vimeo.com/video/49718712" allowfullscreen></iframe>
|
||||
</div>
|
||||
<div class="flex-video">
|
||||
<iframe src="//player.vimeo.com/video/49718712" allowfullscreen></iframe>
|
||||
</div>
|
||||
|
||||
## Paired Example: Highlight
|
||||
*Hugo already ships with the `highlight` shortcode*
|
||||
|
||||
@@ -266,7 +369,7 @@ Would be rendered as:
|
||||
</html>
|
||||
{{</* /highlight */>}}
|
||||
|
||||
The template for this utilizes the following code (already include in Hugo)
|
||||
The template for this utilizes the following code (already included in Hugo)
|
||||
|
||||
{{ .Get 0 | highlight .Inner }}
|
||||
|
||||
@@ -280,4 +383,14 @@ And will be rendered as:
|
||||
Please notice that this template makes use of a Hugo-specific template function
|
||||
called `highlight` which uses Pygments to add the highlighting code.
|
||||
|
||||
## Simple Single-word Example: Year
|
||||
|
||||
Let's assume you would like to have a shortcode to be replaced by the current year in your Markdown content files, for a license or copyright statement. Calling a shortcode like this:
|
||||
|
||||
{{</* year */>}}
|
||||
|
||||
... would load your one-line template ``/layouts/shortcodes/year.html``, which contains:
|
||||
|
||||
{{ .Page.Now.Year }}
|
||||
|
||||
More shortcode examples can be found at [spf13.com](https://github.com/spf13/spf13.com/tree/master/layouts/shortcodes).
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
lastmod: 2015-01-27
|
||||
date: 2013-07-09
|
||||
menu:
|
||||
main:
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
---
|
||||
aliases:
|
||||
- /doc/urls/
|
||||
lastmod: 2016-05-07
|
||||
date: 2014-01-03
|
||||
menu:
|
||||
main:
|
||||
parent: extras
|
||||
next: /community/mailing-list
|
||||
next: /extras/robots-txt
|
||||
notoc: true
|
||||
prev: /extras/toc
|
||||
title: URLs
|
||||
@@ -14,7 +15,7 @@ weight: 110
|
||||
|
||||
## Pretty URLs
|
||||
|
||||
By default, Hugo create content with 'pretty' URLs. For example,
|
||||
By default, Hugo creates content with 'pretty' URLs. For example,
|
||||
content created at `/content/extras/urls.md` will be rendered at
|
||||
`/public/extras/urls/index.html`, thus accessible from the browser
|
||||
at http://example.com/extras/urls/. No non-standard server-side
|
||||
@@ -24,11 +25,11 @@ If you would like to have what we call "ugly URLs",
|
||||
e.g. http://example.com/extras/urls.html, you are in luck.
|
||||
Hugo supports the ability to create your entire site with ugly URLs.
|
||||
Simply add `uglyurls = true` to your site-wide `config.toml`,
|
||||
or use the `--uglyUrls=true` flag on the command line.
|
||||
or use the `--uglyURLs=true` flag on the command line.
|
||||
|
||||
If you want a specific piece of content to have an exact URL, you can
|
||||
specify this in the front matter under the `url` key. See [Content
|
||||
Organization](/content/organization/) for more details.
|
||||
Organization](/content/organization/) for more details.
|
||||
|
||||
## Canonicalization
|
||||
|
||||
@@ -60,3 +61,11 @@ Or, if you are on Windows and do not have `grep` installed:
|
||||
|
||||
hugo config | FINDSTR /I canon
|
||||
|
||||
## Relative URLs
|
||||
|
||||
By default, all relative URLs are left unchanged by Hugo,
|
||||
which can be problematic when you want to make your site browsable from a local file system.
|
||||
|
||||
Setting `relativeURLs` to `true` in the site configuration will cause Hugo to rewrite all relative URLs to be relative to the current content.
|
||||
|
||||
For example, if the `/post/first/` page contained a link with a relative URL of `/about/`, Hugo would rewrite that URL to `../../about/`.
|
||||
|
||||
+181
-50
@@ -3,6 +3,7 @@ aliases:
|
||||
- /doc/license/
|
||||
- /license/
|
||||
- /meta/license/
|
||||
lastmod: 2015-11-25
|
||||
date: 2013-07-01
|
||||
menu:
|
||||
main:
|
||||
@@ -11,70 +12,200 @@ title: License
|
||||
weight: 50
|
||||
---
|
||||
|
||||
Hugo is released under the Simple Public License.
|
||||
Hugo v0.15 and later are released under the Apache 2.0 license.
|
||||
Earlier releases were under the Simple Public License.
|
||||
|
||||
> *Note: There is a plan to switch to [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), for future Hugo releases. This change would only apply forward. Existing versions of Hugo will remain released under the SimPL-2.0 license. For more information, see [the "Switching to Apache 2 license" thread in the public forum](http://discuss.gohugo.io/t/switching-to-apache-2-license/173).*
|
||||
Apache License
|
||||
==============
|
||||
|
||||
## Simple Public License (SimPL-2.0)
|
||||
_Version 2.0, January 2004_
|
||||
_<<http://www.apache.org/licenses/>>_
|
||||
|
||||
### Preamble
|
||||
### Terms and Conditions for use, reproduction, and distribution
|
||||
|
||||
This Simple Public License 2.0 (SimPL-2.0 for short) is a plain language
|
||||
implementation of GPL 2.0. The words are different, but the goal is the
|
||||
same - to guarantee for all users the freedom to share and change
|
||||
software. If anyone wonders about the meaning of the SimPL, they should
|
||||
interpret it as consistent with GPL 2.0.
|
||||
#### 1. Definitions
|
||||
|
||||
“License” shall mean the terms and conditions for use, reproduction, and
|
||||
distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
## Simple Public License (SimPL) 2.0
|
||||
“Licensor” shall mean the copyright owner or entity authorized by the copyright
|
||||
owner that is granting the License.
|
||||
|
||||
The SimPL applies to the software's source and object code and comes
|
||||
with any rights that I have in it (other than trademarks). You agree to
|
||||
the SimPL by copying, distributing, or making a derivative work of the
|
||||
software.
|
||||
“Legal Entity” shall mean the union of the acting entity and all other entities
|
||||
that control, are controlled by, or are under common control with that entity.
|
||||
For the purposes of this definition, “control” means **(i)** the power, direct or
|
||||
indirect, to cause the direction or management of such entity, whether by
|
||||
contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or **(iii)** beneficial ownership of such entity.
|
||||
|
||||
You get the royalty free right to:
|
||||
“You” (or “Your”) shall mean an individual or Legal Entity exercising
|
||||
permissions granted by this License.
|
||||
|
||||
- Use the software for any purpose;
|
||||
- Make derivative works of it (this is called a "Derived Work");
|
||||
- Copy and distribute it and any Derived Work.
|
||||
“Source” form shall mean the preferred form for making modifications, including
|
||||
but not limited to software source code, documentation source, and configuration
|
||||
files.
|
||||
|
||||
If you distribute the software or a Derived Work, you must give back to
|
||||
the community by:
|
||||
“Object” form shall mean any form resulting from mechanical transformation or
|
||||
translation of a Source form, including but not limited to compiled object code,
|
||||
generated documentation, and conversions to other media types.
|
||||
|
||||
- Prominently noting the date of any changes you make;
|
||||
- Leaving other people's copyright notices, warranty disclaimers, and
|
||||
license terms in place;
|
||||
- Providing the source code, build scripts, installation scripts, and
|
||||
interface definitions in a form that is easy to get and best to
|
||||
modify;
|
||||
- Licensing it to everyone under SimPL, or substantially similar terms
|
||||
(such as GPL 2.0), without adding further restrictions to the rights
|
||||
provided;
|
||||
- Conspicuously announcing that it is available under that license.
|
||||
“Work” shall mean the work of authorship, whether in Source or Object form, made
|
||||
available under the License, as indicated by a copyright notice that is included
|
||||
in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
There are some things that you must shoulder:
|
||||
“Derivative Works” shall mean any work, whether in Source or Object form, that
|
||||
is based on (or derived from) the Work and for which the editorial revisions,
|
||||
annotations, elaborations, or other modifications represent, as a whole, an
|
||||
original work of authorship. For the purposes of this License, Derivative Works
|
||||
shall not include works that remain separable from, or merely link (or bind by
|
||||
name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
- You get NO WARRANTIES. None of any kind;
|
||||
- If the software damages you in any way, you may only recover direct
|
||||
damages up to the amount you paid for it (that is zero if you did
|
||||
not pay anything). You may not recover any other damages, including
|
||||
those called "consequential damages." (The state or country where
|
||||
you live may not allow you to limit your liability in this way, so
|
||||
this may not apply to you);
|
||||
“Contribution” shall mean any work of authorship, including the original version
|
||||
of the Work and any modifications or additions to that Work or Derivative Works
|
||||
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
||||
by the copyright owner or by an individual or Legal Entity authorized to submit
|
||||
on behalf of the copyright owner. For the purposes of this definition,
|
||||
“submitted” means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems, and
|
||||
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
||||
the purpose of discussing and improving the Work, but excluding communication
|
||||
that is conspicuously marked or otherwise designated in writing by the copyright
|
||||
owner as “Not a Contribution.”
|
||||
|
||||
The SimPL continues perpetually, except that your license rights end
|
||||
automatically if:
|
||||
“Contributor” shall mean Licensor and any individual or Legal Entity on behalf
|
||||
of whom a Contribution has been received by Licensor and subsequently
|
||||
incorporated within the Work.
|
||||
|
||||
- You do not abide by the "give back to the community" terms (your
|
||||
licensees get to keep their rights if they abide);
|
||||
- Anyone prevents you from distributing the software under the terms
|
||||
of the SimPL.
|
||||
#### 2. Grant of Copyright License
|
||||
|
||||
## License for the License
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the Work and such
|
||||
Derivative Works in Source or Object form.
|
||||
|
||||
You may do anything that you want with the SimPL text; it's a license
|
||||
form to use in any way that you find helpful. To avoid confusion,
|
||||
however, if you change the terms in any way then you may not call your
|
||||
license the Simple Public License or the SimPL (but feel free to
|
||||
acknowledge that your license is "based on the Simple Public License").
|
||||
#### 3. Grant of Patent License
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable (except as stated in this section) patent license to make, have
|
||||
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
||||
such license applies only to those patent claims licensable by such Contributor
|
||||
that are necessarily infringed by their Contribution(s) alone or by combination
|
||||
of their Contribution(s) with the Work to which such Contribution(s) was
|
||||
submitted. If You institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
||||
Contribution incorporated within the Work constitutes direct or contributory
|
||||
patent infringement, then any patent licenses granted to You under this License
|
||||
for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
#### 4. Redistribution
|
||||
|
||||
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
||||
in any medium, with or without modifications, and in Source or Object form,
|
||||
provided that You meet the following conditions:
|
||||
|
||||
* **(a)** You must give any other recipients of the Work or Derivative Works a copy of
|
||||
this License; and
|
||||
* **(b)** You must cause any modified files to carry prominent notices stating that You
|
||||
changed the files; and
|
||||
* **(c)** You must retain, in the Source form of any Derivative Works that You distribute,
|
||||
all copyright, patent, trademark, and attribution notices from the Source form
|
||||
of the Work, excluding those notices that do not pertain to any part of the
|
||||
Derivative Works; and
|
||||
* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
|
||||
Derivative Works that You distribute must include a readable copy of the
|
||||
attribution notices contained within such NOTICE file, excluding those notices
|
||||
that do not pertain to any part of the Derivative Works, in at least one of the
|
||||
following places: within a NOTICE text file distributed as part of the
|
||||
Derivative Works; within the Source form or documentation, if provided along
|
||||
with the Derivative Works; or, within a display generated by the Derivative
|
||||
Works, if and wherever such third-party notices normally appear. The contents of
|
||||
the NOTICE file are for informational purposes only and do not modify the
|
||||
License. You may add Your own attribution notices within Derivative Works that
|
||||
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
||||
provided that such additional attribution notices cannot be construed as
|
||||
modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide
|
||||
additional or different license terms and conditions for use, reproduction, or
|
||||
distribution of Your modifications, or for any such Derivative Works as a whole,
|
||||
provided Your use, reproduction, and distribution of the Work otherwise complies
|
||||
with the conditions stated in this License.
|
||||
|
||||
#### 5. Submission of Contributions
|
||||
|
||||
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
||||
for inclusion in the Work by You to the Licensor shall be under the terms and
|
||||
conditions of this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
||||
any separate license agreement you may have executed with Licensor regarding
|
||||
such Contributions.
|
||||
|
||||
#### 6. Trademarks
|
||||
|
||||
This License does not grant permission to use the trade names, trademarks,
|
||||
service marks, or product names of the Licensor, except as required for
|
||||
reasonable and customary use in describing the origin of the Work and
|
||||
reproducing the content of the NOTICE file.
|
||||
|
||||
#### 7. Disclaimer of Warranty
|
||||
|
||||
Unless required by applicable law or agreed to in writing, Licensor provides the
|
||||
Work (and each Contributor provides its Contributions) on an “AS IS” BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
||||
including, without limitation, any warranties or conditions of TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
||||
solely responsible for determining the appropriateness of using or
|
||||
redistributing the Work and assume any risks associated with Your exercise of
|
||||
permissions under this License.
|
||||
|
||||
#### 8. Limitation of Liability
|
||||
|
||||
In no event and under no legal theory, whether in tort (including negligence),
|
||||
contract, or otherwise, unless required by applicable law (such as deliberate
|
||||
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special, incidental,
|
||||
or consequential damages of any character arising as a result of this License or
|
||||
out of the use or inability to use the Work (including but not limited to
|
||||
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
||||
any and all other commercial damages or losses), even if such Contributor has
|
||||
been advised of the possibility of such damages.
|
||||
|
||||
#### 9. Accepting Warranty or Additional Liability
|
||||
|
||||
While redistributing the Work or Derivative Works thereof, You may choose to
|
||||
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
||||
other liability obligations and/or rights consistent with this License. However,
|
||||
in accepting such obligations, You may act only on Your own behalf and on Your
|
||||
sole responsibility, not on behalf of any other Contributor, and only if You
|
||||
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason of your
|
||||
accepting any such warranty or additional liability.
|
||||
|
||||
_END OF TERMS AND CONDITIONS_
|
||||
|
||||
### APPENDIX: How to apply the Apache License to your work
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate
|
||||
notice, with the fields enclosed by brackets `[]` replaced with your own
|
||||
identifying information. (Don't include the brackets!) The text should be
|
||||
enclosed in the appropriate comment syntax for the file format. We also
|
||||
recommend that a file or class name and description of purpose be included on
|
||||
the same “printed page” as the copyright notice for easier identification within
|
||||
third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
aliases:
|
||||
- /doc/release-notes/
|
||||
- /meta/release-notes/
|
||||
lastmod: 2016-03-12
|
||||
date: 2013-07-01
|
||||
menu:
|
||||
main:
|
||||
@@ -10,6 +11,342 @@ title: Release Notes
|
||||
weight: 10
|
||||
---
|
||||
|
||||
## **0.17.0** October 7th 2016
|
||||
|
||||
Hugo is going global with our 0.17 release. We put a lot of thought into how we could extend Hugo
|
||||
to support multilingual websites with the most simple and elegant experience. Hugo's multilingual
|
||||
capabilities rival the best web and documentation software, but Hugo's experience is unmatched.
|
||||
If you have a single language website, the simple Hugo experience you already love is unchanged.
|
||||
Adding additional languages to your website is simple and straightforward. Hugo has been completely
|
||||
internally rewritten to be multilingual aware with translation and internationalization features
|
||||
embedded throughout Hugo.
|
||||
|
||||
Hugo continues its trend of each release being faster than the last. It's quite a challenge to consistently add
|
||||
significant new functionality and simultaneously dramatically improve performance. {{<gh "@bep">}} has made it
|
||||
his personal mission to apply the Go mantra of "Enable more. Do less" to Hugo. Hugo's consistent improvement
|
||||
is a testament to his brilliance and his dedication to his craft. Hugo is further benefited by the
|
||||
performance improvements from the Go team in the Go 1.7 release.
|
||||
|
||||
This release represents **over 300 contributions by over 70 contributors** to
|
||||
the main Hugo code base. Since last release Hugo has **gained 2000 stars, 50 new
|
||||
contributors and 20 additional themes.**
|
||||
|
||||
Hugo now has:
|
||||
|
||||
* 12,000 stars on GitHub
|
||||
* 370+ contributors
|
||||
* 110+ themes
|
||||
|
||||
{{<gh "@bep" >}} continues to lead the project with the lionshare of contributions
|
||||
and reviews. A special thanks to {{<gh "@bep" >}} and {{<gh "@abourget" >}} for their
|
||||
considerable work on multilingual support.
|
||||
|
||||
A big welcome to newcomers {{<gh "@MarkDBlackwell" >}}, {{<gh "@bogem" >}} and
|
||||
{{<gh "@g3wanghc" >}} for their critical contributions.
|
||||
|
||||
### Highlights
|
||||
|
||||
**Multilingual Support:**
|
||||
Hugo now supports multiple languages side-by-side. A single site can now have multiple languages rendered with
|
||||
full support for translation and i18n.
|
||||
|
||||
**Performance:**
|
||||
Hugo is faster than ever! Hugo 0.17 is not only our fastest release, it's also the most efficient.
|
||||
Hugo 0.17 is **nearly twice as fast as Hugo 0.16** and uses about 10% less memory.
|
||||
This means that the same site will build in nearly half the time it took with Hugo 0.16.
|
||||
For the first time Hugo sites are averaging well under 1ms per rendered content.
|
||||
|
||||
**Docs overhaul:**
|
||||
This release really focused on improving the documentation. [Gohugo.io](http://gohugo.io) is
|
||||
more accurate and complete than ever.
|
||||
|
||||
**Support for Mac OS Sierra**
|
||||
|
||||
### New Features
|
||||
* Multilingual support {{<gh 2303>}}
|
||||
* Allow content expiration {{<gh 2137 >}}
|
||||
* New templates functions:
|
||||
* `querify` function to generate query strings inside templates {{<gh 2257>}}
|
||||
* `htmlEscape` and `htmlUnescape` template functions {{<gh 2287>}}
|
||||
* `time` converts a timestamp string into a time.Time structure {{<gh 2329>}}
|
||||
|
||||
### Enhancements
|
||||
|
||||
* Render the shortcodes as late as possible {{<gh 0xed0985404db4630d1b9d3ad0b7e41fb186ae0112>}}
|
||||
* Remove unneeded casts in page.getParam {{<gh 2186 >}}
|
||||
* Automatic page date fallback {{<gh 2239>}}
|
||||
* Enable safeHTMLAttr {{<gh 2234>}}
|
||||
* Add TODO list support for markdown {{<gh 2296>}}
|
||||
* Make absURL and relURL accept any type {{<gh 2352>}}
|
||||
* Suppress 'missing static' error {{<gh 2344>}}
|
||||
* Make summary, wordcount etc. more efficient {{<gh 2378>}}
|
||||
* Better error reporting in `hugo convert` {{<gh 2440>}}
|
||||
* Reproducible builds thanks to govendor {{<gh 2461>}}
|
||||
|
||||
### Fixes
|
||||
|
||||
* Fix shortcode in markdown headers {{<gh 2210 >}}
|
||||
* Explicitly bind livereload to hugo server port {{<gh 2205>}}
|
||||
* Fix Emojify for certain text patterns {{<gh 2198>}}
|
||||
* Normalize file name to NFC {{<gh 2259>}}
|
||||
* Ignore emacs temp files {{<gh 2266>}}
|
||||
* Handle symlink change event {{<gh 2273>}}
|
||||
* Fix panic when using URLize {{<gh 2274>}}
|
||||
* `hugo import jekyll`: Fixed target path location check {{<gh 2293>}}
|
||||
* Return all errors from casting in templates {{<gh 2356>}}
|
||||
* Fix paginator counter on x86-32 {{<gh 2420>}}
|
||||
* Fix half-broken self-closing shortcodes {{<gh 2499>}}
|
||||
|
||||
****
|
||||
|
||||
## **0.16.0** June 6th 2016
|
||||
|
||||
Hugo 0.16 is our best and biggest release ever. The Hugo community has
|
||||
outdone itself with continued performance improvements,
|
||||
[beautiful themes](http://themes.gohugo.io) for all types of sites from project
|
||||
sites to documentation to blogs to portfolios, and increased stability.
|
||||
|
||||
This release represents **over 550 contributions by over 110 contributors** to
|
||||
the main Hugo code base. Since last release Hugo has **gained 3500 stars, 90
|
||||
contributors and 23 additional themes.**
|
||||
|
||||
This release celebrates 3 years since {{< gh "@spf13" >}} wrote the first lines
|
||||
of Hugo. During those 3 years Hugo has accomplished some major milestones
|
||||
including...
|
||||
|
||||
* 10,000+ stars on GitHub
|
||||
* 320+ contributors
|
||||
* 90+ themes
|
||||
* 1000s of happy websites
|
||||
* Many subprojects like {{< gh "@spf13/cobra">}}, {{< gh "@spf13/viper">}} and
|
||||
{{< gh "@spf13/afero">}} which have experienced broad usage across the Go
|
||||
ecosystem.
|
||||
|
||||
{{< gh "@bep" >}} led the development of Hugo for the 3rd consecutive release
|
||||
with nearly half of the contributions to 0.16 in addition to his considerable
|
||||
contributions as lead maintainer. {{< gh "@anthonyfok" >}}, {{< gh
|
||||
"@DigitalCraftsman" >}}, {{< gh "@MooreReason" >}} all made significant
|
||||
contributions. A special thanks to {{< gh "@abourget " >}} for his considerable
|
||||
work on multilingual support. Due to its broad impact we wanted to spend more
|
||||
time testing it and it will be included in Hugo's next release.
|
||||
|
||||
### Highlights
|
||||
|
||||
**Partial Builds:** Prior to this release Hugo would always reread and rebuild
|
||||
the entire site. This release introduces support for reactive site building
|
||||
while watching (`hugo server`). Hugo will watch the filesystem for changes and
|
||||
only re-read the changed files. Depending on the files change Hugo will
|
||||
intelligently re-render only the needed portion of the site. Performance gains
|
||||
depend on the operation performed and size of the site. In our testing build
|
||||
times decreased anywhere from 10% to 99%.
|
||||
|
||||
**Template Improvements:** Template improvements continue to be a mainstay of each Hugo release. Hugo 0.16 adds support for the new `block` keyword introduced in Go 1.6 -- think base templates with default sections -- as well as many new template functions.
|
||||
|
||||
**Polish:** As Hugo matures releases will inevitably contain fewer huge new features. This release represents hundreds of small improvements across ever facet of Hugo which will make for a much better experience for all of our users. Worth mentioning here is the curious bug where live reloading didn't work in some editors on OS X, including the popular TextMate 2. This is now fixed. Oh, and now any error will exit with an error code, a big thing for automated deployments.
|
||||
|
||||
### New Features
|
||||
* Support reading configuration variables from the OS environment {{<gh 2090 >}}
|
||||
* Add emoji support {{<gh 1892>}}
|
||||
* Add `themesDir` option to configuration {{<gh 1556>}}
|
||||
* Add support for Go 1.6 `block` keyword in templates {{<gh 1832>}}
|
||||
* Partial static sync {{<gh 1644>}}
|
||||
* Source file based relative linking (a la Github) {{<gh 0x0f6b334b6715253b030c4e783b88e911b6e53e56>}}
|
||||
* Add `ByLastmod` sort function to pages. {{<gh 0xeb627ca16de6fb5e8646279edd295a8bf0f72bf1 >}}
|
||||
* New templates functions:
|
||||
* `readFile` {{<gh 1551 >}}
|
||||
* `countwords` and `countrunes` {{<gh 1440>}}
|
||||
* `default` {{<gh 1943>}}
|
||||
* `hasPrefix` {{<gh 1243>}}
|
||||
* `humanize` {{<gh 1818>}}
|
||||
* `jsonify` {{<gh 0x435e996c4fd48e9009ffa9f83a19fb55f0777dbd>}}
|
||||
* `md5` and `sha1` {{<gh 1932>}}
|
||||
* `replaceRE` {{<gh 1845>}}
|
||||
* `findRE` {{<gh 2048>}}
|
||||
* `shuffle` {{<gh 1942>}}
|
||||
* `slice` {{<gh 1902>}}
|
||||
* `plainify` {{<gh 1915>}}
|
||||
|
||||
### Enhancements
|
||||
|
||||
* Hugo now exits with error code on any error. This is a big thing for
|
||||
automated deployments. {{<gh 740 >}}
|
||||
* Print error when `/index.html` is zero-length {{<gh 947>}}
|
||||
* Enable dirname and filename bash autocompletion for more flags {{<gh
|
||||
0x666ddd237791b56fd048992dca9a27d1af50a10e>}}
|
||||
* Improve error handling in commands {{<gh 1502>}}
|
||||
* Add sanity checks for `hugo import jekyll` {{<gh 1625 >}}
|
||||
* Add description to `Page.Params` {{<gh 1484>}}
|
||||
* Add async version of Google Analytics internal template {{<gh 1711>}}
|
||||
* Add autostart option to YouTube shortcode {{<gh 1784>}}
|
||||
* Set Date and Lastmod for main home page {{<gh 1903>}}
|
||||
* Allow URL with extension in frontmatter {{<gh 1923>}}
|
||||
* Add list support in Scratch {{<gh
|
||||
0xeaba04e82bdfc5d4c29e970f11b4aab9cc0efeaa>}}
|
||||
* Add file option to gist shortcode {{<gh 1955>}}
|
||||
* Add config layout and content directory CLI options {{<gh 1698>}}
|
||||
* Add boolean value comparison to `where` template function {{<gh
|
||||
0xf3c74c9db484c8961e70cb3458f9e41e7832fa12>}}
|
||||
* Do not write to to cache when `ignoreCache` is set {{<gh 2067>}}
|
||||
* Add option to disable rendering of 404 page {{<gh 2037>}}
|
||||
* Mercurial is no longer needed to build Hugo {{<gh 2062 >}}
|
||||
* Do not create `robots.txt` by default {{<gh 2049>}}
|
||||
* Disable syntax guessing for PygmentsCodeFences by default. To enable syntax
|
||||
guessing again, add the following to your config file:
|
||||
`PygmentsCodeFencesGuessSyntax = true` {{<gh 2034>}}
|
||||
* Make `ByCount` sort consistently {{<gh 1930>}}
|
||||
* Add `Scratch` to shortcode {{<gh 2000>}}
|
||||
* Add support for symbolic links for content, layout, static, theme {{<gh 1855
|
||||
>}}
|
||||
* Add '+' as one of the valid characters in URLs specified in the front matter
|
||||
{{<gh 1290 >}}
|
||||
* Make alias redirect output URLs relative when `RelativeURLs = true` {{<gh
|
||||
2093 >}}
|
||||
* Hugo injects meta generator tag on homepage if missing {{<gh
|
||||
2182 >}}
|
||||
|
||||
### Fixes
|
||||
* Fix file change watcher for TextMate 2 and friends on OS X {{<gh 1053 >}}
|
||||
* Make dynamic reloading of config file reliable on all platform {{<gh 1684 >}}
|
||||
* Hugo now works on Linux/arm64 {{<gh 1772 >}}
|
||||
* `plainIDAnchors` now defaults to `true` {{<gh 2057>}}
|
||||
* Win32 and ARM builds fixed {{<gh 1716>}}
|
||||
* Copy static dir files without theme's static dir {{<gh 1656>}}
|
||||
* Make `noTimes` command flag work {{<gh 1657>}}
|
||||
* Change most global CLI flags into local ones {{<gh 1624>}}
|
||||
* Remove transformation of menu URLs {{<gh 1239>}}
|
||||
* Do not fail on unknown Jekyll file {{<gh 1705>}}
|
||||
* Use absolute path when editing with editor {{<gh 1589>}}
|
||||
* Fix hugo server "Watching for changes" path display {{<gh 1721>}}
|
||||
* Do not strip special characters out of URLs {{<gh 1292>}}
|
||||
* Fix `RSSLink` when uglyurls are enabled {{<gh 175>}}
|
||||
* Get BaseURL from viper in server mode {{<gh 1821>}}
|
||||
* Fix shortcode handling in RST {{<gh 1904>}}
|
||||
* Use default sitemap configuration for homepage {{<gh 1304>}}
|
||||
* Exit if specific port is unavailable in server mode {{<gh 1901>}}
|
||||
* Fix regression in "section menus for lazy blogger" {{<gh 2065>}}
|
||||
|
||||
****
|
||||
|
||||
## **0.15.0** November 25, 2015
|
||||
|
||||
The v0.15.0 Hugo release brings a lot of polish to Hugo. Exactly 6 months after
|
||||
the 0.14 release, Hugo has seen massive growth and changes. Most notably, this
|
||||
is Hugo's first release under the Apache 2.0 license. With this license change
|
||||
we hope to expand the great community around Hugo and make it easier for our
|
||||
many users to contribute. This release represents over **377 contributions by
|
||||
87 contributors** to the main Hugo repo and hundreds of improvements to the
|
||||
libraries Hugo uses. Hugo also launched a [new theme
|
||||
showcase](http://themes.gohugo.io) and participated in
|
||||
[Hacktoberfest](https://hacktoberfest.digitalocean.com).
|
||||
|
||||
Hugo now has:
|
||||
|
||||
* 6700 (+2700) stars on GitHub
|
||||
* 235 (+75) contributors
|
||||
* 65 (+30) themes
|
||||
|
||||
|
||||
**Template Improvements:** This release takes Hugo to a new level of speed and
|
||||
usability. Considerable work has been done adding features and performance to
|
||||
the template system which now has full support of Ace, Amber and Go Templates.
|
||||
|
||||
**Hugo Import:** Have a Jekyll site, but dreaming of porting it to Hugo? This
|
||||
release introduces a new `hugo import jekyll`command that makes this easier
|
||||
than ever.
|
||||
|
||||
**Performance Improvements:** Just when you thought Hugo couldn't get any faster,
|
||||
Hugo continues to improve in speed while adding features. Notably Hugo 0.15
|
||||
introduces the ability to render and serve directly from memory resulting in
|
||||
30%+ lower render times.
|
||||
|
||||
Huge thanks to all who participated in this release. A special thanks to
|
||||
{{< gh "@bep" >}} who led the development of Hugo this release again,
|
||||
{{< gh "@anthonyfok" >}},
|
||||
{{< gh "@eparis" >}},
|
||||
{{< gh "@tatsushid" >}} and
|
||||
{{< gh "@DigitalCraftsman" >}}.
|
||||
|
||||
|
||||
### New features
|
||||
* new `hugo import jekyll` command. {{< gh 1469 >}}
|
||||
* The new `Param` convenience method on `Page` and `Node` can be used to get the most specific parameter value for a given key. {{< gh 1462 >}}
|
||||
* Several new information elements have been added to `Page` and `Node`:
|
||||
* `RuneCount`: The number of [runes](http://blog.golang.org/strings) in the content, excluding any whitespace. This may be a good alternative to `.WordCount` for Japanese and other CJK languages where a word-split by spaces makes no sense. {{< gh 1266 >}}
|
||||
* `RawContent`: Raw Markdown as a string. One use case may be of embedding remarkjs.com slides.
|
||||
* `IsHome`: tells the truth about whether you're on the home page or not.
|
||||
|
||||
### Improvements
|
||||
* `hugo server` now builds ~30%+ faster by rendering to memory instead of disk. To get the old behavior, start the server with `--renderToDisk=true`.
|
||||
* Hugo now supports dynamic reloading of the config file when watching.
|
||||
* We now use a custom-built `LazyFileReader` for reading file contents, which means we don't read media files in `/content` into memory anymore -- and file reading is now performed in parallel on multicore PCs. {{< gh 1181 >}}
|
||||
* Hugo is now built with `Go 1.5` which, among many other improvements, have fixed the last known data race in Hugo. {{< gh 917 >}}
|
||||
* Paginator now also supports page groups. {{< gh 1274 >}}
|
||||
* Markdown improvements:
|
||||
* Hugo now supports GitHub-flavoured markdown code fences for highlighting for `md`-files (Blackfriday rendered markdown) and `mmark` files (MMark rendered markdown). {{< gh 362 1258 >}}
|
||||
* Several new Blackfriday options are added:
|
||||
* Option to disable Blackfriday's `Smartypants`.
|
||||
* Option for Blackfriday to open links in a new window/tab. {{< gh 1220 >}}
|
||||
* Option to disable Blackfriday's LaTeX style dashes {{< gh 1231 >}}
|
||||
* Definition lists extension support.
|
||||
* `Scratch` now has built-in `map` support.
|
||||
* We now fall back to `link title` for the default page sort. {{< gh 1299 >}}
|
||||
* Some notable new configuration options:
|
||||
* `IgnoreFiles` can be set with a list of Regular Expressions that matches files to be ignored during build. {{< gh 1189 >}}
|
||||
* `PreserveTaxonomyNames`, when set to `true`, will preserve what you type as the taxonomy name both in the folders created and the taxonomy `key`, but it will be normalized for the URL. {{< gh 1180 >}}
|
||||
* `hugo gen` can now generate man files, bash auto complete and markdown documentation
|
||||
* Hugo will now make suggestions when a command is mistyped
|
||||
* Shortcodes now have a boolean `.IsNamedParams` property. {{< gh 1597 >}}
|
||||
|
||||
### New Template Features
|
||||
* All template engines:
|
||||
* The new `dict` function that could be used to pass maps into a template. {{< gh 1463 >}}
|
||||
* The new `pluralize` and `singularize` template funcs.
|
||||
* The new `base64Decode` and `base64Encode` template funcs.
|
||||
* The `sort` template func now accepts field/key chaining arguments and pointer values. {{< gh 1330 >}}
|
||||
* Several fixes for `slicestr` and `substr`, most importantly, they now have full `utf-8`-support. {{< gh 1190 1333 1347 >}}
|
||||
* The new `last` template function allows the user to select the last `N` items of a slice. {{< gh 1148 >}}
|
||||
* The new `after` func allows the user to select the items after the `Nth` item. {{< gh 1200 >}}
|
||||
* Add `time.Time` type support to the `where`, `ge`, `gt`, `le`, and `lt` template functions.
|
||||
* It is now possible to use constructs like `where Values ".Param.key" nil` to filter pages that doesn't have a particular parameter. {{< gh 1232 >}}
|
||||
* `getJSON`/`getCSV`: Add retry on invalid content. {{< gh 1166 >}}
|
||||
* The new `readDir` func lists local files. {{< gh 1204 >}}
|
||||
* The new `safeJS` function allows the embedding of content into JavaScript contexts in Go templates.
|
||||
* Get the main site RSS link from any page by accessing the `.Site.RSSLink` property. {{< gh 1566 >}}
|
||||
* Ace templates:
|
||||
* Base templates now also works in themes. {{< gh 1215 >}}.
|
||||
* And now also on Windows. {{< gh 1178 >}}
|
||||
* Full support for Amber templates including all template functions.
|
||||
* A built-in template for Google Analytics. {{< gh 1505 >}}
|
||||
* Hugo is now shipped with new built-in shortcodes: {{< gh 1576 >}}
|
||||
* `youtube` for YouTube videos
|
||||
* `vimeo` for Vimeo videos
|
||||
* `gist` for GitHub gists
|
||||
* `tweet` for Twitter Tweets
|
||||
* `speakerdeck` for Speakerdeck slides
|
||||
|
||||
|
||||
### Bugfixes
|
||||
* Fix data races in page sorting and page reversal. These operations are now also cached. {{< gh 1293 >}}
|
||||
* `page.HasMenuCurrent()` and `node.HasMenuCurrent()` now work correctly in multi-level nested menus.
|
||||
* Support `Fish and Chips` style section titles. Previously, this would end up as `Fish And Chips`. Now, the first character is made toupper, but the rest are preserved as-is. {{< gh 1176 >}}
|
||||
* Hugo now removes superfluous p-tags around shortcodes. {{< gh 1148 >}}
|
||||
|
||||
### Notices
|
||||
* `hugo server` will watch by default now.
|
||||
* Some fields and methods were deprecated in `0.14`. These are now removed, so the error message isn't as friendly if you still use the old values. So please change:
|
||||
* `getJson` to `getJSON`, `getCsv` to `getCSV`, `safeHtml` to
|
||||
`safeHTML`, `safeCss` to `safeCSS`, `safeUrl` to `safeURL`, `Url` to `URL`,
|
||||
`UrlPath` to `URLPath`, `BaseUrl` to `BaseURL`, `Recent` to `Pages`.
|
||||
|
||||
### Known Issues
|
||||
|
||||
Using the Hugo v0.15 32-bit Windows or ARM binary, running `hugo server` would crash or hang due to a [memory alignment issue](https://golang.org/pkg/sync/atomic/#pkg-note-BUG) in [Afero](https://github.com/spf13/afero). The bug was discovered shortly after the v0.15.0 release and has since been [fixed](https://github.com/spf13/afero/pull/23) by {{< gh "@tpng" >}}. If you encounter this bug, you may either compile Hugo v0.16-DEV from source, or use the following solution/workaround:
|
||||
|
||||
* **64-bit Windows users: Please use [hugo_0.15_windows_amd64.zip](https://github.com/spf13/hugo/releases/download/v0.15/hugo_0.15_windows_amd64.zip)** (amd64 == x86-64). It is only the 32-bit hugo_0.15_windows_386.zip that crashes/hangs (see {{< gh 1621 >}} and {{< gh 1628 >}}).
|
||||
* **32-bit Windows and ARM users: Please run `hugo server --renderToDisk` as a workaround** until Hugo v0.16 is released (see [“hugo server” returns runtime error on armhf](https://discuss.gohugo.io/t/hugo-server-returns-runtime-error-on-armhf/2293) and {{< gh 1716 >}}).
|
||||
|
||||
----
|
||||
|
||||
## **0.14.0** May 25, 2015
|
||||
|
||||
The v0.14.0 Hugo release brings of the most demanded features to Hugo. The
|
||||
@@ -33,32 +370,32 @@ community.
|
||||
This release represents over **240 contributions by 36 contributors** to the main
|
||||
Hugo codebase.
|
||||
|
||||
Big shout out to [@bep](https://github.com/bep) who led the development of Hugo
|
||||
this release, [@anthonyfok](https://github.com/anthonyfok),
|
||||
[@eparis](https://github.com/eparis),
|
||||
[@SchumacherFM](https://github.com/SchumacherFM),
|
||||
[@RickCogley](https://github.com/RickCogley) &
|
||||
[@mdhender](https://github.com/mdhender) for their significant contributions
|
||||
and [@tatsushid](https://github.com/tatsushid) for his continuous improvements
|
||||
Big shout out to {{< gh "@bep" >}} who led the development of Hugo
|
||||
this release, {{< gh "@anthonyfok" >}},
|
||||
{{< gh "@eparis" >}},
|
||||
{{< gh "@SchumacherFM" >}},
|
||||
{{< gh "@RickCogley" >}} &
|
||||
{{< gh "@mdhender" >}} for their significant contributions
|
||||
and {{< gh "@tatsushid" >}} for his continuous improvements
|
||||
to the templates. Also a big thanks to all the theme creators. 11 new themes
|
||||
have been added since last release and the [hugoThemes repo now has previews of
|
||||
all of
|
||||
them](https://github.com/spf13/hugoThemes/blob/master/README.md#theme-list).
|
||||
|
||||
Hugo also depends on a lot of other great projects. A big thanks to all of our dependencies inclding:
|
||||
Hugo also depends on a lot of other great projects. A big thanks to all of our dependencies including:
|
||||
[cobra](https://github.com/spf13/cobra),
|
||||
[viper](https://github.com/spf13/viper),
|
||||
[viper](https://github.com/spf13/viper),
|
||||
[blackfriday](https://github.com/russross/blackfriday),
|
||||
[pflag](https://github.com/spf13/pflag),
|
||||
[HugoThemes](https://github.com/spf13/hugothemes),
|
||||
[BurntSushi](github.com/BurntSushi/toml),
|
||||
[BurntSushi](https://github.com/BurntSushi/toml),
|
||||
[goYaml](https://github.com/go-yaml/yaml/tree/v2), and the Go standard library.
|
||||
|
||||
## New features
|
||||
* Support for all file types in content directory.
|
||||
* Support for all file types in content directory.
|
||||
* If dedicated file type handler isn’t found it will be copied to the destination.
|
||||
* Add `AsciiDoc` support using external helpers.
|
||||
* Add experimental support for [`Mmark`](https://github.com/miekg/mmark) markdown processor
|
||||
* Add experimental support for [`Mmark`](https://github.com/miekg/mmark) markdown processor
|
||||
* Bash autocomplete support via `genautocomplete` command
|
||||
* Add section menu support for a [Section Menu for "the Lazy Blogger"]({{< relref "extras/menus.md#section-menu-for-the-lazy-blogger" >}})
|
||||
* Add support for `Ace` base templates
|
||||
@@ -66,11 +403,11 @@ Hugo also depends on a lot of other great projects. A big thanks to all of our d
|
||||
* New template functions:
|
||||
* `getenv`
|
||||
* The string functions `substr` and `slicestr`
|
||||
*`seq`, a sequence generator very similar to its Gnu countepart
|
||||
* `seq`, a sequence generator very similar to its Gnu counterpart
|
||||
* `absURL` and `relURL`, both of which takes the `BaseURL` setting into account
|
||||
|
||||
## Improvements
|
||||
* Highlighting with `Pygments` is now cached to disk -- expect a major speed boost if you use it!
|
||||
* Highlighting with `Pygments` is now cached to disk -- expect a major speed boost if you use it!
|
||||
* More Pygments highlighting options, including `line numbers`
|
||||
* Show help information to Windows users who try to double click on `hugo.exe`.
|
||||
* Add `bind` flag to `hugo server` to set the interface to which the server will bind
|
||||
@@ -82,9 +419,9 @@ Hugo also depends on a lot of other great projects. A big thanks to all of our d
|
||||
## Bugfixes
|
||||
* Fix panic with paginator and zero pages in result set.
|
||||
* Fix crossrefs on Windows.
|
||||
* Fix `eq` and `ne` template functions when used with a raw number combined with the result of `add`, `sub` etc.
|
||||
* Fix `eq` and `ne` template functions when used with a raw number combined with the result of `add`, `sub` etc.
|
||||
* Fix paginator with uglyurls
|
||||
* Fix [#998](https://github.com/spf13/hugo/issues/988), supporting UTF8 characters in Permalinks.
|
||||
* Fix {{< gh 998 >}}, supporting UTF8 characters in Permalinks.
|
||||
|
||||
## Notices
|
||||
* To get variable and function names in line with the rest of the Go community,
|
||||
@@ -95,6 +432,9 @@ Hugo also depends on a lot of other great projects. A big thanks to all of our d
|
||||
`UrlPath` to `URLPath`, `BaseUrl` to `BaseURL`, `Recent` to `Pages`,
|
||||
`Indexes` to `Taxonomies`.
|
||||
|
||||
|
||||
----
|
||||
|
||||
## **0.13.0** Feb 21, 2015
|
||||
|
||||
The v0.13.0 release is the largest Hugo release to date. The release introduced
|
||||
@@ -105,19 +445,19 @@ the code changes, the Hugo community has grown significantly and now has over
|
||||
|
||||
This release represents **448 contributions by 65 contributors**
|
||||
|
||||
A special shout out to [@bep](https://github.com/bep) and
|
||||
[@anthonyfok](https://github.com/anthonyfok) for their new role as Hugo
|
||||
A special shout out to {{< gh "@bep" >}} and
|
||||
{{< gh "@anthonyfok" >}} for their new role as Hugo
|
||||
maintainers and their tremendous contributions this release.
|
||||
|
||||
### New major features
|
||||
* Support for [data files](/extras/datafiles/) in [YAML](http://yaml.org/),
|
||||
[JSON](http://www.json.org/), or [TOML](https://github.com/toml-lang/toml)
|
||||
located in the `data` directory ([#885][])
|
||||
located in the `data` directory ({{< gh 885 >}})
|
||||
* Support for [dynamic content](/extras/dynamiccontent/) by loading JSON & CSV
|
||||
from remote sources via GetJson and GetCsv in short codes or other layout
|
||||
files ([#748][])
|
||||
files ({{< gh 748 >}})
|
||||
* [Pagination support](/extras/pagination/) for home page, sections and
|
||||
taxonomies ([#750][])
|
||||
taxonomies ({{< gh 750 >}})
|
||||
* Universal sequencing support
|
||||
* A new, generic Next/Prev functionality is added to all lists of pages
|
||||
(sections, taxonomies, etc.)
|
||||
@@ -125,8 +465,8 @@ maintainers and their tremendous contributions this release.
|
||||
* `Scratch` -- [a "scratchpad"](/extras/scratch) for your node- and page-scoped
|
||||
variables
|
||||
* [Cross Reference](/extras/crossreferences/) support to easily link documents
|
||||
together with the ref and relref shortcodes.
|
||||
* [Ace](http://ace.yoss.si/) template engine support ([#541][])
|
||||
together with the ref and relref shortcodes.
|
||||
* [Ace](http://ace.yoss.si/) template engine support ({{< gh 541 >}})
|
||||
* A new [shortcode](/extras/shortcodes/) token of `{{</* */>}}` (raw HTML)
|
||||
alongside the existing `{{%/* */%}}` (Markdown)
|
||||
* A top level `Hugo` variable (on Page & Node) is added with various build
|
||||
@@ -143,7 +483,7 @@ maintainers and their tremendous contributions this release.
|
||||
### Notable enhancements to existing features
|
||||
|
||||
* The [shortcode](/extras/shortcodes/) handling is rewritten for speed and
|
||||
better error messages.
|
||||
better error messages.
|
||||
* Several improvements to the [template functions](/templates/functions/):
|
||||
* `where` is now even more powerful and accepts SQL-like syntax with the
|
||||
operators `==`, `eq`; `!=`, `<>`, `ne`; `>=`, `ge`; `>`, `gt`; `<=`,
|
||||
@@ -156,7 +496,7 @@ maintainers and their tremendous contributions this release.
|
||||
* `delimit`
|
||||
* `sort`
|
||||
* `markdownify`
|
||||
* `in` and `intersect`
|
||||
* `in` and `intersect`
|
||||
* `trim`
|
||||
* `replace`
|
||||
* `dateFormat`
|
||||
@@ -165,8 +505,8 @@ maintainers and their tremendous contributions this release.
|
||||
* Configuration of footnote rendering
|
||||
* Optional support for smart angled quotes, e.g. `"Hugo"` → «Hugo»
|
||||
* Enable descriptive header IDs
|
||||
* URLs in XML output is now correctly canonified ([#725][], [#728][], and part
|
||||
of [#789][])
|
||||
* URLs in XML output is now correctly canonified ({{< gh 725 728 >}}, and part
|
||||
of {{< gh 789 >}})
|
||||
|
||||
### Other improvements
|
||||
|
||||
@@ -174,7 +514,7 @@ maintainers and their tremendous contributions this release.
|
||||
and providing measurable performance improvements overall
|
||||
* Changes to docs:
|
||||
* A new [Troubleshooting](/troubleshooting/overview/) section is added
|
||||
* It's now searchable through Google Custom Search ([#753][])
|
||||
* It's now searchable through Google Custom Search ({{< gh 753 >}})
|
||||
* Some new great tutorials:
|
||||
* [Automated deployments with
|
||||
Wercker](/tutorials/automated-deployments/)
|
||||
@@ -183,21 +523,12 @@ maintainers and their tremendous contributions this release.
|
||||
* Improved unit test coverage
|
||||
* Fixed a lot of Windows-related path issues
|
||||
* Improved error messages for template and rendering errors
|
||||
* Enabled soft LiveReload of CSS and images ([#490][])
|
||||
* Various fixes in RSS feed generation ([#789][])
|
||||
* Enabled soft LiveReload of CSS and images ({{< gh 490 >}})
|
||||
* Various fixes in RSS feed generation ({{< gh 789 >}})
|
||||
* `HasMenuCurrent` and `IsMenuCurrent` is now supported on Nodes
|
||||
* A bunch of [bug fixes](https://github.com/spf13/hugo/commits/master)
|
||||
|
||||
[#490]: https://github.com/spf13/hugo/pull/490 "Pull Request #490: Livereload CSS and images without browser refresh"
|
||||
[#541]: https://github.com/spf13/hugo/pull/541 "Pull Request #541: Add Ace template engine support"
|
||||
[#725]: https://github.com/spf13/hugo/issues/725 "Issue #725: CanonifyUrls does not canonicalize urls in RSS"
|
||||
[#728]: https://github.com/spf13/hugo/issues/728 "Pull Request #728: Add ability to canonify URLs in rendered XML output."
|
||||
[#748]: https://github.com/spf13/hugo/issues/748 "Feature: GetJson and GetJson in short codes or other layout files"
|
||||
[#750]: https://github.com/spf13/hugo/issues/750 "Pull Request: Add pagination support for home page, sections and taxonomies"
|
||||
[#753]: https://github.com/spf13/hugo/issues/753 "Add search to documentation"
|
||||
[#789]: https://github.com/spf13/hugo/issues/789 "Issue #789: RSS feeds do not validate"
|
||||
[#885]: https://github.com/spf13/hugo/issues/885 "Feature/datadir"
|
||||
|
||||
----
|
||||
|
||||
## **0.12.0** Sept 1, 2014
|
||||
|
||||
@@ -224,6 +555,8 @@ This release represents over 90 code commits from 28 different contributors.
|
||||
* Better feedback about draft & future post rendering
|
||||
* A variety of improvements to [the website](http://gohugo.io/)
|
||||
|
||||
----
|
||||
|
||||
## **0.11.0** May 28, 2014
|
||||
|
||||
This release represents over 110 code commits from 29 different contributors.
|
||||
@@ -245,6 +578,8 @@ This release represents over 110 code commits from 29 different contributors.
|
||||
* Renamed Indexes > [Taxonomies](/taxonomies/overview/)
|
||||
* Renamed Chrome > [Partials](/templates/partials/)
|
||||
|
||||
----
|
||||
|
||||
## **0.10.0** March 1, 2014
|
||||
|
||||
This release represents over 110 code commits from 29 different contributors.
|
||||
@@ -264,6 +599,8 @@ This release represents over 110 code commits from 29 different contributors.
|
||||
* Launched website [showcase](/showcase/). Show off your own hugo site!
|
||||
* A bunch of [bug fixes](https://github.com/spf13/hugo/commits/master)
|
||||
|
||||
----
|
||||
|
||||
## **0.9.0** November 15, 2013
|
||||
|
||||
This release represents over 220 code commits from 22 different contributors.
|
||||
@@ -299,6 +636,8 @@ This release represents over 220 code commits from 22 different contributors.
|
||||
* Support for go 1.2
|
||||
* Support for `first` in templates
|
||||
|
||||
----
|
||||
|
||||
## **0.8.0** August 2, 2013
|
||||
|
||||
This release represents over 65 code commits from 6 different contributors.
|
||||
@@ -316,13 +655,18 @@ This release represents over 65 code commits from 6 different contributors.
|
||||
* Adding verbose output
|
||||
* Loads of bugfixes
|
||||
|
||||
----
|
||||
|
||||
## **0.7.0** July 4, 2013
|
||||
* Hugo now includes a simple server
|
||||
* First public release
|
||||
|
||||
----
|
||||
|
||||
## **0.6.0** July 2, 2013
|
||||
* Hugo includes an example documentation site which it builds
|
||||
|
||||
----
|
||||
|
||||
## **0.5.0** June 25, 2013
|
||||
* Hugo is quite usable and able to build spf13.com
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user