-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import Mustache from 'mustache'; | ||
import template from './template.html'; | ||
import { getDefaultViewData } from '../../lib/view.js'; | ||
import {emitPageView} from '../../lib/plausible.js'; | ||
import {renderHtml} from '../../lib/sso-render.js'; | ||
import {getRandomBlog} from "../../lib/search.js"; | ||
|
||
export const onRequestGet = async (context) => { | ||
emitPageView(context); | ||
const { env } = context; | ||
|
||
const entry = await getRandomBlog(env); | ||
|
||
console.log(entry); | ||
const viewDefaults = await getDefaultViewData(env); | ||
const view = { | ||
...viewDefaults, | ||
mainClass: 'body inspire', | ||
title: 'About kukei.eu', | ||
entries: [entry], | ||
}; | ||
const html = await renderHtml(template, view); | ||
|
||
return new Response(html, { | ||
headers: { | ||
'content-type': 'text/html', | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{{{ before }}} | ||
<main> | ||
<h1><a href="/">Kukei.eu <br/><span>get inspired</span></a></h1> | ||
<p>Every page load shows one random blog link. <br/> Have fun! Be inspired!</p> | ||
<div class="inspire-entry"> | ||
{{#entries}} | ||
<h4>{{ title }}</h4> | ||
{{#excerpt}} | ||
<p>{{ excerpt }}</p> | ||
{{/excerpt}} | ||
{{#excerptSafe}} | ||
<p>{{{ excerptSafe }}}</p> | ||
{{/excerptSafe}} | ||
<a href="{{ url }}" target="_blank" rel="noopener">{{ url }}</a> | ||
{{/entries}} | ||
</div> | ||
</main> | ||
{{{ after }}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters