* add buttons to copy code block contents
Adds a clickable "copy" link in the top-right corner of each code block.
If available, uses the navigator.clipboard API. Falls back to selecting
the text and calling document.execCommand('copy') to copy text.
* hides copy button unless mouse is hovering over code block
* change text of copy button when text is copied
* add translation keys for copy button text `code_copy` and `code_copied`
* To disable use `Params.disableCodeCopy: true` in site config
`.File.Path` is OS dependant and uses `\` as directory separator. This leads to
cases where posts get the wrong URL, if in a sub folder, e.g.
`content/posts/folder\post.md`.
One idea was to replace `\` with `/` this however breaks valid files (on Unix
systems) which include `\` in the file name.
According to the docs [`path.Join`](layouts/partials/edit_post.html) is OS
unaware and converts to a Unix-like path.
> Note: All path elements on Windows are converted to slash ('/') separators.
PS: It looks like hugo also uses this internally to build URLs.
PPS: Solution was discussed in #278.
cp from ffd9dac4218b8f1709de04f7131ca661715fc481 & fe77f7434bc0d7a9b54af69014eb28dbea2b236b
tpl: Update date logic of opengraph and schema internal
templates
* Fix: updated date logic in opengraph template
* Updated date logic in schema template
* Reformatted opengraph and schema
* Wrapped PublishDate and Lastmod in with
tpl: Make the build green again
Co-authored-by: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= <bjorn.erik.pedersen@gmail.com>
Signed-off-by: Aditya Telange <21258296+adityatelange@users.noreply.github.com>
Usage
- in site config =>
Params:
editPost:
URL: "https://github.com/<path_to_repo>/content"
Text: "Suggest Changes" # edit text
appendFilePath: true # to append file path to Edit link
- in front-matter vars =>
---
editPost:
URL: "https://github.com/<path_to_repo>/content"
Text: "Suggest Changes" # edit text
appendFilePath: true # to append file path to Edit link
---
- Front-matter vars overrides global ones
* Without this, the section name gets mangled when the language was a
sub-string of the section. For example, under 'en', a section named
"fragment" changes to "fragmt".
Usage:
{{< figure align=center src="image.jpg" >}}
Parameter values:
- 'center': align image and captions to center of page
- anything else neglected
* Appends "#center" to the image's URL in order to utilize existing CSS
rules for centering images.