Closed jondashkyle closed 6 years ago
Agreed. You already mentioned, but just to concur, the main items I see to address:
url
?url
/path
/source
. should they look different?What's cool is seems like the spec really doesn't need much. I feel like once we agree on the above the spec is more or less there, since any other keys (things like title, text, etc) are really up to the implementer to decide.
FWIW, gonna give my initial 2-cents on the above 6:
content
object with with files and pages on same levelid
of the page, rather than thinking of it as the url
. The reason here is that the url
for pages and files differ slightly. You want the url for a page to be the pretty one, whereas you want the url for a file to be the real path. All lookups w/in nanopage would use this id
for lookups (children, files, etc) kinda like we were thinking here https://github.com/jondashkyle/nanopage/issues/6#issuecomment-382982311url
. For a page, url
is the formatted path, for a file, url
is the content path. I could be missing something with omitting path
and source
here, so just lmk_loaded
key https://github.com/jondashkyle/nanopage/issues/7#issuecomment-384473349More or less, the shape based on above looks like:
{
'/': {
url: '/'
},
'/about': {
url: '/about',
title: 'About',
text: 'Beep Boop',
_loaded: true
},
'/about/file.jpg': {
url: '/content/about/file.jpg',
sizes: {
500: '/content/about/file-500.jpg',
1000: '/content/about/file-1000.jpg',
1600: '/content/about/file.jpg', // full size file
},
dimensions: {
width: 1600,
height: 1200,
ratio: 75
}
}
}
Happy to expand if any q's!
Gonna close this in favor of the conversation being moved to a separate schema repository.
@jondashkyle ping me when you start the schema respository! I couldn't get to this earlier in the week but I think this is a great idea and have a few things to contribute.
Generally, though +1 to everything above
Talking about this with @jongacnik this recently, we began thinking it could be useful to create a formal specification for the type of data structure
nanopage
digests. This would then be applied tohypha
,enoki
, and other libraries could hook into this and reference it, too. A good example ismonoimage
.The discussion surrounding image sizes is a good example of what could be covered in this specification. The flat-structure and paths as keys is another good example.
Another discussion could be around urls. For instance, hypha generates
url
,path
, andsource
keys, each which behaves differently and is at the moment somewhat convoluted.url
is the formatted path (e.g./about
)path
is the actual path to the content (e.g./content/about
)source
is the remote path for content which exists elsewhere (e.g.https://example.com/content/about
)Part of this specification could be a testing tool to ensure data is structured correctly. In this way, you wouldn’t be required to follow step-by-step to follow the specification, but could simply evaluate your tool against the specification.
Looking to collect some good resources here, and perhaps we can create a repository for this.
@jongacnik @s3ththompson