Commit graph

334 commits

Author SHA1 Message Date
Hannu Hartikainen 6708f7637c
Implement get_file_hash (#1044)
* Fix get_url(cachebust=true)

The previous implementation looked for static files in the wrong place.
Look in static_path, output_path and content_path. If file can't be
found in any of them, print a warning to stderr and fall back to using
a timestamp.

Add a test to ensure it also works in practice, not just in theory.

* Implement get_file_hash
2020-06-09 22:38:29 +02:00
Vincent Prouillet a3a5b9ea06
Merge pull request #976 from getzola/next
0.11.0
2020-05-25 18:14:42 +02:00
Vincent Prouillet 3a292d294a Prepare for release 2020-05-25 10:26:30 +02:00
Hannu Hartikainen 36ec33f042
Change get_url(cachebust=true) to use a hash (#1032)
Cache-busting was previously done with a compile-time timestamp. Change
to the SHA-256 hash of the file to avoid refreshing unchanged files.

The implementation could be used to add a new global fn (say,
get_file_hash) for subresource integrity use, but that's for another
commit.

Fixes #519.

Co-authored-by: Vincent Prouillet <balthek@gmail.com>
2020-05-23 11:46:50 +02:00
Hannu Hartikainen a7657f30ab
Use {{ page.permalink | safe }} in tutorial (#1024)
The `&#x2F;` urls are confusing to newcomers (at least myself). Use the best practice in the tutorial (see issue #129).
2020-05-13 08:40:06 +02:00
Vincent Prouillet fbf431d612 Update syntect, using rust-onig with bindgen temporarily 2020-05-12 20:07:02 +02:00
Vincent Prouillet bc496e6101 Update syntaxes and syntect 2020-04-29 22:35:28 +02:00
southerntofu e3dc8bbab5
Access heading level in anchor-link.html (#1008)
* Add lvl variable in anchor-link context

* Add docs about lvl in anchor-link.html

* Rename lvl => level
2020-04-29 19:40:25 +02:00
Adrian Sieber 79b2338bd3
Fix path of generated page (#1011) 2020-04-27 09:35:53 +02:00
Clément Joly 6b91328e81
Typos (#1010) 2020-04-26 20:35:59 +02:00
Gelez 7b3279befd
Theme docs: actually edit the config (#996)
I hope it is just not me that misunderstood the sentence above, but I think it should be `true` and not `false`.
2020-04-22 09:48:08 +02:00
Vincent Prouillet c04e6ebaf5 Some tweaks 2020-04-21 19:28:58 +02:00
Vincent Prouillet 07e0853183 Update themes 2020-04-15 18:53:46 +02:00
Chris Morgan 4653e68715 Add lang, taxonomy and term to feed template
Also a FIXME on the rebuilding part, because it’s presently very wrong.
2020-04-14 17:29:51 +05:30
Chris Morgan eb7751955a WIP: add an 'updated' field to pages
Also change a few other things to use it, as noted in CHANGELOG.md.

TODO:

- Write a couple of tests: updated field, last_updated template variable

One slight open questions: should `updated` default to the value of
`date` rather than to None? Then pages with `date` could safely assume
`updated`.
2020-04-14 17:29:46 +05:30
Chris Morgan 048949ea31 Rename last_build_date to latest_date
The variable name matched the RSS tag it ended up in, but was misleading
about what it actually was—because if you actually want “last build
date”, you should use `now()`. (Due to the potential for edits, I think
that either there should be an official `updated` field on pages, or
that these templates should use `now()`.)
2020-04-14 17:27:08 +05:30
Chris Morgan e25915b231 Support and default to generating Atom feeds
This includes several breaking changes, but they’re easy to adjust for.

Atom 1.0 is superior to RSS 2.0 in a number of ways, both technical and
legal, though information from the last decade is hard to find.
http://www.intertwingly.net/wiki/pie/Rss20AndAtom10Compared
has some info which is probably still mostly correct.

How do RSS and Atom compare in terms of implementation support? The
impression I get is that proper Atom support in normal content websites
has been universal for over twelve years, but that support in podcasts
was not quite so good, but getting there, over twelve years ago. I have
no more recent facts or figures; no one talks about this stuff these
days. I remember investigating this stuff back in 2011–2013 and coming
to the same conclusion. At that time, I went with Atom on websites and
RSS in podcasts. Now I’d just go full Atom and hang any podcast tools
that don’t support Atom, because Atom’s semantics truly are much better.

In light of all this, I make the bold recommendation to default to Atom.

Nonetheless, for compatibility for existing users, and for those that
have Opinions, I’ve retained the RSS template, so that you can escape
the breaking change easily.

I personally prefer to give feeds a basename that doesn’t mention “Atom”
or “RSS”, e.g. “feed.xml”. I’ll be doing that myself, as I’ll be using
my own template with more Atom features anyway, like author information,
taxonomies and making the title field HTML.

Some notes about the Atom feed template:

- I went with atom.xml rather than something like feed.atom (the .atom
  file format being registered for this purpose by RFC4287) due to lack
  of confidence that it’ll be served with the right MIME type. .xml is a
  safer default.

- It might be nice to get Zola’s version number into the <generator>
  tag. Not for any particularly good reason, y’know. Just picture it:

    <generator uri="https://www.getzola.org/" version="0.10.0">
	Zola
    </generator>

- I’d like to get taxonomies into the feed, but this requires exposing a
  little more info than is currently exposed. I think it’d require
  `TaxonomyConfig` to preferably have a new member `permalink` added
  (which should be equivalent to something like `config.base_url ~ "/" ~
  taxonomy.slug ~ "/"`), and for the feed to get all the taxonomies
  passed into it (`taxonomies: HashMap<String, TaxonomyTerm>`).
  Then, the template could be like this, inside the entry:

    {% for taxonomy, terms in page.taxonomies %}
        {% for term in terms %}
            <category scheme="{{ taxonomies[taxonomy].permalink }}"
		term="{{ term.slug }}" label="{{ term.name }}" />
	{% endfor %}
    {% endfor %}

Other remarks:

- I have added a date field `extra.updated` to my posts and include that
  in the feed; I’ve observed others with a similar field. I believe this
  should be included as an official field. I’m inclined to add author to
  at least config.toml, too, for feeds.
- We need to have a link from the docs to the source of the built-in
  templates, to help people that wish to alter it.
2020-04-14 17:27:08 +05:30
Chris Morgan cc64803553 Fix documentation of TaxonomyConfig fields
It doesn’t have a field named slug.

It does have a field named lang.
2020-04-14 17:27:08 +05:30
Chris Morgan 896c30d892 Fix a broken Markdown link in the docs
Whitespace is not allowed between the `]` and `(`.
2020-04-14 17:27:08 +05:30
Chris Morgan c2dd408df4 Fix obsolete slugify_paths documentation 2020-04-14 17:27:08 +05:30
0xC45 167b2b9974
Fix sass documentation error in example path name (#991) 2020-04-12 21:38:53 +02:00
GaaH 41bbaeb970
Add an optionnal lang parameter to get_url (#982)
* get_url takes an optionnal  parameter

* Documentation about the 'lang' parameter of 'get_url'

Co-authored-by: Gaëtan Caillaut <gaetan.caillaut@live.com>
2020-04-12 19:23:17 +02:00
Vincent Prouillet b2eb00a374 Ensure lang is always set on default sections 2020-04-12 19:17:29 +02:00
Vincent Prouillet fb6cbe008f Mention how to get config variables in templates 2020-04-12 18:48:00 +02:00
Vincent Prouillet 469babbd97 Update docs on markdown filter
Closes #989
2020-04-12 17:26:01 +02:00
Vincent Prouillet 56e25132a9 Update deps + fix some misleading doc 2020-04-12 17:21:04 +02:00
Vincent Prouillet 4242723e4d Update syntect dump files 2020-03-12 21:04:01 +01:00
Vincent Prouillet 6eb8d34644
Merge pull request #951 from getzola/next
0.10.1
2020-03-12 20:59:20 +01:00
Andrew Barchuk 2e6d996709
Fix a pair of Tera links (#968) 2020-03-11 07:59:54 +01:00
Damian Carrillo 1a3e91f5f4
Fixing a missing link to Tera Filters (#966)
The previous link results in a 404. This is the updated link.
2020-03-09 08:15:18 +01:00
SasakiSaki 073e24659d
Add highlight for lyric (#949)
* Add highlight for lyric files

* Add highlight theme nyx-bold

* Update the documents

* Add highlight for subtitle files
2020-02-21 14:14:25 +01:00
Aphek cc67bf0c88
Change continue-reading to use a span with id instead of a named anchor in a paragraph (#941)
* Change continue-reading to use a span element instead of named anchor

* Fix all tests
2020-02-07 21:07:10 +01:00
Vincent Prouillet ac3ced828b
Multiple slugification strategies (#929) 2020-02-05 09:13:14 +01:00
Vincent Prouillet 782cc7d686 Fix some more merge conflicts 2020-02-02 17:50:36 -08:00
Vincent Prouillet be149646f6 Update livereload.js 2020-02-02 17:48:43 -08:00
ethereal 94445ae745 Add --root global argument. Fixes #899. (#932) 2020-02-02 17:48:43 -08:00
photong 5ba4d47538 Docs next (#858)
* Update installation.md

* Update cli-usage.md

* Update installation.md

* Update directory-structure.md

* Update configuration.md

* Update overview.md

* Update section.md

* Update page.md

* Update section.md

* Update configuration.md

* Update page.md

* Update section.md

* Update page.md

* Update shortcodes.md

* Update linking.md

* Update table-of-contents.md

* Update syntax-highlighting.md

* Update taxonomies.md

* Update search.md

* Update sass.md

* Update index.md

* Update multilingual.md

* Update overview.md

* Update pages-sections.md

* Update pagination.md

* Update taxonomies.md

* Update rss.md

* Update sitemap.md

* Update robots.md

* Update 404.md

* Update archive.md

* Update overview.md

* Update installing-and-using-themes.md

* Update creating-a-theme.md

* Update netlify.md

* Update github-pages.md

* Update gitlab-pages.md

* Updates.

* Skip link checking for URL with prefix in config (#846)

* Fix some doc changes

* Section extra -> SitemapEntry (#850)

* Update deps

* Remove tutorial link.

* Update overview.md

* Update page.md

* Update section.md

* Update netlify.md

* Update overview.md

* Change some wording.

* Update overview.md

Co-authored-by: Tjeu Kayim <15987676+TjeuKayim@users.noreply.github.com>
Co-authored-by: Vincent Prouillet <balthek@gmail.com>
Co-authored-by: Stan Rozenraukh <stan@stanistan.com>
2020-02-02 17:48:43 -08:00
Vincent Prouillet ceb9bc8ed7 Optionally do not slugify paths (#875)
* maybe_slugify() only does simple sanitation if config.slugify is false

* slugify is disabled by default, turn on for backwards-compatibility

* First docs changes for optional slugification

* Remove # from slugs but not &

* Add/fix tests for utf8 slugs

* Fix test sites for i18n slugs

* fix templates tests for i18n slugs

* Rename slugify setting to slugify_paths

* Default slugify_paths

* Update documentation for slugify_paths

* quasi_slugify removes ?, /, # and newlines

* Remove forbidden NTFS chars in quasi_slugify()

* Slugification forbidden chars can be configured

* Remove trailing dot/space in quasi_slugify

* Fix NTFS path sanitation

* Revert configurable slugification charset

* Remove \r for windows newlines and \t tabulations in quasi_slugify()

* Update docs for output paths

* Replace slugify with slugify_paths

* Fix test

* Default to not slugifying

* Move slugs utils to utils crate

* Use slugify_paths for anchors as well
2020-02-02 17:48:43 -08:00
Philipp Oppermann 72373bea9b Add path to TranslatedContent (#863)
* Add path to `TranslatedContent`

This makes it possible to retrieve the translated page through the `get_page` function.

* Use TranslatedContent::path field in test_site_i18n

Use it with the `get_page` function to get a reference to the page object.
2020-02-02 17:48:43 -08:00
Vincent Prouillet 1a6edbcf63 Fix some doc changes 2020-02-02 17:48:42 -08:00
photong 51d4b6bd6a Simple clean up of documentation. (#849)
* Update installation.md

* Update cli-usage.md

* Update installation.md

* Update directory-structure.md

* Update configuration.md

* Update overview.md

* Update section.md

* Update page.md

* Update section.md

* Update configuration.md

* Update page.md

* Update section.md

* Update page.md

* Update shortcodes.md

* Update linking.md

* Update table-of-contents.md

* Update syntax-highlighting.md

* Update taxonomies.md

* Update search.md

* Update sass.md

* Update index.md

* Update multilingual.md

* Update overview.md

* Update pages-sections.md

* Update pagination.md

* Update taxonomies.md

* Update rss.md

* Update sitemap.md

* Update robots.md

* Update 404.md

* Update archive.md

* Update overview.md

* Update installing-and-using-themes.md

* Update creating-a-theme.md

* Update netlify.md

* Update github-pages.md

* Update gitlab-pages.md

* Update index.md

* Update page.md

* Update section.md

* Updates.
2020-02-02 17:48:42 -08:00
Tjeu Kayim 75570d041a Skip link checking for URL with prefix in config (#846) 2020-02-02 17:47:01 -08:00
Morgan e8dc33ad08 fixes #844 duplicate entries in doc (#845) 2020-02-02 17:47:01 -08:00
Geobert Quach 3f166285de Paginator total pages (#829)
* feat(pagination): Add `total_pages` in paginator object

* feat(pagination): Added doc for `total_pages`

* feat(pagination): Added test for `total_pages`
2020-02-02 17:45:16 -08:00
Tjeu Kayim 6149fd17e1 Skip anchor checking for URL with prefix in config (#812)
* cargo fmt & clippy

* Skip anchor checking for URL with prefix in config
2020-02-02 17:45:16 -08:00
Bob 4aa2ba84fc Let toc is visable through Page & Section variables in templates (#818)
* Let toc is visable through Page & Section variables in templates

* Removed the current toc variable from page & section
2020-02-02 17:44:38 -08:00
Vincent Prouillet cb4056c0f2 Add zenburn theme
Closes #813
2020-02-02 17:44:38 -08:00
Vincent Prouillet 6856b11d6d Looks like it now requires 1.36 2020-02-02 17:44:38 -08:00
Christopher Murphy 21b45aff10 fix: update year in docs template (#917)
Updated the copyright year in the docs template to reflect the new year.
2020-01-10 10:30:42 +01:00
Einar e194294664 Pages -> Page (#903) 2019-12-26 13:55:54 +01:00