Преглед изворни кода

refactor: convert archetypes from TOML to YAML

George Cushen пре 6 година
родитељ
комит
7cb7e497f7

+ 25 - 16
archetypes/default.md

@@ -1,20 +1,29 @@
-+++
-title = "{{ replace .Name "-" " " | title }}"
-date = {{ .Date }}
-draft = false
+---
+# Documentation: https://sourcethemes.com/academic/docs/managing-content/
 
-# Tags and categories
-# For example, use `tags = []` for no tags, or the form `tags = ["A Tag", "Another Tag"]` for one or more tags.
-tags = []
-categories = []
+title: "{{ replace .Name "-" " " | title }}"
+subtitle: ""
+summary: ""
+authors: []
+tags: []
+categories: []
+date: {{ .Date }}
+lastmod: {{ .Date }}
+featured: false
+draft: false
 
 # Featured image
-# To use, add an image named `featured.jpg/png` to your page's folder. 
-[image]
-  # Caption (optional)
-  caption = ""
+# To use, add an image named `featured.jpg/png` to your page's folder.
+# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
+image:
+  caption: ""
+  focal_point: ""
+  preview_only: false
 
-  # Focal point (optional)
-  # Options: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight
-  focal_point = ""
-+++
+# Projects (optional).
+#   Associate this post with one or more of your projects.
+#   Simply enter your project's folder or file name without extension.
+#   E.g. `projects = ["internal-project"]` references `content/project/deep-learning/index.md`.
+#   Otherwise, set `projects = []`.
+projects: []
+---

+ 20 - 22
archetypes/docs.md

@@ -1,25 +1,23 @@
-+++
-title = "{{ replace .Name "-" " " | title }}"
-date = {{ .Date }}
-draft = false
-type = "docs"  # Do not modify.
+---
+# Documentation: https://sourcethemes.com/academic/docs/managing-content/
 
-# Show table of contents? true/false
-toc = true
+title: "{{ replace .Name "-" " " | title }}"
+linktitle: "{{ replace .Name "-" " " | title }}"
+summary:
+date: {{ .Date }}
+lastmod: {{ .Date }}
+draft: false  # Is this a draft? true/false
+toc: true  # Show table of contents? true/false
+type: docs  # Do not modify.
 
 # Add menu entry to sidebar.
-
-# Uncomment to customize menu title, e.g. to abbreviate page title.
-# linktitle = "Example"
-
-# Substitute `tutorial` with the name of your tutorials folder.
-[menu.tutorial]
-  # Define a parent ID if this page is a parent.
-  name = "YourParentID"
-  
-  # Reference a parent ID if this page is a child.
-  # parent = "YourParentID"
-  
-  # Order that this page appears in the menu.
-  weight = 1
-+++
+# - Substitute `example` with the name of your course/documentation folder.
+# - name: Declare this menu item as a parent with ID `name`.
+# - parent: Reference a parent ID if this page is a child.
+# - weight: Position of link in menu.
+menu:
+  example:
+    name: YourParentID
+    # parent: YourParentID
+    weight: 1
+---

+ 23 - 33
archetypes/post/index.md

@@ -1,39 +1,29 @@
-+++
-title = "{{ replace .Name "-" " " | title }}"
-subtitle = ""
+---
+# Documentation: https://sourcethemes.com/academic/docs/managing-content/
+
+title: "{{ replace .Name "-" " " | title }}"
+subtitle: ""
+summary: ""
+authors: []
+tags: []
+categories: []
+date: {{ .Date }}
+lastmod: {{ .Date }}
+featured: false
+draft: false
 
-# Add a summary to display on homepage (optional).
-summary = ""
-
-date = {{ .Date }}
-draft = false
-
-# Authors. Comma separated list, e.g. `["Bob Smith", "David Jones"]`.
-authors = []
-
-# Is this a featured post? (true/false)
-featured = false
-
-# Tags and categories
-# For example, use `tags = []` for no tags, or the form `tags = ["A Tag", "Another Tag"]` for one or more tags.
-tags = []
-categories = []
+# Featured image
+# To use, add an image named `featured.jpg/png` to your page's folder.
+# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
+image:
+  caption: ""
+  focal_point: ""
+  preview_only: false
 
 # Projects (optional).
 #   Associate this post with one or more of your projects.
 #   Simply enter your project's folder or file name without extension.
-#   E.g. `projects = ["deep-learning"]` references 
-#   `content/project/deep-learning/index.md`.
+#   E.g. `projects = ["internal-project"]` references `content/project/deep-learning/index.md`.
 #   Otherwise, set `projects = []`.
-# projects = ["internal-project"]
-
-# Featured image
-# To use, add an image named `featured.jpg/png` to your page's folder. 
-[image]
-  # Caption (optional)
-  caption = ""
-
-  # Focal point (optional)
-  # Options: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight
-  focal_point = ""
-+++
+projects: []
+---

+ 34 - 38
archetypes/project/index.md

@@ -1,45 +1,41 @@
-+++
-title = "{{ replace .Name "-" " " | title }}"
-date = {{ .Date }}
-draft = false
+---
+# Documentation: https://sourcethemes.com/academic/docs/managing-content/
 
-# Tags: can be used for filtering projects.
-# Example: `tags = ["machine-learning", "deep-learning"]`
-tags = []
-
-# Project summary to display on homepage.
-summary = ""
-
-# Slides (optional).
-#   Associate this page with Markdown slides.
-#   Simply enter your slide deck's filename without extension.
-#   E.g. `slides = "example-slides"` references 
-#   `content/slides/example-slides.md`.
-#   Otherwise, set `slides = ""`.
-slides = ""
+title: "{{ replace .Name "-" " " | title }}"
+summary: ""
+authors: []
+tags: []
+categories: []
+date: {{ .Date }}
 
 # Optional external URL for project (replaces project detail page).
-external_link = ""
+external_link: ""
 
-# Links (optional).
-url_pdf = ""
-url_code = ""
-url_dataset = ""
-url_slides = ""
-url_video = ""
-url_poster = ""
+# Featured image
+# To use, add an image named `featured.jpg/png` to your page's folder.
+# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
+image:
+  caption: ""
+  focal_point: ""
+  preview_only: false
 
 # Custom links (optional).
-#   Uncomment line below to enable. For multiple links, use the form `[{...}, {...}, {...}]`.
-# links = [{icon_pack = "fab", icon="twitter", name="Follow", url = "https://twitter.com"}]
+#   Uncomment and edit lines below to show custom links.
+# links:
+# - name: Follow
+#   url: https://twitter.com
+#   icon_pack: fab
+#   icon: twitter
+
+url_code: ""
+url_pdf: ""
+url_slides: ""
+url_video: ""
 
-# Featured image
-# To use, add an image named `featured.jpg/png` to your page's folder. 
-[image]
-  # Caption (optional)
-  caption = ""
-
-  # Focal point (optional)
-  # Options: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight
-  focal_point = ""
-+++
+# Slides (optional).
+#   Associate this project with Markdown slides.
+#   Simply enter your slide deck's filename without extension.
+#   E.g. `slides = "example-slides"` references `content/slides/example-slides.md`.
+#   Otherwise, set `slides = ""`.
+slides: ""
+---

+ 52 - 68
archetypes/publication/index.md

@@ -1,85 +1,69 @@
-+++
-title = "{{ replace .Name "-" " " | title }}"
+---
+# Documentation: https://sourcethemes.com/academic/docs/managing-content/
 
-# Publication date.
-date = {{ .Date }}
+title: "{{ replace .Name "-" " " | title }}"
+authors: []
+date: {{ .Date }}
+doi: ""
 
-# Schedule page publish date.
-publishDate = {{ .Date }}
-
-# Authors. Comma separated list, e.g. `["Bob Smith", "David Jones"]`.
-authors = []
+# Schedule page publish date (NOT publication's date).
+publishDate: {{ .Date }}
 
 # Publication type.
-# Legend:
-# 0 = Uncategorized
-# 1 = Conference paper
-# 2 = Journal article
-# 3 = Preprint / Working Paper
-# 4 = Report
-# 5 = Book
-# 6 = Book section
-# 7 = Thesis
-# 8 = Patent
-publication_types = ["0"]
+# Legend: 0 = Uncategorized; 1 = Conference paper; 2 = Journal article;
+# 3 = Preprint / Working Paper; 4 = Report; 5 = Book; 6 = Book section;
+# 7 = Thesis; 8 = Patent
+publication_types: ["0"]
 
-# Publication name and optional abbreviated version.
-publication = ""
-publication_short = ""
+# Publication name and optional abbreviated publication name.
+publication: ""
+publication_short: ""
 
-# Abstract.
-abstract = ""
+abstract: ""
 
 # Summary. An optional shortened abstract.
-summary = ""
+summary: ""
 
-# Digital Object Identifier (DOI)
-doi = ""
+tags: []
+categories: []
+featured: false
 
-# Is this a featured publication? (true/false)
-featured = false
+# Custom links (optional).
+#   Uncomment and edit lines below to show custom links.
+# links:
+# - name: Follow
+#   url: https://twitter.com
+#   icon_pack: fab
+#   icon: twitter
+
+url_pdf:
+url_code:
+url_dataset:
+url_poster:
+url_project:
+url_slides:
+url_source:
+url_video:
 
-# Tags (optional).
-#   Set `tags = []` for no tags, or use the form `tags = ["A Tag", "Another Tag"]` for one or more tags.
-tags = []
+# Featured image
+# To use, add an image named `featured.jpg/png` to your page's folder. 
+# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
+image:
+  caption: ""
+  focal_point: ""
+  preview_only: false
 
-# Projects (optional).
+# Associated Projects (optional).
 #   Associate this publication with one or more of your projects.
 #   Simply enter your project's folder or file name without extension.
-#   E.g. `projects = ["deep-learning"]` references 
-#   `content/project/deep-learning/index.md`.
-#   Otherwise, set `projects = []`.
-projects = []
+#   E.g. `internal-project` references `content/project/internal-project/index.md`.
+#   Otherwise, set `projects: []`.
+projects: []
 
 # Slides (optional).
-#   Associate this page with Markdown slides.
+#   Associate this publication with Markdown slides.
 #   Simply enter your slide deck's filename without extension.
-#   E.g. `slides = "example-slides"` references 
-#   `content/slides/example-slides.md`.
-#   Otherwise, set `slides = ""`.
-slides = ""
-
-# Links (optional).
-url_pdf = ""
-url_code = ""
-url_dataset = ""
-url_project = ""
-url_slides = ""
-url_video = ""
-url_poster = ""
-url_source = ""
-
-# Custom links (optional).
-#   Uncomment line below to enable. For multiple links, use the form `[{...}, {...}, {...}]`.
-# links = [{name = "Custom Link", url = "http://example.org"}]
-
-# Featured image
-# To use, add an image named `featured.jpg/png` to your page's folder. 
-[image]
-  # Caption (optional)
-  caption = ""
-
-  # Focal point (optional)
-  # Options: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight
-  focal_point = ""
-+++
+#   E.g. `slides: "example"` references `content/slides/example/index.md`.
+#   Otherwise, set `slides: ""`.
+slides: ""
+---

+ 14 - 17
archetypes/slides/index.md

@@ -1,24 +1,19 @@
-+++
-title = "{{ replace .Name "-" " " | title }}"
-date = {{ .Date }}
-
-# Add a summary (optional).
-summary = ""
-
-# Authors, tags, and categories
-#   Use a comma separated list, e.g. `["Bob Smith", "David Jones"]`.
-authors = []
-tags = []
-categories = []
+---
+# Documentation: https://sourcethemes.com/academic/docs/managing-content/
 
-[slides]
+title: "{{ replace .Name "-" " " | title }}"
+summary: ""
+authors: []
+tags: []
+categories: []
+date: {{ .Date }}
+slides:
   # Choose a theme from https://github.com/hakimel/reveal.js#theming
-  theme = "black"
-  
+  theme: black
   # Choose a code highlighting style (if highlighting enabled in `params.toml`)
   #   Light style: github. Dark style: dracula (default).
-  highlight_style = "dracula"
-+++
+  highlight_style: dracula
+---
 
 # Title
 
@@ -27,3 +22,5 @@ Author Name
 ---
 
 ## Slide 2
+
+...

+ 45 - 52
archetypes/talk/index.md

@@ -1,69 +1,62 @@
-+++
-title = "{{ replace .Name "-" " " | title }}"
+---
+# Documentation: https://sourcethemes.com/academic/docs/managing-content/
+
+title: "{{ replace .Name "-" " " | title }}"
+event:
+event_url:
+location:
+summary:
+abstract:
 
 # Talk start and end times.
 #   End time can optionally be hidden by prefixing the line with `#`.
-date = {{ .Date }}
-date_end = {{ .Date }}
-all_day = false
+date: {{ .Date }}
+date_end: {{ .Date }}
+all_day: false
 
 # Schedule page publish date (NOT talk date).
-publishDate = {{ .Date }}
-
-# Authors. Comma separated list, e.g. `["Bob Smith", "David Jones"]`.
-authors = []
-
-# Location of event.
-location = ""
-
-# Name of event and optional event URL.
-event = ""
-event_url = ""
+publishDate: {{ .Date }}
 
-# Abstract. What's your talk about?
-abstract = ""
-
-# Summary. An optional shortened abstract.
-summary = ""
+authors: []
+tags: []
 
 # Is this a featured talk? (true/false)
-featured = false
+featured: false
 
-# Tags (optional).
-#   Set `tags = []` for no tags, or use the form `tags = ["A Tag", "Another Tag"]` for one or more tags.
-tags = []
+# Featured image
+# To use, add an image named `featured.jpg/png` to your page's folder. 
+# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
+image:
+  caption: ""
+  focal_point: ""
+  preview_only: false
+
+# Custom links (optional).
+#   Uncomment and edit lines below to show custom links.
+# links:
+# - name: Follow
+#   url: https://twitter.com
+#   icon_pack: fab
+#   icon: twitter
+
+# Optional filename of your slides within your talk's folder or a URL.
+url_slides:
+
+url_code:
+url_pdf:
+url_video:
 
 # Markdown Slides (optional).
-#   Associate this page with Markdown slides.
+#   Associate this talk with Markdown slides.
 #   Simply enter your slide deck's filename without extension.
-#   E.g. `slides = "example-slides"` references 
-#   `content/slides/example-slides.md`.
+#   E.g. `slides = "example-slides"` references `content/slides/example-slides.md`.
 #   Otherwise, set `slides = ""`.
-slides = ""
-
-# Optional filename of your slides within your talk folder or a URL.
-url_slides = ""
+slides: ""
 
 # Projects (optional).
-#   Associate this talk with one or more of your projects.
+#   Associate this post with one or more of your projects.
 #   Simply enter your project's folder or file name without extension.
-#   E.g. `projects = ["deep-learning"]` references 
-#   `content/project/deep-learning/index.md`.
+#   E.g. `projects = ["internal-project"]` references `content/project/deep-learning/index.md`.
 #   Otherwise, set `projects = []`.
-projects = []
-
-# Links (optional).
-url_pdf = ""
-url_video = ""
-url_code = ""
-
-# Featured image
-# To use, add an image named `featured.jpg/png` to your page's folder. 
-[image]
-  # Caption (optional)
-  caption = ""
-
-  # Focal point (optional)
-  # Options: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight
-  focal_point = ""
-+++
+projects: []
+---

+ 3 - 3
layouts/partials/page_links.html

@@ -138,15 +138,15 @@
   {{ if in (slice "fab" "fas" "far" "fal") $pack }}
     {{ $pack_prefix = "fa" }}
   {{ end }}
-  {{ $link := .url }}
+  {{ $link := .url | default "" }}
   {{ $scheme := (urls.Parse $link).Scheme }}
   {{ $target := "" }}
   {{ if not $scheme }}
-    {{ $resource := $page.Resources.GetMatch .url }}
+    {{ $resource := $page.Resources.GetMatch $link }}
     {{ if $resource }}
       {{ $link = $resource.RelPermalink }}
     {{ else }}
-      {{ $link = .url | relURL }}
+      {{ $link = $link | relURL }}
     {{ end }}
   {{ else if in (slice "http" "https") $scheme }}
     {{ $target = "target=\"_blank\" rel=\"noopener\"" }}