From a2b482dc10c0cd818d9f4cf8cfff2d682b683d21 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Sun, 3 Sep 2017 17:06:06 +0100 Subject: [PATCH] Add `staticref` shortcode for linking files + update docs (#236) --- exampleSite/content/post/managing-content.md | 10 +++++++++- exampleSite/content/post/writing-markdown-latex.md | 4 ++++ layouts/shortcodes/staticref.html | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 layouts/shortcodes/staticref.html diff --git a/exampleSite/content/post/managing-content.md b/exampleSite/content/post/managing-content.md index 843fd2c6..392e4666 100644 --- a/exampleSite/content/post/managing-content.md +++ b/exampleSite/content/post/managing-content.md @@ -25,6 +25,8 @@ caption = "Image credit: [**Academic**](https://github.com/gcushen/hugo-academic If you wish to prevent a featured image automatically being used for a post's thumbnail on the homepage, the `preview = false` parameter can be added to `[header]`. {{% /alert %}} +{{% toc%}} + ## Create a publication To create a new publication: @@ -70,7 +72,7 @@ If you enabled `detailed_list` for publications in `config.toml`, then there are Any double quotes (`"`) or backslashes (e.g. LaTeX `\times`) occurring within the value of any frontmatter parameter (such as the *abstract*) should be escaped with a backslash (`\`). For example, the symbol `"` and LaTeX text `\times` become `\"` and `\\times`, respectively. Refer to the [TOML documentation](https://github.com/toml-lang/toml#user-content-string) for more info. {{% /alert %}} -## Post an article +## Create a blog post To create a blog/news article: @@ -100,6 +102,12 @@ To create a talk: Then edit the newly created file `content/talk/my-talk-name.md` with your full talk title and details. Note that many of the talk parameters are similar to the publication parameters. +## Create other pages (e.g. CV) + +For other types of content, it is possible to create your own custom pages. For example, let's create a `cv.md` page for your Curriculum Vitae in your `content` folder. Copy across the frontmatter from the top of one of your post files, adapting it as necessary, and editing your Markdown content below. You can then link to your new page by adding the code `[My CV]{{}}` to any of your existing content. + +Alternatively, for the above example, we could use a PDF of your Curriculum Vitae. For this purpose, create a folder called `files` within your `static` folder and move a PDF file named `cv.pdf` to that location, so we have a `static/files/cv.pdf` file path. The PDF can then be linked to from any content by using the code: `{{%/* staticref "files/cv.pdf" */%}}Download my CV{{%/* /staticref */%}}`. + ## Manage node index pages The node index pages (e.g. `/post/`) are the special pages which list all of your content. They can exist for blog posts, publications, and talks. The homepage widgets will automatically link to the node index pages when you have more items of content than can be displayed in the widget. Therefore, if you don't have much content, you may not see the automatic links yet - but you can also manually link to them using a normal Markdown formatted link in your content. diff --git a/exampleSite/content/post/writing-markdown-latex.md b/exampleSite/content/post/writing-markdown-latex.md index 220658f6..62aa0938 100644 --- a/exampleSite/content/post/writing-markdown-latex.md +++ b/exampleSite/content/post/writing-markdown-latex.md @@ -57,6 +57,10 @@ A numbered figure with caption: [A publication]({{}}) [A project]({{}}) [Another section]({{}}) + +To enable linking to a file, such as a PDF, first place the file in your `static/files/` folder and then link to it using the following form: + + {{%/* staticref "files/cv.pdf" */%}}Download my CV{{%/* /staticref */%}} ## Emojis diff --git a/layouts/shortcodes/staticref.html b/layouts/shortcodes/staticref.html new file mode 100644 index 00000000..2a6eabb9 --- /dev/null +++ b/layouts/shortcodes/staticref.html @@ -0,0 +1 @@ +{{ .Inner }}