Giter VIP home page Giter VIP logo

Comments (8)

bebraw avatar bebraw commented on May 28, 2024

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.

eldh avatar eldh commented on May 28, 2024

Can't we add pages in the postProcess hook? If we just allow the page the page to have a generic handler?

from antwar.

bebraw avatar bebraw commented on May 28, 2024

@eldh postProcess could work. Can we output files there? What would that generic handler look like? How would you define it?

from antwar.

eldh avatar eldh commented on May 28, 2024

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.

bebraw avatar bebraw commented on May 28, 2024

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.

eldh avatar eldh commented on May 28, 2024

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.

bebraw avatar bebraw commented on May 28, 2024

Maybe make it possible for the theme to override the handler?

Yeah. Ordering like plugin, theme, user would make sense.

from antwar.

bebraw avatar bebraw commented on May 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.