squarespace集合 - 循环索引页面

时间:2015-07-13 14:03:46

标签: squarespace

我是squarespace的新手并且不熟悉它是如何工作的,但是我已经搜索并浏览了文档和相关材料,我不能为我的生活找出如何做到这一点。如果我的结构或措辞不明确或不恰当,我会道歉。

我提前感谢你们。

问题:

我有两个索引,两个页面都有,每个页面都有一个缩略图。我创建了一个名为'locations'的集合,我希望以某种方式为这个集合创建一个.item文件来收集两个索引的页面缩略图,这样我就可以通过summary - carousel输出这些数据。

简而言之,我需要一种方法来遍历索引下的每个页面,并获取与每个项目相关联的缩略图和链接。

期望的结果:

能够添加摘要 - 轮播,在两个预定义索引下输出缩略图图像/相关页面链接。

资源:

location.conf:
{
  "title" : "Locations Collection",
  "ordering" : "chronological",
  "addText" : "Add Post",
  "acceptTypes": ["text"]
}

1 个答案:

答案 0 :(得分:0)

您需要查看您的JSON输出,以便考虑循环的逻辑。

通常循环索引逻辑是

import random
import math
import operator as op 

name = input("What is your name? ")
print("Hi {}! Welcome to the Arithmetic quiz...".format(name)) 

score = 0
questions = 10

def quiz():
    x = random.randint(1, 10)
    y = random.randint(1, 10)

    ops = {'+': op.add,'-': op.sub,'*': op.mul} 

    keys = list(ops.keys()) 
    opt = random.choice(keys)  
    operation = ops[opt]  

    answer = operation(x, y)

    print ("What is {} {} {}?".format(x, opt, y)) #prints the question
    user_answer= int(input("Your answer: ")) #prompts users answer

    if user_answer != answer: #validate users answer to correct answer
        print ("Incorrect. The right answer is",answer"")
        return False
    else:
        print("Correct!")
        return True

for i in range(questions): #ask 10 questions
    if quiz():
        score +=1 #counter


print("{}: You got {}/{} questions correct.".format(name, score, questions,))#'question' if (score==1) else 'questions'

但是你必须检查你的页面pretty-json,以便根据你的需要进行编码。

相关问题