Comments (8)
A part of this can be implemented now via postProcess
hook. We still need some way to write custom pages (additional hook) before the plugin can be implemented in its entirety, though.
from antwar.
Can't we add pages in the postProcess hook? If we just allow the page the page to have a generic handler?
from antwar.
@eldh postProcess could work. Can we output files there? What would that generic handler look like? How would you define it?
from antwar.
Ah. We need to implement the postProcessPages hook.
Tag.jsx would use react-router.State mixin to get the tag and then fetch post data via PathsMixin.allPosts(). The postProcessPages fn would add one entry per tag, something like
{
url: tag/[tag],
handler: Tag.jsx,
title: [title],
tag: [tag]
}
from antwar.
Can you do that postProcessPages
bit and the changes needed? The whole process has to go there given we are converting post metadata to tag data that in turn is converted into pages. Here's the core algorithm:
// at postProcessPages before you generate tag paths
function gatherTags(posts) {
var tags = {};
posts.forEach(function(post) {
// check each post tag + adjust generated tags accordingly
// XXX: you might want to eliminate possible duplicates here before going
// through tags (ie. ['foo', 'bar', 'foo'])
post.tags.forEach(function(tag) {
if(tag in tags) {
tags[tag].push(post);
}
else {
tags[tag] = [post];
}
});
});
return tags;
}
Tag links per post might be able to rely on some convention like this:
<ul>{tags.map(function(tag) {
return <li><a href={'tags/' + tag}></a></li>;
})}</ul>
That in turn could be wrapped into <Tags data={post.tags} />
kind of helper and so on.
from antwar.
Yeah. I'll look into that when I finished extras/rss. We also need to think about how to theme these pages. Maybe make it possible for the theme to override the handler?
from antwar.
Maybe make it possible for the theme to override the handler?
Yeah. Ordering like plugin, theme, user would make sense.
from antwar.
You can attach tags to pages trivially now. There's also functionality that allows you to implement custom pages so I think we're set. No need to extend the core at least yet.
from antwar.
Related Issues (20)
- Cannot read property 'children' of undefined HOT 1
- Allow partial references to Markdown HOT 1
- Live examples? HOT 1
- ETIMEDOUT getting started HOT 2
- Site descriptions render unprocessed markdown HOT 3
- Site does not shrink to smaller screen sizes
- How to specify devtool for built JavaScript? HOT 2
- Reflect Content Structure in Routing Structure HOT 7
- Relative Links in Development vs. Production HOT 5
- Support Index Page Processing HOT 8
- Missing Title in Head
- Is there a roadmap about the antwar ? HOT 4
- Roadmap HOT 3
- Push redirects to a webpack plugin HOT 1
- React 16 HOT 2
- Antwar Interactive ID Resolving Bug HOT 1
- Use template-literal instead of EJS HOT 2
- Shared vendor bundle HOT 1
- Set title and description via rendered page
- Generated paths (js, and interactives) are not using the "publicPath" webpack config HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from antwar.