Add dev-mode into the posts handler.
This commit is contained in:
parent
bd883ac4ef
commit
cc36f0edf5
@ -153,9 +153,7 @@ app.get(
|
||||
|
||||
## Development
|
||||
|
||||
If the environment variable `ENVIRONMENT` is set and the value is `DEVELOPMENT`
|
||||
then we can easily grab all the Posts, including Drafts, from the
|
||||
`PostService`.
|
||||
If the environment variable `DEPLOY_MODE` is set and the value is `DEVELOPMENT` then we can easily grab all the Posts, including Drafts, so I can see how my content will be rendered out to the page.
|
||||
|
||||
## Deployment
|
||||
|
||||
|
@ -9,6 +9,23 @@ header {
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
header .home-link {
|
||||
font-size: 18pt;
|
||||
}
|
||||
|
||||
header .home-link a {
|
||||
color: #00e;
|
||||
}
|
||||
header .home-link a:visited {
|
||||
color: #00e;
|
||||
}
|
||||
|
||||
footer {
|
||||
border-top: 1px solid #ccc;
|
||||
}
|
||||
|
||||
pre code.hljs {
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
@ -1,44 +0,0 @@
|
||||
/* Tomorrow Theme */
|
||||
/* https://jmblog.github.io/color-themes-for-google-code-highlightjs */
|
||||
/* Original theme - https://github.com/chriskempson/tomorrow-theme */
|
||||
/* https://jmblog.github.io/color-themes-for-google-code-highlightjs */
|
||||
.tomorrow-comment, pre .comment, pre .title {
|
||||
color: #8e908c;
|
||||
}
|
||||
|
||||
.tomorrow-red, pre .variable, pre .attribute, pre .tag, pre .regexp, pre .ruby .constant, pre .xml .tag .title, pre .xml .pi, pre .xml .doctype, pre .html .doctype, pre .css .id, pre .css .class, pre .css .pseudo {
|
||||
color: #c82829;
|
||||
}
|
||||
|
||||
.tomorrow-orange, pre .number, pre .preprocessor, pre .built_in, pre .literal, pre .params, pre .constant {
|
||||
color: #f5871f;
|
||||
}
|
||||
|
||||
.tomorrow-yellow, pre .class, pre .ruby .class .title, pre .css .rules .attribute {
|
||||
color: #eab700;
|
||||
}
|
||||
|
||||
.tomorrow-green, pre .string, pre .value, pre .inheritance, pre .header, pre .ruby .symbol, pre .xml .cdata {
|
||||
color: #718c00;
|
||||
}
|
||||
|
||||
.tomorrow-aqua, pre .css .hexcolor {
|
||||
color: #3e999f;
|
||||
}
|
||||
|
||||
.tomorrow-blue, pre .function, pre .python .decorator, pre .python .title, pre .ruby .function .title, pre .ruby .title .keyword, pre .perl .sub, pre .javascript .title, pre .coffeescript .title {
|
||||
color: #4271ae;
|
||||
}
|
||||
|
||||
.tomorrow-purple, pre .keyword, pre .javascript .function {
|
||||
color: #8959a8;
|
||||
}
|
||||
|
||||
pre code {
|
||||
display: block;
|
||||
background: white;
|
||||
color: #4d4d4c;
|
||||
line-height: 1.5;
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px;
|
||||
}
|
@ -16,6 +16,13 @@ export async function handleSinglePost(c: Context) {
|
||||
|
||||
try {
|
||||
const post = postService.getPost(postSlug);
|
||||
|
||||
if (process.env.DEPLOY_MODE !== "development") {
|
||||
if (post.meta.draft) {
|
||||
throw Error("Unable to find post.");
|
||||
}
|
||||
}
|
||||
|
||||
const meta: SiteMeta = {
|
||||
description: post.meta.description,
|
||||
tags: post.meta.tags,
|
||||
|
@ -14,7 +14,7 @@ export function Page({ children, meta }: { children: any, meta: SiteMeta }) {
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div>
|
||||
<div class="home-link">
|
||||
<a href="/">davesmithhayes.com</a>
|
||||
</div>
|
||||
</header>
|
||||
|
Loading…
Reference in New Issue
Block a user