2
0
mirror of https://github.com/inventree/inventree-website.git synced 2025-04-27 21:16:45 +00:00
This commit is contained in:
Matthias Mair 2022-04-23 14:27:04 +02:00
parent 563217de16
commit 7705d45ada
7 changed files with 71 additions and 22 deletions

View File

@ -23,6 +23,9 @@ collections:
output: true
custom_permalink_placeholders: ["publisher"]
#permalink: "/:publisher/:title"
news:
output: true
permalink: /news/:year/:month/:day/:title
posts:
permalink: /blog/:year/:month/:day/:title
@ -42,6 +45,11 @@ defaults:
type: "posts"
values:
layout: "post"
- scope:
path: ""
type: "news"
values:
layout: "news"
- scope:
path: ""
values:

View File

@ -6,6 +6,8 @@
site: demo-link
- name: Plugins
internal: plugins.html
- name: News
internal: news.html
- title: Contribute
link:

View File

@ -0,0 +1,24 @@
---
layout: default
---
<header>
{% if page.backLink or page.backLink == nil %}
<a href="{{ layout.base_link | relative_url }}" class="flex items-center m-5 text-xl hover:underline">
<img class="w-6 h-6" src="{{ '/assets/back.svg' | relative_url }}" />
<span>Back</span>
</a>
{% endif %}
</header>
<article>
<h1>{{ page.title }}</h1>
<p>
{{ page.date | date_to_string }}
{% assign publisher = site.publishers | where: 'short_name', page.publisher | first %}
{% if publisher %}
- <a href="{{ publisher.url | relative_url }}">{{ publisher.name }}</a>
{% endif %}
</p>
{{ content }}
</article>

5
_layouts/news.html Normal file
View File

@ -0,0 +1,5 @@
---
layout: collection_base
base_link: '/news'
---
{{ content }}

View File

@ -1,24 +1,5 @@
---
layout: default
layout: collection_base
base_link: '/blog'
---
<header>
{% if page.backLink or page.backLink == nil %}
<a href="{{ '/blog' | relative_url }}" class="flex items-center m-5 text-xl hover:underline">
<img class="w-6 h-6" src="{{ '/assets/back.svg' | relative_url }}" />
<span>Back</span>
</a>
{% endif %}
</header>
<article>
<h1>{{ page.title }}</h1>
<p>
{{ page.date | date_to_string }}
{% assign publisher = site.publishers | where: 'short_name', page.publisher | first %}
{% if publisher %}
- <a href="{{ publisher.url | relative_url }}">{{ publisher.name }}</a>
{% endif %}
</p>
{{ content }}
</article>
{{ content }}

View File

@ -0,0 +1,7 @@
---
publisher: matmair
title: Starting with templates
---
A good starting-point for developing your own plugin is taking a look at the [documentation](https://inventree.readthedocs.io/en/latest/extend/plugins/).
You could also use one of the current plugins as a sample.

22
news.html Normal file
View File

@ -0,0 +1,22 @@
---
layout: default
title: News
permalink: /news
---
<section class="cm-gray-2 body-font">
<div class="pt-3 pb-1 section-container">
<h1 class="header-text title-font mb-4 cm-gray-2">InvenTree News</h1>
<div class="flex flex-wrap">
{% for post in site.news %}
<div class="p-6 md:w-1/2 flex flex-col items-start">
<h2 class="header-text title-font mb-4 cm-gray-1">
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
</h2>
<span class="leading-relaxed mb-4">{{ post.excerpt | strip_html | strip_newlines | truncate: 156 }}</span>
<span>{{ post.date | date_to_string }} | </span>
</div>
{% endfor %}
</div>
</div>
</section>