Переглянути джерело

Add `staticref` shortcode for linking files + update docs (#236)

George Cushen 8 роки тому
батько
коміт
a2b482dc10

+ 9 - 1
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]{{</* ref "cv.md" */>}}` 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.

+ 4 - 0
exampleSite/content/post/writing-markdown-latex.md

@@ -57,6 +57,10 @@ A numbered figure with caption:
     [A publication]({{</* ref "publication/hi.md" */>}})
     [A project]({{</* ref "project/hi.md" */>}})
     [Another section]({{</* relref "hi.md#who" */>}})
+    
+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
 

+ 1 - 0
layouts/shortcodes/staticref.html

@@ -0,0 +1 @@
+<a href="{{ .Page.Site.BaseURL }}{{ .Get 0 }}"/>{{ .Inner }}</a>